Specs/HTML/1.3.0/Extensions/Cite

<ref group='x' name='y'>{{Cite|foo|bar=baz}}</ref>

<span id="cite_ref-0-0" class="reference" about="#mwt1" typeof="mw:Extension/Ref"
  data-mw='{"name":"ref",
            "attrs": {
               "group": "x",
               "name": "y"
            },
            "body":{
               "html":"&lt;span typeof=\"mw:Transclusion\" about=\"#mw-t2\" id=\"mw-t2\"
                           data-mw=&apos;{ \"parts\": [
                               \"target\": {\"wt\":\"Cite\"},
                               \"params\": {\"1\":{\"wt\":\"foo\"},\"bar\":{\"wt\":\"baz\"}}
                           ] }&apos; &gt;
                       The citation content
                       &lt;/span&gt;"
                }
           }'>
  <a data-type="hashlink" href="#cite_note-0">[1]</a>
</span>
Above example is not what parsoid generates currently, see note about data-mw.body.html below

Ref and References

edit
First one <ref>One</ref>
Second one <ref>Two <p>p1</p> <p>p2</p> </ref>
Named one <ref name='three'>Three</ref>
Reused <ref name='three' />
Reused again <ref name='three' />

<references />

The HTML output for this wikitext is shown below. Content with block content is wrapped in a div and content with inline content is wrapped in a span.

As of Feb 2015, Parsoid provides the element id of the HTML via the data-mw.body.id property rather than copying the HTML dom in the data-mw.body.html property as it used to earlier. But, both formats are considered valid and Parsoid accepts both formats when serializing HTML to wikitext.

If data-mw.body.id is specified, it is the client's responsibility to make sure that the element id is present in the DOM. If both data-mw.body.html and data-mw.body.id are specified, Parsoid uses the html property and ignores the id property.

<p>
First one
<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/Ref" 
    data-mw='{"name": "ref", "attrs": {}, "body":{"id":"mw-reference-text-cite_note-1"}}'>
  <a href="#cite_note-1">[1]</a>
</span>
Second one
<span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/Ref" 
    data-mw='{"name": "ref", "attrs": {}, "body":{"id":"mw-reference-text-cite_note-2"}}'>
  <a href="#cite_note-2">[2]</a>
</span>
Named one
<span about="#mwt6" class="reference" id="cite_ref-three_3-0" rel="dc:references" typeof="mw:Extension/Ref"
    data-mw='{"name": "ref", "attrs": {"name": "three"}, "body":{"id":"mw-reference-text-cite_three-3"}}'>
  <a href="#cite_note-three-3">[3]</a>
</span>
Reused
<span about="#mwt8" class="reference" id="cite_ref-three_3-1" rel="dc:references" typeof="mw:Extension/ref" 
    data-mw='{"name":"ref", "attrs":{"name":"three"}}'>
  <a href="#cite_note-three-3">[3]</a>
</span>
Reused again
<span about="#mwt10" class="reference" id="cite_ref-three_3-2" rel="dc:references" typeof="mw:Extension/ref" 
    data-mw='{"name":"ref","attrs":{"name":"three"}}'>
  <a href="#cite_note-three-3">[3]</a>
</span>
</p>

<ol about="#mwt11" typeof="mw:Extension/References" data-mw='{"name":"references","attrs":{}}'>
  <li about="#cite_note-1" id="cite_note-1">
    <span rel="mw:referencedBy"><a href="#cite_ref-1"></a>
    </span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">
    One</span>
  </li>
  <li about="#cite_note-2" id="cite_note-2">
    <span rel="mw:referencedBy"><a href="#cite_ref-2"></a>
    </span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text" data-parsoid="{}">
    Two <p data-parsoid='{"stx":"html","dsr":[45,54,3,4]}'>p1</p> <p data-parsoid='{"stx":"html","dsr":[55,64,3,4]}'>p2</p> </span>
  </li>
  <li about="#cite_note-three-3" id="cite_note-three-3">
    <span rel="mw:referencedBy"><a href="#cite_ref-three_3-0">3.0</a> <a href="#cite_ref-three_3-1">3.1</a> <a href="#cite_ref-three_3-2">3.2</a>
    </span> <span id="mw-reference-text-cite_note-three-3" class="mw-reference-text" data-parsoid="{}">Three</span>
  </li>
</ol>

Auto-generated references blocks

edit

If the source wikitext had <ref> tags but no corresponding <references> tag to generate references, Parsoid auto-generates references blocks for every set of refs that need it. As of HTML version 1.2.1, for all such auto-generated reference block, the data-mw will have the autoGenerated property set to true.

TODO

edit
  • template parameter references (implemented, but not tested much)