Allow footnote reference links to be aware of other instances to the same footnote

Created on 10 November 2021, about 3 years ago
Updated 4 August 2023, over 1 year ago

Problem/Motivation

I am implementing this module within the Drupal WxT distro and as such, need to adhere to wet-boew guidelines on footnotes. I can support these requirements using the module as is, with one exception. When there is more than one instance of a footnote reference link to a certain value, the link to the footnote needs to be aware of which instance it is.

Example:

<sup id="fn1-1-rf">
  <a class="fn-lnk" href="#fn1">
    <span class="wb-inv">Footnote </span>1
  </a>
</sup>

<sup id="fn1-2-rf">
  <a class="fn-lnk" href="#fn1">
    <span class="wb-inv">Footnote </span>1
  </a>
</sup>

<sup id="fn2-rf">
  <a class="fn-lnk" href="#fn1">
    <span class="wb-inv">Footnote </span>2
  </a>
</sup>

As you can see above, there are two reference links to Footnote 1. In this case, the ID of the wrapping <sup> tag needs to include the instance number (fn1-1-rf, fn1-2-rf). If only one instance occurs, then the instance number need to be excluded (fn2-rf). This detail allows the wet-boew JS to dynamically change the link in the footnote that points back to the reference link. So if you click the first instance of the reference link then the footnote link points back to the first instance. If you click the second instance of the reference link then the footnote link points back to the second instance, and so on.

Data model changes

For this to work, I need to have access to the total number of instances and the current instance within the footnote-link template file. Therefore this ticket will be adding two elements to the footnote item array ($fn); instances, instance. The footnote item array will contain the following:

  • value
  • text
  • text_clean
  • fn_id
  • ref_id
  • instances (total number of instances)
  • instance (current instance)
Feature request
Status

Fixed

Version

3.0

Component

Footnotes

Created by

🇨🇦Canada smulvih2 Canada 🍁

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024