Marcoil has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/188046

Change subject: WIP: T88019: Ensure templates inside <ref>s are wrapped
......................................................................

WIP: T88019: Ensure templates inside <ref>s are wrapped

TODO: Templates inside <ref>s that are themselves generated from
a template expansion get incorrect TSRs, thus messing with
parameter extraction.

Change-Id: I82f0223607dbe108dd39881854671cfb35edfacb
---
M lib/ext.Cite.js
M tests/parserTests.txt
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/46/188046/1

diff --git a/lib/ext.Cite.js b/lib/ext.Cite.js
index 7d1c704..77a6156 100644
--- a/lib/ext.Cite.js
+++ b/lib/ext.Cite.js
@@ -129,7 +129,10 @@
                pipelineType: 'text/x-mediawiki/full',
                pipelineOpts: {
                        extTag: "ref",
-                       inTemplate: pipelineOpts.inTemplate,
+                       // Even if the <ref> is inside a template, we need to 
process its
+                       // contents as if they weren't, so they get correctly 
wrapped.
+                       // (see task T88019)
+                       inTemplate: false,
                        noPre: true,
                        noPWrapping: true
                },
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 18aeabb..09d09ff 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -20025,6 +20025,18 @@
 !! end
 
 !! test
+References: 8. T88019: Wrap templates inside <ref> that's itself inside a 
template
+!! options
+parsoid
+!! wikitext
+X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
+<references />
+!! html
+<p>X<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" 
typeof="mw:Transclusion  mw:Extension/ref" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo
 {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a 
href="#cite_note-1">[1]</a></span></p>
+<ol class="references" typeof="mw:Extension/references" about="#mwt4" 
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> 
foo <b about="#mwt7" typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;b>bar&lt;/b>"}},"i":0}}]}'>bar</b>
 and <span about="#mwt8" typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz"}},"i":0}}]}'>baz</span>
 boo</li></ol>
+!!end
+
+!! test
 Entities in ref name
 !! options
 parsoid

-- 
To view, visit https://gerrit.wikimedia.org/r/188046
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82f0223607dbe108dd39881854671cfb35edfacb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Marcoil <marc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to