mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-28 00:40:12 +00:00
Remove extsrc bloat from references data-mw
* This hasn't been used since 2013! See 46ddbf3f
Change-Id: Iea382829f38788541b3bc4f8595a0d6bf600c167
This commit is contained in:
parent
ae45ffe95e
commit
3b44e7e544
|
@ -484,32 +484,24 @@ References.prototype.extractRefFromNode = function(node, refsData,
|
|||
References.prototype.insertReferencesIntoDOM = function(refsNode, refsData, refsInReferencesHTML) {
|
||||
var dp = DU.getDataParsoid(refsNode);
|
||||
var group = dp.group || '';
|
||||
var src = dp.src || '<references/>'; // fall back so we don't crash
|
||||
// Extract ext-source for <references>..</references> usage
|
||||
var body = Util.extractExtBody("references", src).trim();
|
||||
var refGroup = refsData.getRefGroup(group);
|
||||
|
||||
var dataMw = DU.getDataMw(refsNode);
|
||||
if (!Object.keys(dataMw).length) {
|
||||
var datamwBody;
|
||||
// We'll have to output data-mw.body.extsrc in
|
||||
// scenarios where original wikitext was of the form:
|
||||
// "<references> lot of refs here </references>"
|
||||
// Ex: See [[en:Barack Obama]]
|
||||
if (body.length > 0) {
|
||||
datamwBody = {
|
||||
'extsrc': body,
|
||||
'html': refsInReferencesHTML.join(''),
|
||||
};
|
||||
}
|
||||
dataMw = {
|
||||
'name': 'references',
|
||||
'body': datamwBody,
|
||||
'attrs': {
|
||||
// Dont emit empty keys
|
||||
'group': group || undefined,
|
||||
},
|
||||
};
|
||||
|
||||
var src = dp.src || '<references/>'; // fall back so we don't crash
|
||||
// Extract ext-source for <references>..</references> usage
|
||||
var body = Util.extractExtBody('references', src).trim();
|
||||
if (body.length > 0) {
|
||||
dataMw.body = { 'html': refsInReferencesHTML.join('') };
|
||||
}
|
||||
|
||||
DU.setDataMw(refsNode, dataMw);
|
||||
}
|
||||
|
||||
|
@ -522,6 +514,7 @@ References.prototype.insertReferencesIntoDOM = function(refsNode, refsData, refs
|
|||
refsNode.removeChild(refsNode.firstChild);
|
||||
}
|
||||
|
||||
var refGroup = refsData.getRefGroup(group);
|
||||
if (refGroup) {
|
||||
refGroup.refs.forEach(refGroup.renderLine.bind(refGroup, refsNode));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue