Problem/Motivation

The 4x branch uses the <footnotes> attribute like <drupal-media> does. Provide a 'use at own risk' drush command to allow user's to upgrade from 3x to 4x after testing thoroughly in non-production environments.

Steps to reproduce

<fn> and [fn] are not supported in 4x. Any site with existing footnotes will not show up.

Proposed resolution

Drush command to batch update all fields that use text format.

Remaining tasks

Create the drush command

User interface changes

None

API changes

None

Data model changes

None

Issue fork footnotes-3413152

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

scott_euser created an issue. See original summary.

scott_euser’s picture

Issue summary: View changes
scott_euser’s picture

Issue summary: View changes

scott_euser’s picture

Status: Active » Needs review

This seems to work fine for me, but really needs testing by others to confirm this helps them upgrade sites.

john_b’s picture

Status: Needs review » Needs work

Works for simple use cases, thanks.

Problems:
1. Where content creators have added space at start and end of footnote text, inside tags, this space needs to be removed. Footnotes 4.x converts that space to

tags, and 3.x does, so our content creatores often wrap text in line breaks for clearer layout of HTML layout. Content creators do not want the upgraded footnotes to add a paragraphs at start and end of footnotes, where 3.x had none.

2. The drush command converts ' fake apostrophes to HTML entity references but does not covert real apostrophes ’ (which some fonts print as forward sloping ticks). Our content creators prefer real apostrophes even though standard English keyboards do not have a key for them. So long as normal punctuation breaks Footnotes 4.x, and #3414604: Support adding the text content within the <footnotes> element remains unfixed, all punctuation which breaks footnotes would need to be converted by an upgade command.

scott_euser’s picture

Sorry for being a pain but here again can you provide example markup you are running this against + actual vs expected output after the drush command? It would make it much easier for me to work on this.

Thanks!

john_b’s picture

Here is a piece of HTML outputted by the drush command.

<footnotes data-value="" data-text="@Malaria Consortium’s seasonal malaria chemoprevention program: Philanthropy report 2020@, Pg. 5."></footnotes>

I don't what the expected output is. I do know that the inclusion of a real apostrophe in Consortium’s as distinct from a fake / keyboard apostrophe, is enough to break footnotes when using 4.x but not when using 3.x.

You can see an example of the extra space at start and end of the footnote text at https://www.drupal.org/project/footnotes/issues/3414604#comment-15397449. If 4.x. is going to turn this extra space into <p> tags, in a way that 3.x. did not, that space should be removed, and documetation should warn content creators to stop adding such space for clearer layout in their HTML source editing window.

scott_euser’s picture

I do not fully understand what you mean with the extra space thing. Can you explain further? Thanks!

scott_euser’s picture

To note

Lorem ipsum<footnotes data-value="">
Reference text here
</footnotes>. Dolor sit amet.

Does not cause any <p> tag wrappers. So perhaps sorted when #3414604: Support adding the text content within the <footnotes> element gets in?

scott_euser’s picture

Status: Needs work » Needs review

Putting this back to needs review. Probably issues raised when not using CK Editor by @John_B are sorted in #3414604: Support adding the text content within the <footnotes> element and a follow-up issue can be made to provide a drush command that gives the option to put the reference text like <footnotes data-value="">content here</footnotes> instead of <footnotes data-value="" data-text="content here"></footnotes>.

scott_euser’s picture

scott_euser’s picture

john_b’s picture

Status: Fixed » Needs work

Many thanks. I finally got round to testing. Sorry about the delay.

This does not work where there is a line break before the start of the footnote text.
For example, this works:
Here is some body text.<footnotes data-value="">Here is some footnote text.</footnotes>

When editors are working without WYSYWIG, they will add line breaks for better layout.

Here is some body text.<footnotes data-value="">
Here is some footnote text.
</footnotes>

Editors may also add line breaks within footnote text. For example:

Here is some body text.<footnotes data-value="">Here is some footnote text.
Here is some more footnote text, which should appear after a line break.

Here is a second paragraph of footnote text.</footnotes>

When using the above, including one or more line breaks before, after, or within the footnote text, the footnotes are empty. DBlog says Warning: DOMDocumentFragment::appendXML(): ^ in Drupal\footnotes\Plugin\Filter\FootnotesFilter->process() (line 161 of /home/website/dev_html/web/modules/contrib/footnotes/src/Plugin/Filter/FootnotesFilter.php)

Enabling / disabling the 'convert line breaks to p tags' filter makes no difference.

john_b’s picture

Separate issue, but I am also concerned if we upgrade footnotes using this drush command, and a year later the content creators decide they want to start using CDEditor.

scott_euser’s picture

Status: Needs work » Fixed

Thanks John_B, sounds clear, I have moved it to a follow-up child issue rather than re-opening and added your details #3419353: Trim footnotes text via drush command upgrade path from 3.x to 4.x.

scott_euser’s picture

Apologies missed this:

Separate issue, but I am also concerned if we upgrade footnotes using this drush command, and a year later the content creators decide they want to start using CDEditor.

Yes you can see my comment here. I created an issue for that here and added instructions in case someone wants to tackle it.

Status: Fixed » Closed (fixed)

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