#dev 2025-05-08

2025-05-08 UTC
[tw2113], grufwub, gRegor, alephalpha0, perryflynn, bterry1, gRegorLove_, [morganm], NaomiAmethyst, gRegorLove__, jeremy, chudincolous, [qubyte], Guest6 and [KevinMarks] joined the channel
#
[KevinMarks]
Can you do it with a nunjucks macro? That would let you keep state in a variable.
PsyLok, ttybitnik, jeremy, jeremycherfas, barnaby, gRegorLove__, gRegorLove_, [schmarty], NaomiAmethyst6, btrem and lanodan joined the channel
#
Loqi
[KevinMarks] has 11 karma in this channel over the last year (28 in all channels)
#
btrem
[KevinMarks]++ thanks for replying yesterday re: keeping track of footnote numbers. Sorry, I only just now saw your reply. I think a macro would have the same problem. Each macro call is independent. It wouldn't know that it had already been called on that template.
#
btrem
Or, if it could know, I can't think of how! ;-)
balintm joined the channel
#
[KevinMarks]
You can make a macro that is an external js function that can keep state
#
btrem
[KevinMarks]: I can't imagine how. The problem as I see it as that every invocation of a shortcode or macro would be a new call to the js function. But I'm not a terribly advanced js programmer, so maybe I'm missing something.
#
Zegnat
btrem: I have CSS add my footnote numbers so they are always in the right order
#
Zegnat
(Just added it to /footnote on the wiki aswell)
#
[KevinMarks]
Oh, maybe I have mixed up filters, which run in the node environment with macros, where I'm not sure <% set %> does what you want
#
btrem
I hate to rely on stylesheets for something that is core content. It's a clever idea, but I'm sort of trying to do the same thing with 11ty/front matter/static html.
#
btrem
[KevinMarks]: I don't think a <%set%> directive can be modified by a call to a macro or shortcode.
#
[tantek]
btrem, I would feel weird about using styles for what amount to semantic numberings as well
#
Zegnat
I liked it for the page I do it on, because it actually makes a partial sentence (multiple words) into the <a> that links to the explaining footnote. So the number is actually just an extra visual aspect to enhance the link
#
Zegnat
Rather than the number being the link itself
#
Zegnat
But also super obvious that the pattern might not cleanly apply to all sorts of content
#
btrem
Zegnat: I can see how that might work. Though it's an unconventional way to mark footnotes. In a sense, I was trying to replicate css counters in my 11ty shortcode. So each footnote ref would have been {% fn %}. And the footnotes would be an array of strings in front matter. The second part is easy, and done. The first part probably can't be done.
#
[KevinMarks]
Hm, so you're wanting a `yield` pattern
ttybitnik joined the channel
#
btrem
Not sure what a `yield` pattern is. So, maybe?
chimo joined the channel