Page MenuHomePhabricator

<references/> in ordered list or unordered list closes surrounding element
Open, LowPublicBUG REPORT

Description

The following wikitext:

Text 1<ref>Ref 1</ref> Text 2<ref>Ref 2</ref> Text 3<ref>Ref 3</ref>
 
* Item 1 <references />
* Item 2

is converted to:

<p>Text 1<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> Text 2<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[2]</a></sup> Text 3<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[3]</a></sup></p>
<ul>
<li>Item 1
<ol class="references">
<li id="cite_note-0"><a href="#cite_ref-0"></a> Ref 1</li>
</ol>
</li>
</ul>
<ul>
<li id="cite_note-1"><a href="#cite_ref-1"></a> Ref 2</li>
<li id="cite_note-2"><a href="#cite_ref-2"></a> Ref 3</li>
<li style="list-style-type: none; list-style-image: none; list-style-position: outside; display: inline;">
<ul>
<li>Item 2</li>
</ul>
</li>
</ul>

expected result:

<p>Text 1<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> Text 2<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[2]</a></sup> Text 3<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[3]</a></sup></p>
<ul>
<li>Item 1
<ol class="references">
<li id="cite_note-0"><a href="#cite_ref-0"></a> Ref 1</li>
<li id="cite_note-1"><a href="#cite_ref-1"></a> Ref 2</li>
<li id="cite_note-2"><a href="#cite_ref-2"></a> Ref 3</li>
</ol>
</li>
<li>Item 2</li>
</ul>

Version: unspecified
Severity: trivial

Details

Reference
bz25939

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:21 PM
bzimport added a project: Cite.
bzimport set Reference to bz25939.
bzimport added a subscriber: Unknown Object (MLST).

(In reply to comment #0)

The actual result in #0 was extracted from an extra div. The actual result without an extra div is:

<p>Text 1<sup class="reference" id="cite_ref-0"><a href="#cite_note-0">[1]</a></sup> Text 2<sup class="reference" id="cite_ref-1"><a href="#cite_note-1">[2]</a></sup> Text 3<sup class="reference" id="cite_ref-2"><a href="#cite_note-2">[3]</a></sup></p>
<ul>
<li>Item 1
<ol class="references">
<li id="cite_note-0"><a href="#cite_ref-0">↑</a> Ref 1</li>
</ol>
</li>
</ul>
<ul>
<li id="cite_note-1"><a href="#cite_ref-1">↑</a> Ref 2</li>
<li id="cite_note-2"><a href="#cite_ref-2">↑</a> Ref 3</li>
</ul>
<ul>
<li>Item 2</li>
</ul>

I'm going to guess this is a problem with Tidy.

With 1.24wmf21 I now see:

<p>Text 1<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span>[</span>1<span>]</span></a></sup> Text 2<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span>[</span>2<span>]</span></a></sup> Text 3<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span>[</span>3<span>]</span></a></sup></p>
<ul>
<li>Item 1
<ol class="references"></ol>
</li>
</ul>
<ul>
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text">Ref 1</span></li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text">Ref 2</span></li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">Ref 3</span></li>
</ul>
<ul>
<li>Item 2</li>
</ul>

It appears this is now resolved.

No. The outer <ul> still gets closed.

I see the issue. Item 1 and Item 2 list is rendered as separate unordered lists and the The reference list is rendered as an unordered list, not an ordered list.

I don't see the purpose here.

Fomafix renamed this task from <references/> in ordered list or unordered list to <references/> in ordered list or unordered list closes surrounding element.Oct 29 2015, 3:55 PM
Fomafix updated the task description. (Show Details)
Fomafix set Security to None.
Izno subscribed.

Remex outputs some giggle-worthy soup, which isn't even valid HTML:

<ul>
  <li>Item 1 
    <div class="mw-references-wrap">
      <ol class="references"></ol>
    </div>
  </li>
</ul>
<li id="cite_note-1">
  <span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> 
  <span class="reference-text">Ref 1</span>
</li>
<li id="cite_note-2">
  <span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> 
  <span class="reference-text">Ref 2</span>
</li>
<li id="cite_note-3">
  <span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> 
  <span class="reference-text">Ref 3</span>
</li>

<ul><li>Item 2</li></ul>

On an aside, I think this is a special case of T11996: Multiline tags in lists should be output more intelligently because it's associated with a tag in a specific extension.

If T11996 ever gets fixed, then this can be closed. I wouldn't close duplicate because this task tracks the Cite issue.

Aklapper changed the subtype of this task from "Task" to "Bug Report".Feb 5 2022, 2:33 PM