GWicke has submitted this change and it was merged.
Change subject: Bug fix meta-wrapping tpl-generated attribute keys.
......................................................................
Bug fix meta-wrapping tpl-generated attribute keys.
* Wikitext of the form: "<div st{{echo|yle}}='color:red'>foo</div>"
where an attribute key expands to an array of tokens with one
part of it coming from a template/extension wasn't being handled
correctly. In this example, the property of the meta-tag was
"mw:objectAttrKey#st,yle" instead of "mw:objectAttryKey#style"
In RT testing, this kind of wikitext crashed some pages. In reality,
this kind of wikitext is rare and is usually a result of misparses
when the source wikitext is buggy.
For example, the wikitext below is found on en:Croatian Parliament
The tokenizer thinks this is a tr with a lot of diff attributes and
and runs into trouble. The fix in this patch prevents the page from
crashing.
"|-| colspan=5| Source: Parliament of Croatia<ref
name="Previous-Speakers"/><ref name="Speaker-Current"/>"
* Fixes crashers on a few different pages (which probably all have
buggy wikitext in table tr tags).
- en:Croatian Parliament
- en:Crime Scene Unit
* No change in parser tests (TODO: Add the example wikitext at the
top as a new test).
Change-Id: Idac4d6d9b3274521e4340ddbce176007ecd9e024
---
M js/lib/ext.core.AttributeExpander.js
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
GWicke: Verified; Looks good to me, approved
diff --git a/js/lib/ext.core.AttributeExpander.js
b/js/lib/ext.core.AttributeExpander.js
index 558f879..a34e295 100644
--- a/js/lib/ext.core.AttributeExpander.js
+++ b/js/lib/ext.core.AttributeExpander.js
@@ -89,7 +89,7 @@
};
}
-function makeTplAffectedMeta ( contentType, key, val ) {
+function makeTplAffectedMeta( contentType, key, val ) {
// SSS FIXME: Assumes that all expanded attrs. have the same expandable
type
// - attr1 can be expanded by a template
// - attr2 can be expanded by an extension
@@ -233,7 +233,9 @@
metaObjType = updatedK.metaObjType;
if (metaObjType) {
producerObjType = metaObjType;
- metaTokens.push(
makeTplAffectedMeta(contentType, newK, updatedK) );
+ // newK can be an array
+ var key = newK.constructor ===
String ? newK : Util.tokensToString(newK);
+ metaTokens.push(
makeTplAffectedMeta(contentType, key, updatedK) );
}
}
} else if (newK !== a.k) {
--
To view, visit https://gerrit.wikimedia.org/r/56521
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idac4d6d9b3274521e4340ddbce176007ecd9e024
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits