Arlolra has uploaded a new change for review.

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

Change subject: Use Util.processContentInPipeline in Frame.expand
......................................................................

Use Util.processContentInPipeline in Frame.expand

Change-Id: Ied613bf5a130d09f68a0b0c153745160c2c89bc3
---
M lib/wt2html/TokenTransformManager.js
1 file changed, 23 insertions(+), 19 deletions(-)


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

diff --git a/lib/wt2html/TokenTransformManager.js 
b/lib/wt2html/TokenTransformManager.js
index 86e8842..73239a9 100644
--- a/lib/wt2html/TokenTransformManager.js
+++ b/lib/wt2html/TokenTransformManager.js
@@ -1440,32 +1440,36 @@
                // - not in a template use context   Ex: {{ .. | {{ here }} | 
.. }}
                // - the attribute use is wrappable  Ex: [[ ... | {{ .. link 
text }} ]]
 
-               var pipelineOpts = {
-                       isInclude: this.depth > 0,
-                       wrapTemplates: options.wrapTemplates,
-                       inTemplate: options.inTemplate,
+               var opts = {
+                       // XXX: use input type
+                       pipelineType: this.manager.attributeType || 
'tokens/x-mediawiki',
+                       pipelineOpts: {
+                               isInclude: this.depth > 0,
+                               wrapTemplates: options.wrapTemplates,
+                               inTemplate: options.inTemplate,
+                       },
                };
 
-               var pipeline = this.manager.pipeFactory.getPipeline(
-                       // XXX: use input type
-                       this.manager.attributeType || 'tokens/x-mediawiki',
-                       pipelineOpts
-               );
-               pipeline.setFrame(this, null);
                // In the name of interface simplicity, we accumulate all 
emitted
                // chunks in a single accumulator.
                var eventState = { options: options, accum: [], cb: cb };
-               pipeline.addListener('chunk',
-                               this.onThunkEvent.bind(this, eventState, true));
-               pipeline.addListener('end',
-                               this.onThunkEvent.bind(this, eventState, 
false));
+               opts.chunkCB = this.onThunkEvent.bind(this, eventState, true);
+               opts.endCB = this.onThunkEvent.bind(this, eventState, false);
+
+               opts.tplArgs = {
+                       name: null,
+                       cacheKey: this.title,
+               };
+
+               var content;
                if (lastItem(chunk).constructor === EOFTk) {
-                       pipeline.process(chunk, this.title);
+                       content = chunk;
                } else {
-                       var newChunk = JSUtils.pushArray(chunk, 
this._eofTkList);
-                       newChunk.rank = chunk.rank;
-                       pipeline.process(newChunk, this.title);
+                       content = JSUtils.pushArray(chunk, this._eofTkList);
+                       content.rank = chunk.rank;
                }
+
+               Util.processContentInPipeline(this.manager.env, this, content, 
opts);
        } else {
                throw "Frame.expand: Unsupported output type " + outType;
        }
@@ -1485,7 +1489,7 @@
                this.manager.env.dp('Frame.onThunkEvent accum:', state.accum);
        } else {
                this.manager.env.dp('Frame.onThunkEvent:', state.accum);
-               state.cb (state.accum);
+               state.cb(state.accum);
        }
 };
 

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

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