Page MenuHomePhabricator

[Spike] Decide how to guarantee Cite footnote body numbering
Open, Needs TriagePublic

Description

The bookreferencing feature has highlighted an already fragile detail of the Cite extension, namely that the footnote marks in article text are algorithmically numbered, but are given browser "ordered list" numbering in the references section. This was reasonable with sequential numbering, but now that we've introduced subnumbering it has been the source of two cross-browser compatibility bugs, and one suspected bug. The failure mode is that footnotes have a different number in the article than they do in the references section.

  • Determine whether it's possible to write browser tests to check <ol> numbering, and whether these will run under the cross-browser CI infrastructure (browser support for accessing the numbers may vary).
  • Look at the consequences of algorithmically numbering the references section. This may disrupt built-in and custom styles.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

"Good luck"? Replicating browser behaviour on DOM-order numbering will be challenging. We were previously planning to go the other way once we switch to Parsoid HTML for renders, and have items numbered entirely by the browser with nothing in the DOM at all, but your changes make that plan probably impossible now.

"Good luck"? Replicating browser behaviour on DOM-order numbering will be challenging. We were previously planning to go the other way once we switch to Parsoid HTML for renders, and have items numbered entirely by the browser with nothing in the DOM at all, but your changes make that plan probably impossible now.

Thanks for this feedback, I hadn't considered having the footnote marks automatically numbered by the browser. I think I like the potential to localize marks into e.g. Arabic or Hebrew numerals, or style in some other way... We'll discuss this as a team and will get back to you (probably here)—I can imagine implementations which stay compatible with your schema even when the added complication of "subreferences" is introduced.

However, let me lob this question back over the fence: have you considered that footnotes often appear out-of-order in the article? Is there already a plan for accommodating that? I don't see anything in CSS, other than aggressively declaring counter-reset: <COUNTER_NAME> <NUM> inline for every footnote marker.

However, let me lob this question back over the fence: have you considered that footnotes often appear out-of-order in the article? Is there already a plan for accommodating that? I don't see anything in CSS, other than aggressively declaring counter-reset: <COUNTER_NAME> <NUM> inline for every footnote marker.

To my knowldge, Parsoid's DOM output renders correctly (for certain values of correct).

To my knowldge, Parsoid's DOM output renders correctly (for certain values of correct).

@thiemowmde This is implemented exactly how we were discussing, using explicit counter resets at each footnote mark:

echo '<ref name="a">Foo</ref><ref>Bar</ref><ref name="a" /><br><references>' \
    | node bin/parse.js \
    | tidy -i

1<!DOCTYPE html>
2<html prefix=
3"dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/">
4<head prefix="mwr: http://en.wikipedia.org/wiki/Special:Redirect/">
5 <meta name="generator" content=
6 "HTML Tidy for HTML5 for Linux version 5.6.0">
7 <meta charset="utf-8">
8 <meta property="mw:pageNamespace" content="0">
9 <meta property="isMainPage" content="true">
10 <meta property="mw:html:version" content="2.0.0">
11 <link rel="dc:isVersionOf" href=
12 "//en.wikipedia.org/wiki/Main%20Page">
13 <title></title>
14 <base href="//en.wikipedia.org/wiki/">
15 <link rel="stylesheet" href=
16 "//en.wikipedia.org/w/load.php?modules=mediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.skinning.content.parsoid%7Cmediawiki.skinning.interface%7Cskins.vector.styles%7Csite.styles%7Cext.cite.style%7Cext.cite.styles%7Cmediawiki.page.gallery.styles&amp;only=styles&amp;skin=vector">
17 <!--[if lt IE 9]><script src="//en.wikipedia.org/w/load.php?modules=html5shiv&amp;only=scripts&amp;skin=vector&amp;sync=1"></script><script>html5.addElements('figure-inline');</script><![endif]-->
18 <meta http-equiv="content-language" content="en">
19 <meta http-equiv="vary" content="Accept">
20</head>
21<body data-parsoid='{"dsr":[0,70,0,0]}' lang="en" class=
22"mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output"
23dir="ltr">
24 <p data-parsoid='{"dsr":[0,69,0,0]}'><sup about="#mwt6" class=
25 "mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof=
26 "mw:Extension/ref" data-parsoid='{"dsr":[0,23,14,6]}' data-mw=
27 '{"name":"ref","attrs":{"name":"a"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'>
28 <a href="./Main_Page#cite_note-a-1" style=
29 "counter-reset: mw-Ref 1;"><span class=
30 "mw-reflink-text">[1]</span></a></sup><sup about="#mwt11" class=
31 "mw-ref" id="cite_ref-2" rel="dc:references" typeof=
32 "mw:Extension/ref" data-parsoid='{"dsr":[23,37,5,6]}' data-mw=
33 '{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Main_Page#cite_note-2"
34 style="counter-reset: mw-Ref 2;"><span class=
35 "mw-reflink-text">[2]</span></a></sup><sup about="#mwt9" class=
36 "mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof=
37 "mw:Extension/ref" data-parsoid='{"dsr":[37,53,16,0]}' data-mw=
38 '{"name":"ref","attrs":{"name":"a"}}'><a href=
39 "./Main_Page#cite_note-a-1" style=
40 "counter-reset: mw-Ref 1;"><span class=
41 "mw-reflink-text">[1]</span></a></sup><br data-parsoid=
42 '{"stx":"html","noClose":true,"dsr":[53,57,4,null]}'>
43 &lt;references&gt;</p>
44 <div class="mw-references-wrap" typeof="mw:Extension/references"
45 about="#mwt12" data-parsoid='{"dsr":[70,70,0,0]}' data-mw=
46 '{"name":"references","attrs":{},"autoGenerated":true}'>
47 <ol class="mw-references references">
48 <li about="#cite_note-a-1" id="cite_note-a-1"><span rel=
49 "mw:referencedBy"><a href=
50 "./Main_Page#cite_ref-a_1-0"><span class=
51 "mw-linkback-text">1</span></a> <a href=
52 "./Main_Page#cite_ref-a_1-1"><span class=
53 "mw-linkback-text">2</span></a></span> <span id=
54 "mw-reference-text-cite_note-a-1" class="mw-reference-text"
55 data-parsoid="{}">Foo</span></li>
56 <li about="#cite_note-2" id="cite_note-2">
57 <a href="./Main_Page#cite_ref-2" rel=
58 "mw:referencedBy"><span class=
59 "mw-linkback-text"></span></a> <span id=
60 "mw-reference-text-cite_note-2" class="mw-reference-text"
61 data-parsoid="{}">Bar</span>
62 </li>
63 </ol>
64 </div>
65</body>
66</html>

I don't see this being incompatible with Cite subreferencing, we could simply include two CSS list counters at each footnote.