C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/352177 )

Change subject: Refactor the pipetrick handler to avoid using `text()`.
......................................................................

Refactor the pipetrick handler to avoid using `text()`.

Change-Id: I720cc0d75c483068090773f7d5a8a183ea6148ce
---
M lib/wt2html/pegTokenizer.pegjs
1 file changed, 15 insertions(+), 2 deletions(-)


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

diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 9cdf977..7fd6601 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -993,12 +993,25 @@
           lcontent = { content: [] };
       }
 
+      var textTokens = [];
       if (target === null || lcontent.pipetrick) {
-        return [text()];
+        textTokens.push("[[");
+        if (target) {
+          textTokens.push(target);
+        }
+        if (lcontent.pipetrick) {
+          textTokens.push("|");
+        }
+        lcontent.content.forEach(function(a) {
+          // a is a mw:maybeContent attribute
+          textTokens.push("|");
+          textTokens.push(a.v);
+        });
+        textTokens.push("]]");
+        return textTokens;
       }
 
       var obj = new SelfclosingTagTk('wikilink');
-      var textTokens = [];
       var hrefKV = new KV('href', target);
       hrefKV.vsrc = input.substring(startOffset() + 2, tpos);
       // XXX: Point to object with path, revision and input information

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I720cc0d75c483068090773f7d5a8a183ea6148ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

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

Reply via email to