Marcoil has uploaded a new change for review.

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

Change subject: Don't expand attributes if they contain subst'ed templates
......................................................................

Don't expand attributes if they contain subst'ed templates

This fixes a problem introduced in
75f4841019182fbf21f815f0040cb91ef3fef1fe that made Parsoid exceed
the maximum call stack for some wikitext like
dewiki:{{{{Begrüßungsbox}}.

There's possibly a much better fix but pushing this to avoid the
problem in production.

Change-Id: I98edcbf85de8ddf3fc882870be5f436064f895f6
---
M lib/ext.core.AttributeExpander.js
1 file changed, 8 insertions(+), 1 deletion(-)


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

diff --git a/lib/ext.core.AttributeExpander.js 
b/lib/ext.core.AttributeExpander.js
index ccf6ecb..bd8475d 100644
--- a/lib/ext.core.AttributeExpander.js
+++ b/lib/ext.core.AttributeExpander.js
@@ -307,7 +307,14 @@
                                        if (expandedA.v === '') {
                                                var kArray = 
Util.tokensToString(expandedK, true),
                                                        kStr = 
(kArray.constructor === String) ? kArray : kArray[0],
-                                                       kvs  = /=/.test(kStr) ? 
this.tokenizer.tokenize(kStr, 'generic_attributes') : null;
+                                                       kvs;
+                                               // Marc FIXME: Having subst'ed 
templates in here throws
+                                               // generic_attributes into a 
never-ending loop.
+                                               if (kStr.match(/subst:/) === 
null &&
+                                                   
/(?!\{\{subst:).*=/.test(kStr))
+                                               {
+                                                       kvs  = 
this.tokenizer.tokenize(kStr, 'generic_attributes');
+                                               }
 
                                                if (kvs) {
                                                        // SSS FIXME: Collect 
all keys here, not just the first key

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98edcbf85de8ddf3fc882870be5f436064f895f6
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