Subramanya Sastry has uploaded a new change for review.

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

Change subject: T101599: Don't hoist categories out of headings if they come 
from tpls
......................................................................

T101599: Don't hoist categories out of headings if they come from tpls

* Added a parser test to catch regression.

* This confirms that the fix.
[subbu@earth lib] echo '=={{S|nom|fr}}==' | node parse --prefix frwiktionary 
--wt2wt
=={{S|nom|fr}}==

Change-Id: Ic43f9b21f888ec35591f177224f2229b709dc2e9
---
M lib/wts.normalizeDOM.js
M tests/parserTests.txt
2 files changed, 13 insertions(+), 1 deletion(-)


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

diff --git a/lib/wts.normalizeDOM.js b/lib/wts.normalizeDOM.js
index fc1dd76..8dc3bd8 100644
--- a/lib/wts.normalizeDOM.js
+++ b/lib/wts.normalizeDOM.js
@@ -76,7 +76,9 @@
                if (!DU.isContentNode(sibling)) {
                        sibling = next;
                        continue;
-               } else if (!DU.isSolTransparentLink(sibling) && 
!DU.isBehaviorSwitch(env, node)) {
+               } else if ((!DU.isSolTransparentLink(sibling) && 
!DU.isBehaviorSwitch(env, sibling))
+                       || DU.isEncapsulationWrapper(sibling)) {
+                       // Don't venture into templated content
                        break;
                } else {
                        hasHoistableContent = true;
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 1011ba8..2d07b35 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -23631,6 +23631,16 @@
 !! end
 
 !! test
+Headings: Don't hoist metas that come from templates
+!! options
+parsoid=html2wt
+!! html
+<h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" 
data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo
 [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" 
href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
+!! wikitext
+== {{echo|foo [[Category:Foo]]}} ==
+!! end
+
+!! test
 Headings: Category in ref isn't hoisted
 !! options
 parsoid=html2wt

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic43f9b21f888ec35591f177224f2229b709dc2e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

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

Reply via email to