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

Styles do not allow not showing captioned element numbers #21

Closed
Omikhleia opened this issue Mar 17, 2023 · 3 comments · Fixed by #22
Closed

Styles do not allow not showing captioned element numbers #21

Omikhleia opened this issue Mar 17, 2023 · 3 comments · Fixed by #22
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@Omikhleia
Copy link
Owner

Omikhleia commented Mar 17, 2023

From discussion Omikhleia/markdown.sile#34 (reply in thread)

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:

if numbering then
if secStyle.numberstyle.main then
SILE.call("style:apply:number", { name = secStyle.numberstyle.main, text = number })
if SU.boolean(numSty.numbering and numSty.numbering.standalone, false) then
SILE.call("break") -- HACK. Pretty weak unless the parent paragraph style is ragged.
end
else
SU.warn("Attempt typesetting a section number without style")
SILE.typesetter:typeset(number)
SILE.call("kern", { width = utils.interWordSpace() })
end

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...

@Omikhleia Omikhleia added bug Something isn't working documentation Improvements or additions to documentation labels Mar 17, 2023
@no-vici
Copy link

no-vici commented Mar 18, 2023

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

Omikhleia commented Mar 18, 2023

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

no-vici commented Mar 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants