Marcoil has uploaded a new change for review.
https://gerrit.wikimedia.org/r/189974
Change subject: WIP: T88660: Emit reflists for <ref> with no explicit
<references>
......................................................................
WIP: T88660: Emit reflists for <ref> with no explicit <references>
This patch emits a reflist for all ref groups that still have
<ref>s in them at the end of the document. Currently Cite.php only
does so for the default group. See also T88290.
On html2wt the missing <references> are added to the wikitext,
this may be a bug or a feature :)
Change-Id: I79af2c34481cadbf0d68d9571928979adf559b58
---
M lib/dom.processRefs.js
M lib/ext.Cite.js
2 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/74/189974/1
diff --git a/lib/dom.processRefs.js b/lib/dom.processRefs.js
index 6865d9b..077ed92 100644
--- a/lib/dom.processRefs.js
+++ b/lib/dom.processRefs.js
@@ -53,6 +53,7 @@
function processRefs(refsExt, node, env, options, atTopLevel) {
if (atTopLevel) {
_processRefs(refsExt, node);
+ refsExt.insertMissingReferencesIntoDOM(env, node);
}
}
diff --git a/lib/ext.Cite.js b/lib/ext.Cite.js
index 7d1c704..8a520f4 100644
--- a/lib/ext.Cite.js
+++ b/lib/ext.Cite.js
@@ -482,6 +482,33 @@
this.reset(group);
};
+References.prototype.insertMissingReferencesIntoDOM = function (env, node) {
+ var doc = node.ownerDocument,
+ referencesId = env.newAboutId(),
+ self = this;
+
+ this.refGroups.forEach(function (refsData, refsGroup) {
+ var ol = doc.createElement('ol'),
+ dp = DU.getDataParsoid(ol);
+ DU.addAttributes(ol, {
+ typeof: 'mw:Extension/references',
+ about: referencesId
+ });
+ // dp.src = '';
+ // dp.tmp = {
+ // isForeignContent: true
+ // };
+ if (refsGroup) {
+ dp.group = refsGroup;
+ }
+ DU.storeDataParsoid(ol, dp);
+ node.appendChild(ol);
+ // HACK: Get a \n in here
+ node.appendChild(doc.createTextNode("\n"));
+ self.insertReferencesIntoDOM(ol, ["\n"]);
+ });
+};
+
/**
* Native Parsoid implementation of the Cite extension
* that ties together <ref> and <references>
--
To view, visit https://gerrit.wikimedia.org/r/189974
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79af2c34481cadbf0d68d9571928979adf559b58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Marcoil <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits