Page MenuHomePhabricator

Automatic references list after page-terminal ordered or bullet list generates unbalanced HTML
Open, LowPublic

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 20 2016, 12:28 AM
Jdforrester-WMF renamed this task from Reference list does not function if document ends with bullet points to Automatic references list after page-terminal ordered or bullet list is a bullet list (not an ordered list) and doesn't work.Nov 22 2016, 8:20 PM
Jdforrester-WMF triaged this task as Low priority.
Jdforrester-WMF edited projects, added Cite; removed VisualEditor.
Jdforrester-WMF updated the task description. (Show Details)
Izno moved this task from Unsorted backlog to Defect backlog on the Cite board.Nov 22 2016, 8:40 PM

The "fun" is because WMF is using tidy. Otherwise there's no fun, because it completely trashes the skin. See this for example

This is heavily impacting us, because we usually have a trailing section on the page with a bullet list listing the page title in other languages, and having a missing references is almost-always causing this weird code.

Another test on WMF wikis with the generated output: https://www.mediawiki.org/wiki/Special:ApiSandbox#action=parse&format=json&oldid=2720811&disablelimitreport=1&disabletidy=1

This is the HTML (or rather tagsoup) code it generates:

<p>Text with references but no references tag<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
</p>
<ul>
  <li> This is a bullet list
   <div class="mw-references-wrap">
     <ol class="references">
  </li>
</ul>
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">1</a></span> <span class="reference-text">This is a reference</span></li>
</ol>
</div>
Ciencia_Al_Poder renamed this task from Automatic references list after page-terminal ordered or bullet list is a bullet list (not an ordered list) and doesn't work to Automatic references list after page-terminal ordered or bullet list generates unbalanced HTML.Feb 21 2018, 9:12 PM
Cchunn added a subscriber: Cchunn.Feb 28 2018, 10:09 PM

I overcame this issue on our Wikis buy adding a line break before the reference is inserted:

diff --git a/extensions/Cite/includes/Cite.php b/extensions/Cite/includes/Cite.php
index e44fd50881..9ae5216f23 100644
--- a/extensions/Cite/includes/Cite.php
+++ b/extensions/Cite/includes/Cite.php
@@ -1200,7 +1200,7 @@ class Cite {
                        }
                        $text .= $s . '</div>';
                } else {
-                       $text .= $s;
+                       $text .= "\n".$s;
                }
                return true;
        }

It may be a hacky fix, but it worked for this specific issue for us.

Alexia added a subscriber: Alexia.Feb 28 2018, 10:12 PM
This comment was removed by Alexia.

It looks like a sane fix for this. The previous part of the "if" clause already adds a \n at the end of $text before adding the cite contents.

Would you like to write a patch for that?. Otherwise I can happily write a patch myself for this

Alexia removed a subscriber: Alexia.Feb 28 2018, 10:40 PM
Izno added a subscriber: Izno.Jul 11 2018, 8:21 PM

Is this still a problem with RemexHtml ?

Izno added a comment.Dec 1 2018, 5:39 PM

Is this still a problem with RemexHtml ?

Yup.