Page MenuHomePhabricator

{{reflist}} no longer detected as a reference list and therefore updating as references are added
Closed, ResolvedPublic

Description

We have code that detects that a template contains just a reference list and treats it as one, updating the list when references are added/removed (T52769).

This appears to have stopped working, possibly due to TemplateStyles.

Testing instructions

Event Timeline

Without TemplateStyles

<div class="reflist " style=" list-style-type: decimal;" about="#mwt14" typeof="mw:Transclusion" data-parsoid='{"stx":"html","dsr":[144,169,null,null],"pi":[[{"k":"group","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"reflist-old","href":"./Template:Reflist-old"},"params":{"group":{"wt":"old"}},"i":0}}]}'>
   <div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt17" data-parsoid='{"group":"old","src":"&lt;references group=\"old\">&lt;/references>"}' data-mw='{"name":"references","attrs":{"group":"old"},"body":{"html":""}}'>
      <ol class="mw-references references" data-mw-group="old" data-parsoid="{}">
         <li about="#cite_note-3" id="cite_note-3" data-parsoid="{}"><a href="./Reflist#cite_ref-3" data-mw-group="old" rel="mw:referencedBy" data-parsoid="{}"><span class="mw-linkback-text" data-parsoid="{}"></span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text" data-parsoid="{}">789</span></li>
      </ol>
   </div>
</div>

With TemplateStyles

<style data-mw-deduplicate="TemplateStyles:r7848" typeof="mw:Extension/templatestyles mw:Transclusion" about="#mwt7" data-parsoid='{"pi":[[{"k":"group","named":true}]],"dsr":[91,114,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"reflist","href":"./Template:Reflist"},"params":{"group":{"wt":"notes"}},"i":0}}]}'>.mw-parser-output.reflist { font-size: 90%; margin-bottom: 0.5em; list-style-type: decimal; } .mw-parser-output.reflist .references { font-size: 100%; margin-bottom: 0; list-style-type: inherit; } .mw-parser-output.reflist-columns-2 { column-width: 30em; } .mw-parser-output.reflist-columns-3 { column-width: 25em; } .mw-parser-output.reflist-columns { margin-top: 0.3em; } .mw-parser-output.reflist-columns ol { margin-top: 0; } .mw-parser-output.reflist-columns li { page-break-inside: avoid; break-inside: avoid-column; } .mw-parser-output.reflist-upper-alpha { list-style-type: upper-alpha; } .mw-parser-output.reflist-upper-roman { list-style-type: upper-roman; } .mw-parser-output.reflist-lower-alpha { list-style-type: lower-alpha; } .mw-parser-output.reflist-lower-greek { list-style-type: lower-greek; } .mw-parser-output.reflist-lower-roman { list-style-type: lower-roman; }</style>
<div class="reflist   " about="#mwt7" data-parsoid='{"stx":"html"}'>
   <div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt13" data-parsoid='{"group":"notes","src":"&lt;references group=\"notes\" responsive=\"1\">&lt;/references>"}' data-mw='{"name":"references","attrs":{"group":"notes","responsive":"1"},"body":{"html":""}}'>
      <ol class="mw-references references" data-mw-group="notes" data-parsoid="{}">
         <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><a href="./Reflist#cite_ref-1" data-mw-group="notes" rel="mw:referencedBy" data-parsoid="{}"><span class="mw-linkback-text" data-parsoid="{}"></span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">123</span></li>
      </ol>
   </div>
</div>

Change 804681 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/Cite@master] MWReferencesListNode: Support {{reflist}} template with TemplateStyles

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

Change 804681 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] MWReferencesListNode: Support {{reflist}} template with TemplateStyles

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

Copying notes from code review:

  • when a reflist is using TemplateStyles, those styles will be lost when it is re-rendered. This is not the case with simple templated reflists, as their attributes are copied to the re-rendered node. It can be a significant change if the template e.g. changes the number of columns or font size.

We thought this limitation is acceptable.

EAkinloose subscribed.

✅ Click on the reference list, the context should say "References list", not "Template"
Before fix:

Screenshot 2022-07-04 at 12.24.06.png (1,968×756 px, 394 KB)

After Fix:
Screenshot 2022-07-04 at 12.32.08.png (2,026×820 px, 166 KB)

✅ Deleting/adding references to the page should update the reference list instantly
Adding: https://photos.app.goo.gl/TfRqTiABdy3JpBhW6
Deleting: https://photos.app.goo.gl/LfTdgXVShCB6bmQC6

ppelberg claimed this task.