Problem/Motivation
The current module output of the citations within the text creates rather clunky output that's not as clean as it could be, e.g.:
<sup><a href="$link1">1</a></sup>
<sup>,</sup>
<sup><a href="$link2">3</a></sup>
<sup>,</sup>
<sup><a href="$link2">3</a></sup>
Because of the inherent whitespace added on each footnote item, it results in the output not being as clean as it should be.
Steps to reproduce
Add multiple footnotes beside each other in a text field.
Display the output.
Proposed resolution
Optimize the footnote links so that they follow the following format:
<sup><a href="$link1">1</a>, <a href="$link2">2</a>, <a href="$link2">2</a></sup>
This should be done in FootnotesFilter::process. Steps:
- For the xpath query loading footnotes, determine if there are multiple adjacent footnotes
- Build a render array and render the markup for the multiple adjacent footnotes
- Replace the DomNode content.
Remaining tasks
Create merge request
User interface changes
TBC
API changes
TBC
Data model changes
TBC
Issue fork footnotes-3298390
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
damienmckennaI'm 50/50 on whether this is a bug report or a feature request.
Comment #3
scott_euser commentedIts likely I'll create a 4x branch to modernise this module a bit (see https://www.drupal.org/project/footnotes/issues/3405986 ), seems like this would be a good thing to handle in 4x. Our front-end team at my agency has also flagged the status quo is not great and also suggested
Comment #4
scott_euser commentedSuggesting 4x because otherwise it could be breaking existing sites.
Comment #5
scott_euser commentedComment #6
scott_euser commentedComment #9
scott_euser commentedOkay this is part of 4x branch now. Comes with an empty footnote-links.html.twig where you can decide to add your own commas/wrappers/etc easily. Requires that the footnotes added are direct siblings of each other in the DOM which means a space in between likely will not work. I have made a note of this to add to the documentation here #3413186: Improve documentation of footnotes features and upgrade path
Thanks for the feature suggestion!