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:

  1. For the xpath query loading footnotes, determine if there are multiple adjacent footnotes
  2. Build a render array and render the markup for the multiple adjacent footnotes
  3. Replace the DomNode content.

Remaining tasks

Create merge request

User interface changes

TBC

API changes

TBC

Data model changes

TBC

Issue fork footnotes-3298390

Command icon 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

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Category: Bug report » Feature request

I'm 50/50 on whether this is a bug report or a feature request.

scott_euser’s picture

Its 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

scott_euser’s picture

Suggesting 4x because otherwise it could be breaking existing sites.

scott_euser’s picture

Version: 3.0.1 » 4.0.0-alpha1
scott_euser’s picture

Title: Improve footnote links output » Improve footnote links output (ie, the citations in the text)
Issue summary: View changes

  • scott_euser committed 9012e986 on 4.0.x
    Issue #3298390 by scott_euser: Improve footnote links output (ie, the...
scott_euser’s picture

Status: Active » Fixed

Okay 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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.