Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Counter #2

Open
metaist opened this issue Jan 3, 2024 · 6 comments
Open

add: Counter #2

metaist opened this issue Jan 3, 2024 · 6 comments

Comments

@metaist
Copy link
Owner

metaist commented Jan 3, 2024

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

  • name: yes
  • system: no; just give me a .render function instead
  • negative: no; I only have non-zero positive numbering
  • prefix / suffix: maybe; for now I just need .value or (value)
  • pad: no; just change your .render
  • range / fallback: no; I don't have limited range
  • symbols / additive-symbols: no; I don't support this style
  • speak-as: interesting, but not relevant for my use case
@metaist
Copy link
Owner Author

metaist commented Jan 3, 2024

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

@metaist
Copy link
Owner Author

metaist commented Jan 3, 2024

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
Copy link
Owner Author

metaist commented Jan 3, 2024

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
Copy link
Owner Author

metaist commented Jan 4, 2024

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
Copy link
Owner Author

metaist commented Jan 4, 2024

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 metaist closed this as completed in e583aa7 Jan 4, 2024
@metaist
Copy link
Owner Author

metaist commented Jan 21, 2024

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

@metaist metaist reopened this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant