#How do you handle sublevels in a custom numbering function?

7 messages · Page 1 of 1 (latest)

shrewd crater
#

I have this piece of code:

#set enum(numbering: (first, ..last) =>
if last.pos().len() == 0
{ return [#first.] } 
else {return [*#{"ABCD".at(last.at(-1) -1)}:*]}
)
+ foo
    + bar

However, the bar is prefixed with a 1. numbering instead of A:. When trying to debug the statement, I noticed that last is always empty. Why?

#

I was able to get around this with full: true, but that seems like a hack.

sand crater
#

I don't think that's a hack, that's how it's intended to work. Need to use full to get more than just first

shrewd crater
sand crater
#

for enums, it can only work with full: true if you have a function there

hexed roost
#

with full: false the numbering format receives a single number and so only displays one number at a time, for each level, whereas with full: true it will receive and display the numbers for all levels simultaneously