mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-01 01:56:20 +00:00
(Bug 49555) Support nested refs
* After trying various hacks, came up with a relatively simple fix/hack to support nested refs. The fix looks for {{#tag:ref..}} and short-circuits full pipeline expansion and converts that to an extension tag in place. * Tested with the following wikitext which parses and RTs correctly A <ref name='foo' /> B {{#tag:ref|nested ref <ref>bar</ref> |name=foo}} <references /> * Also tested on en:Fomitiporia_ellipsoidea from the bug report and verified correct parse and round tripping. * Verified that the nested ref in <ref> foo <ref>bar</ref> </ref> continues to be parsed as plain text. * No change in parser test results -- have to make another round of updates to parser tests. Change-Id: I43bb8b710bd10a9ddbea27818ff8aaf97ddb3fdc
This commit is contained in:
parent
7d93200a91
commit
53bbcbb37e
|
@ -92,7 +92,7 @@ Ref.prototype.reset = function() { };
|
||||||
*/
|
*/
|
||||||
Ref.prototype.handleRef = function ( manager, pipelineOpts, refTok, cb ) {
|
Ref.prototype.handleRef = function ( manager, pipelineOpts, refTok, cb ) {
|
||||||
// Nested <ref> tags are not supported
|
// Nested <ref> tags are not supported
|
||||||
if (pipelineOpts.extTag === "ref") {
|
if (!pipelineOpts.inTagRef && pipelineOpts.extTag === "ref" && pipelineOpts.wrapTemplates) {
|
||||||
cb({ tokens: [refTok.getAttribute("source")] });
|
cb({ tokens: [refTok.getAttribute("source")] });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,7 @@ Ref.prototype.handleRef = function ( manager, pipelineOpts, refTok, cb ) {
|
||||||
// Full pipeline for processing ref-content
|
// Full pipeline for processing ref-content
|
||||||
pipelineType: 'text/x-mediawiki/full',
|
pipelineType: 'text/x-mediawiki/full',
|
||||||
pipelineOpts: {
|
pipelineOpts: {
|
||||||
|
inTagRef: refTok.getAttribute("inTagRef"),
|
||||||
extTag: "ref"
|
extTag: "ref"
|
||||||
},
|
},
|
||||||
res: [],
|
res: [],
|
||||||
|
|
Loading…
Reference in a new issue