mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-28 00:40:12 +00:00
Add 'references' class to reflist node
* Matches the core Cite extension commit cec36fed
* This change means we can get rid of some of wiki specific styling in,
https://github.com/wikimedia/integration-visualdiff/blob/master/lib/parsoid.custom_styles.yaml
Change-Id: I763b8086d057ea0cac8ba8fd4c9f4f4279766fed
This commit is contained in:
parent
6e5b366ff6
commit
ff09c1667d
|
@ -5,6 +5,8 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var domino = require('domino');
|
||||
|
||||
var ParsoidExtApi = module.parent.require('./extapi.js').versionCheck('^0.7.1');
|
||||
var Util = ParsoidExtApi.Util;
|
||||
var DU = ParsoidExtApi.DOMUtils;
|
||||
|
@ -41,7 +43,6 @@ function hasRef(node) {
|
|||
}
|
||||
c = c.nextSibling;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -303,6 +304,8 @@ function References(cite) {
|
|||
this.cite = cite;
|
||||
}
|
||||
|
||||
var dummyDoc = domino.createDocument();
|
||||
|
||||
/**
|
||||
* Sanitize the references tag and convert it into a meta-token
|
||||
*/
|
||||
|
@ -321,9 +324,13 @@ References.prototype.tokenHandler = function(manager, pipelineOpts, refsTok, cb)
|
|||
// token so that the dom post processor can generate
|
||||
// and emit references at this point in the DOM.
|
||||
var emitReferencesFragment = function(toks, refsBody) {
|
||||
var olHTML = "<ol class='mw-references'" +
|
||||
" typeof='mw:Extension/references'" +
|
||||
" about='" + referencesId + "'" + ">" + (refsBody || "") + "</ol>";
|
||||
var dummyOl = dummyDoc.createElement('ol');
|
||||
DU.addAttributes(dummyOl, {
|
||||
'class': 'mw-references references',
|
||||
typeof: 'mw:Extension/references',
|
||||
about: referencesId,
|
||||
});
|
||||
dummyOl.innerHTML = refsBody || '';
|
||||
var olProcessor = function(ol) {
|
||||
var dp = DU.getDataParsoid(ol);
|
||||
dp.src = refsTok.getAttribute('source');
|
||||
|
@ -337,7 +344,7 @@ References.prototype.tokenHandler = function(manager, pipelineOpts, refsTok, cb)
|
|||
tokens: DU.buildDOMFragmentTokens(
|
||||
manager.env,
|
||||
refsTok,
|
||||
olHTML,
|
||||
dummyOl.outerHTML,
|
||||
olProcessor,
|
||||
// The <ol> HTML above is wrapper HTML added on and doesn't
|
||||
// have any DSR on it. We want DSR added to it.
|
||||
|
@ -530,7 +537,7 @@ References.prototype.insertMissingReferencesIntoDOM = function(refsData, node) {
|
|||
var ol = doc.createElement('ol');
|
||||
var dp = DU.getDataParsoid(ol);
|
||||
DU.addAttributes(ol, {
|
||||
'class': 'mw-references',
|
||||
'class': 'mw-references references',
|
||||
typeof: 'mw:Extension/references',
|
||||
about: env.newAboutId(),
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue