faktaoklimatu / web-core

The core website framework for climate facts websites
https://faktaoklimatu.cz
Other
0 stars 1 forks source link

Glossary plugin issues #10

Open mukrop opened 3 years ago

mukrop commented 3 years ago

(Regarding Hacktober, this issue is meant only for advanced contributors.)


Original description:

I need to adjust the glossary plugin to pass the site configuration context down to the glossary content template in order to generate correct localized link slug (the "/slovnik" part). However, Converters (current type of the glossary plugin) don't have access to site context (it's complicated, google around for more details).

Question for @mgrabovsky: Why is the glossary plugin not a simple tag or a pre/post-render hook? Was this because of the rendering problems? Or is this just a historical debt as we did not know Jekyll well enough back then? The inherited flow of a hook/tag seems easier and more consistent to me than the current solution but I may not see the full picture yet.

mgrabovsky commented 3 years ago

We used to process the tag in :post_render but there were some strange issues due to interactions with Kramdown. @Tasssadar moved the implementation to a custom converter in 3b7f0fab.

The original implementation was also due to @Tasssadar if I recall correctly, although I finished it up. I suppose we went with <glossary> because we weren't perfectly familiar with Jekyll (well, I wasn't) and the implementation seemed simple and flexible enough.

Jekyll tags seem like a usable alternative, so I would support a migration provided they will work the same as <glossary>. For instance, make sure that {% glossary co2eq text="CO<sub>2</sub>eq" %} renders correctly, that it works at the beginning of a paragraph, etc.

mukrop commented 3 years ago

My conclusion was also that a more Jekyll-compatible solution would probably be better now when we know our way round Jekyll a bit better. The syntax you write seems reasonable, though correct functionality on all places remains to be tested... I'm unassigning you as I see the discussion closed, but feel free to do it if you want (but it's not a priority now).

Tasssadar commented 3 years ago

I think the jekyll tags might be a problem when the glossary term is in another .yml, like here https://github.com/faktaoklimatu/web-cz/blob/1a3229a8fb42c4179285db3b4d4eaa5f500dbb5d/_data/tags.yml#L33 . But that's just off the top of my head, haven't tested it.