Page MenuHomePhabricator

No paragraphs/linebreaks in references by inserting empty lines
Open, LowPublic

Description

In the software at Wikisource it not possible to have paragraphs (by inserting empty lines) in references similar to the normal text. See: https://en.wikisource.org/wiki/User:Aschroet/test. In the normal HTML view the empty lines are just ignored and only one text block is shown. Even more interesting is the behavior in case when the text is exported by "Download as PDF". There, the paragraphs are created but not in a correct way.

The usage of <nowiki><p></nowiki> helps for the HTML view but not for PDF. The usage if <nowiki><br /></nowiki> works but does not generate real paragraphs but only newline in HTML and PDF.


Version: 1.22.0
Severity: minor

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:31 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz55674.
bzimport added a subscriber: Unknown Object (MLST).
Aschroet created this task.Oct 13 2013, 3:15 PM

Thanks for taking the time to report this!

What is an example/real usecase to use paragraphs in references?

As you wrote, a workaround is to insert a <br> to enforce a linebreak.

[Resetting component, as "Export/Import" refers to "Special:Export and Special:Import" only.]

For the example, in Wikisource we convert orignial sources to digital texts. Footnotes as e.g. in https://de.wikisource.org/wiki/Seite:Die_Gartenlaube_%281865%29_703.jpg (sorry, i usually work in German wikisource) are mapped to <ref> blocks. Since they are from time to time a little bit longer there are paragraphs inside the footnodes.

Yes, <br /> enforces a line break but not indent of the following sentence.

I am just wondering why there is a different treatment in references than in the normal text for "normal" paragraphs.

This problem has been going on for awhile for ref tags.

Until today, newlines did not work correctly in blockquotes and various blockquote type templates (bug 6200). The bug was finally fixed today on enwiki after 8 1/2 years and 2 years after a patch was submitted. The reason for finally fixing it was because Virtual Editor thought newlines should actually work like newlines. Silly VE.

Does VE think newlines should actually work in ref tags?
https://en.wikipedia.org/wiki/Mormons, ref 110 uses a newline.

Newlines also don't work in Image/File brackets. Does VE think newlines should actually work there too?
https://en.wikipedia.org/wiki/Angular_momentum, second to last image is an example.

bgwhite: Not sure if the VisualEditor codebase itself thinks or will answer your questions here. Maybe you want to rephrase for humans.

My mind doesn't always understand itself either.

Currently, newlines inside <ref> tags or Image/File brackets are ignored. This was also the case for <blockquote> and various quote templates.

Due to Visual Editor's logic, VE was *not* ignoring newlines in <blockquote> or the quote templates. The solution to fix whether newlines should or shouldn't be ignored was bug 6200. 6200 fixed the parser code so newlines are *not* ignored by anyone.

The question is, does VE respects newline characters in <ref> and Image/File brackets? I ask the question because:

  1. Bug 6200 languished for eight years until the problem showed up in VE
  2. If VE is not ignoring the newlines, this too becomes a VE vs parser issue.
  3. To show a past precedent of newlines being ignored and the bug being fixed.
GOIII added a subscriber: GOIII.Dec 21 2014, 7:58 PM

In the software at Wikisource it not possible to have paragraphs (by inserting empty lines) in references similar to the normal text....

The same type of DIV-ish hack folks used for BLOCKQUOTE works for one or more newlines wrapped within REF tags as well.

I'm under the impression the ''paragraphStack'' approach in the parser was always at fault when it came to this (or at least plays a role in one reported instance or another). Seems like it should lead off with a closing P tag instead of a BR to me (resulting in an empty P tag at worst).

... but I don't know enough about this stuff to be sure about much truth be told.

This bug causes an accessibility issue for screen reader users like myself, allbeit a minor one, because it makes it difficult to create HTML paragraphs that are semantically correct, as discussed at:

https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Manual_of_Style/Accessibility&oldid=661776586#.7B.7Bparagraph_break.7D.7D

RexxS added a subscriber: RexxS.May 11 2015, 1:13 PM

Background:

This issue manifests itself most often when using "bundled references" - https://en.wikipedia.org/wiki/Wikipedia:Citing_sources#Bundling_citations - where a single citation calls up multiple sources. Semantically references are a list and what we really ought to be doing is for the bundled references to be a nested list within one item of the overall list. However, the visual presentation of references is often the dominant factor among editors and they try to make each reference in the bundle display on a new line. This is sometimes implemented by inserting a raw <p> tag into the wikitext to create a paragraph and that is (i) semantically incorrect; and (ii) an annoyance for users of screen readers. Using <br> is similarly problematical.

In any case, inserting a blank line does not cause bundled references to display on separate lines as would be expected, hence this bug.

Izno moved this task from Unsorted backlog to Defect backlog on the Cite board.Sep 6 2016, 9:25 PM
Restricted Application added a subscriber: jeblad. · View Herald TranscriptAug 19 2019, 8:34 AM

Change 572301 had a related patch set uploaded (by Pastakhov; owner: Pastakhov):
[mediawiki/services/parsoid@master] Replace new lines with <br> tag in <ref> (patch for v0.11.0) Do Not Merge!

https://gerrit.wikimedia.org/r/572301

Change 572301 abandoned by Pastakhov:
Replace new lines with <br> tag in <ref> (patch for v0.11.0) Do Not Merge!

https://gerrit.wikimedia.org/r/572301

Change 574116 had a related patch set uploaded (by Pastakhov; owner: Pastakhov):
[mediawiki/services/parsoid@master] Replace new lines with <br> tag in references

https://gerrit.wikimedia.org/r/574116

thiemowmde edited projects, added Parsoid; removed Cite, Wikisource.Feb 22 2020, 3:32 PM
thiemowmde added a subscriber: thiemowmde.

I'm afraid this is not a bug, but an intentional feature of both the MediaWiki-Parser and the Cite extension.

First, references are meant to be text (technically: inline elements). When <ref> tags are rendered, the text is enclosed in <span class="reference-text">. However, we are not limiting the features that can be used in <ref>. This is mostly for historical reasons. Cite is old. Users are free to use all wikitext features in <ref>, but we do not and can not guarantee they are all rendered exactly the same as in other contexts.

The fact an empty line in a <ref> does not create a paragraph is, strictly speaking, unrelated to <ref>. The same happens outside of references. Example wikitext:

* <span>This does

not render as two paragraphs.</span>

This creates a single list item without any line breaks. As said above, I believe this is intentional and not a bug. If this behavior is going to change, we certainly can't just add a hack to some arbitrary <ref> code, but would need to fix this in all existing Parsers.

Note we can't use <p> elements in a list.

Arlolra moved this task from Needs Triage to Future Ideas on the Parsoid board.Feb 24 2020, 6:18 PM
Varlin added a subscriber: Varlin.Apr 30 2020, 3:19 PM

IMO the editor should add <br> tags when the VE user press Enter inside <ref>. Because presently the behavior is not "WYSIWYG" (loss of new lines after saving the page), and, personally, I have an intensive use of references with different paragraphs.

Xover added a subscriber: Xover.May 6 2020, 7:24 AM

Change 574116 abandoned by Thiemo Kreuz (WMDE):
[mediawiki/services/parsoid@master] Replace new lines with <br> tag in references

Reason:
Please create a new Phabricator ticket to let the Parsoid and VisualEditor teams know what's going on. I'm closing this proposal for now because it is almost certainly not a valid way forward, and to free up our review queues. You can link it from the ticket, and it can be reopened later if it turns out it's a valid way forward.

https://gerrit.wikimedia.org/r/574116