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

feat: add overrides num-columns and group-heading-level #60

Closed
wants to merge 1 commit into from

Conversation

swaits
Copy link
Contributor

@swaits swaits commented Sep 30, 2024

Before this change, group-heading-level defaulted to reusing the last heading level found in the document. This is unlikely to always work for users. This new parameter allows users to override the default.

Additionally, to give users some ability to style the output without needing to override user-print-glossary, the new num-columns parameter gives users the ability to control the number of columns groups are printed in.

Before this change, `group-heading-level` defaulted to reusing the last
heading level found in the document. This is unlikely to always work for
users. This new parameter allows users to override the default.

Additionally, to give users some ability to style the output without
needing to override `user-print-glossary`, the new `num-columns`
parameter gives users the ability to control the number of columns
groups are printed in.
@quachpas
Copy link
Collaborator

quachpas commented Oct 1, 2024

Thanks! Will take a look at the group-heading.
For the columns feature, I'd rather we discuss it in a separate issue/PR. I don't like the idea of giving a columns container TBH.

@swaits
Copy link
Contributor Author

swaits commented Oct 1, 2024

Understood. Glad to move it to a new PR.

If columns is not set (ie default 1), we could make sure it's not in a column container. IOW, only contain it in #columns() when the user asks for something >1. Does this make it more amenable? The reason I added it, for my own need, is because index-style glossaries are often multi-column. It felt like something users may commonly want, and this way they can get it without the trouble of re-implementing a bunch of functionality in the library.

@quachpas
Copy link
Collaborator

quachpas commented Oct 1, 2024 via email

@swaits
Copy link
Contributor Author

swaits commented Oct 3, 2024

I'm fine with that. I think my challenge with the current interface for overriding styling is that it forces the user to mix logic with styling. I don't want to re-implement for g in groups { for e in entries { ... } }. I just want to say, hey, here's how to style this part of the hierarchy. Until these concerns are split apart, we'll continue to see high friction to theming, and thus, few or no themes published or contributed back.

But again, I understand your point, completely. It is also weird to take what I'm saying in the complete opposite direction and start polluting the glossarium internals with styling overrides.

@swaits
Copy link
Contributor Author

swaits commented Oct 3, 2024

BTW, for some inspiration, check out https://en.wikipedia.org/wiki/Citation_Style_Language if you haven't seen it already. It's not perfect, but it does completely separate logic from presentation.

@quachpas quachpas self-requested a review October 4, 2024 05:46
@quachpas
Copy link
Collaborator

quachpas commented Oct 4, 2024

I think my challenge with the current interface for overriding styling is that it forces the user to mix logic with styling.

Yes, the main point of the current styling is to allow advanced users who are familiar with Typst scripting to only modify the relevant elements.

For the columns option:

  • How about this? I'd rather not have the multi-columns style as an option of the default theme. Could you put it in a separate theme by overriding default-print-glossary? Just define it again in a file called multi-columns.typ with any new additional options you'd think are elevant, e.g., columns.
  • For the group heading level, as long as you remove the columns, I will test and review

Finally, thanks for the discussion, it's great to know other people are interested in making glossarium better

@tfachada
Copy link
Contributor

Hi, two questions about the group-heading-level fix:

1- Sorry for bothering, but what's the current status on this?

2- Wouldn't it be better if the default value for group heading levels, instead of being "the same as the previous", was "the same as the previous, plus one"? I understand that this PR aims to allow the user to choose, but the thing is that the default value before Typst 0.12 was "plus one", and honestly it seems more logical to me (I'm open to counter-arguments though). Besides, I've only just noticed, completely by chance, that the current value breaks my post-0.12 template, and I suspect that this breakage is the same with the majority of the users at this point.

@swaits
Copy link
Contributor Author

swaits commented Oct 20, 2024

I don't think any default makes sense. Some users might want it same as before. Others might want it before+1.

I've since found a workaround myself so I'm all set. But I'd say if you see more people run into this then we should consider adding some flexibility and control for heading level.

@tfachada
Copy link
Contributor

tfachada commented Oct 20, 2024

My point with +1 being more logical is that a group is supposed to be a subcategory of terms within the glossary, and as such having a h1 "Glossary" title followed by also h1 titles for groups would be the same thing logically (in terms of outline) as multiple glossaries. Though then again, the workaround I found, which I suppose may be the same as yours, would be to print multiple glossaries too but with h2 titles before the subcategory ones, so the group feature might be pointless.

@quachpas
Copy link
Collaborator

1- Sorry for bothering, but what's the current status on this?

I'll probably split the commit and implement the group-heading-level + 1 by default, and add group-heading-level parameter.

quachpas added a commit that referenced this pull request Oct 27, 2024
@quachpas
Copy link
Collaborator

Closing in favor of #73.
I'll create an issue to track the columns.

@quachpas quachpas closed this Oct 27, 2024
quachpas added a commit that referenced this pull request Oct 27, 2024
@swaits swaits deleted the feat/style-overrides branch October 28, 2024 22:03
@RBW1999 RBW1999 mentioned this pull request Nov 9, 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

Successfully merging this pull request may close these issues.

3 participants