Arlolra has uploaded a new change for review.

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

Change subject: Serialize positional params with = in extlink as named
......................................................................

Serialize positional params with = in extlink as named

 * We already do this for the parts of the parameter that tokenize
   as strings.

Bug: T85958
Change-Id: I7b4da82ee6799a846a824bb11ed789e4791df991
---
M lib/wts.escapeWikitext.js
M tests/parserTests.txt
2 files changed, 14 insertions(+), 0 deletions(-)


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

diff --git a/lib/wts.escapeWikitext.js b/lib/wts.escapeWikitext.js
index 1c3539e..b5ec2e6 100644
--- a/lib/wts.escapeWikitext.js
+++ b/lib/wts.escapeWikitext.js
@@ -869,6 +869,10 @@
                                                if (typeof bit === "object") {
                                                        buf += 
bit.dataAttribs.src;
                                                } else {
+                                                       // Convert to a named 
param
+                                                       if ( opts.isTemplate && 
!serializeAsNamed && /[=]/.test(bit) ) {
+                                                               
serializeAsNamed = true;
+                                                       }
                                                        buf += 
bit.replace(/\|/g, '|');
                                                }
                                        });
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 3ab130c..a476877 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -22525,6 +22525,16 @@
 !! end
 
 !! test
+Parsoid: Serialize positional parameters with = in extlink as named parameter
+!! options
+parsoid=html2wt
+!! html
+<a rel="mw:ExtLink" href="http://stuff?is=ok"; about="#mwt1" 
typeof="mw:Transclusion" 
data-mw='{"parts":[{"template":{"target":{"wt":"Anti","href":"./Template:Anti"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
+!! wikitext
+{{Anti|1 = http://stuff?is=ok}}
+!! end
+
+!! test
 Parsoid: Correctly serialize block-node children when they are a combination 
of text and p-nodes
 !! options
 parsoid=html2wt

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b4da82ee6799a846a824bb11ed789e4791df991
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to