seankwilliams / modern-footnotes

WordPress plugin to provide inline footnotes inspired by the styles of Grantland and FiveThirtyEight
14 stars 10 forks source link

Possibility for "reference reset" #29

Closed kyleconrad closed 4 years ago

kyleconrad commented 4 years ago

Being able to manually add a reference number is great, but on a site I'm working on, I'm looking at separate chunks of content with upwards of 10 footnotes per section (broken up into "chapters" sort of) - is there a way of adding a "referencereset" option or the like, vs a specific reference number, that would the reset the count? Would make it easier vs manually numbering each footnote. Thanks!

seankwilliams commented 4 years ago

@kyleconrad thanks for the note! I think this would be helpful, though it might be a bit until I could get this update in.

Here are the technical notes on what would be needed for this:

  1. First, change modern_footnotes_func to consider a referenceset attribute. If it's set, $modern_footnotes_used_reference_numbers would be reset to an empty array. That function would also need to write an attribute out to the HTML so the JavaScript knows to reset reference numbers at that point.
  2. Then, in the JavaScript, the section that starts with the line var $footnotesAnchorLinks = ... would need to be changed so that it considers the new HTML attribute while writing out reference numbers.
seankwilliams commented 4 years ago

This has been implemented and will be released in a few minutes in a plugin update. If you make a footnote tag like [mfn referencereset='true'], the footnote numbering will restart at 1.