Omikhleia / resilient.sile

Advanced book classes and packages for the SILE typesetting system
MIT License
21 stars 4 forks source link

Styles do not allow not showing captioned element numbers #21

Closed Omikhleia closed 1 year ago

Omikhleia commented 1 year ago

From discussion https://github.com/Omikhleia/markdown.sile/discussions/34#discussioncomment-5345797

There are two different ways at looking at this topic:

Regarding the second point, in the above-mentioned discussion, I wrote:

styles currently don't address it

But it's kind of an overlooked topic or a loophole in the logic:

https://github.com/Omikhleia/resilient.sile/blob/d25cc412ba3e798721d8d5cd86d836b0fbb0157f/packages/resilient/sectioning/init.lua#L118-L128

That "else" seems bad :) When the sectioning style has no numberstyle.main entry, we issue a warning, and still display an "unstyled" number. Perhaps we should just accept it and not show anything there. It would need proper documentation --

With (default) style such as:

figure-caption:
...
    sectioning:
      counter:
        id: "figures"
        level: 1
      numberstyle:
        main: "figure-caption-main-number"
        reference: "figure-caption-ref-number"
      ...

One gets the number displayed with the said figure-caption-main-number numbering style....

But if the main field is removed from the definition, rather than warn and do something, we could just skip the number output...

no-vici commented 1 year ago

Can something like:

figure-caption-main-number:
  inherit: "figure-caption-base-number"
  origin: "resilient.book"
  style:
    font:
      features: "+smcp"
    numbering:
      display: true|false
      after:
        kern: "iwsp"
        text: "."
      before:
        text: "Hình "

And could if secStyle.numberstyle.main.display then implemented?

Omikhleia commented 1 year ago

Well, number styles already have a display: "⟨format⟩" field (for "arabic", "roman", etc.). (the default if absent being arabic). Of course we could use a special value here (e.g. display: "none") or add a different field (e.g. visible: true|false)... But I am not sure whether we should go that way or not. Number styles are used in a variety of contexts (e.g. page folio, footnote calls and references)... I'm not sure it's perfectly safe to have the ability of them being not shown in these cases... But perhaps it's what we would want eventually... E.g. a way to disable all folio numbering, lol.

The "else" bit of code in sectioning styles referred to above is clearly overlooked, and removing it would solve our issue here. Whether to also extend the numbering styles and generalize the hiding of numbers... I just dunno...

no-vici commented 1 year ago

visible: true|false

Sounds much reasonable in this context. It would be a nice feature to have, but if too much effort required, then it should not be put on the priority list. I have a feeling that you've have started thinking about a way ;)

Can't thank you enough for all the answers.