metaist / inkfill

multi-document template engine
https://metaist.github.io/inkfill/
Other
0 stars 0 forks source link

add: Counter #2

Open metaist opened 11 months ago

metaist commented 11 months ago

I generally like the way that CSS Counter Styles 3 works, but I don't think I need most of that functionality.

metaist commented 11 months ago

So... mostly I'll borrow the naming and meaning from the Predefined Counter Styles.

metaist commented 11 months ago

When registering a Style, I should probably raise an exception if it's already been registered. (And then I need an override=True to let me do it anyway.)

metaist commented 11 months ago

So .up() increments the current level. What if there are no levels? Should that raise an exception?

Probably not for now, but something to consider.

metaist commented 11 months ago

So it looks like I have two different kinds of "styles": numeral systems and formatting. And for "formatting" there are two kinds of display: the full citation (when making a reference) and the definition format.

metaist commented 11 months ago

After much back-and-forth, I think I finally have it in a basic form I like. Levels and References are both Ref objects with slightly different purposes. The former manages which kind of section we're in an how things get formatted (via .push()) while the latter controls how we reference this specific location (via .up()).

This is definitely different that the CSS 3 Counter Styles in many ways.

metaist commented 10 months ago

I'm reading the W3C spec for Counters to see if there's anything from there worth implementing.