Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js |
— | — | @@ -557,7 +557,9 @@ |
558 | 558 | |
559 | 559 | /** |
560 | 560 | * Callback from tokens fully processed for phase 0 and 1, which are now ready |
561 | | - * for synchronous and globally in-order phase 2 processing. |
| 561 | + * for synchronous and globally in-order phase 2 processing. Thus each async |
| 562 | + * transform is responsible for fully processing its returned tokens to the |
| 563 | + * end of phase2. |
562 | 564 | * |
563 | 565 | * @method |
564 | 566 | * @param {Array} chunk of tokens |
Index: trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js |
— | — | @@ -15,8 +15,6 @@ |
16 | 16 | this.manager = manager; |
17 | 17 | } |
18 | 18 | |
19 | | -ParserFunctions.prototype.fun = {}; |
20 | | - |
21 | 19 | ParserFunctions.prototype['pf_#if'] = function ( target, argList, argDict ) { |
22 | 20 | if ( target.trim() !== '' ) { |
23 | 21 | this.manager.env.dp('#if, first branch', target.trim(), argDict[1] ); |
— | — | @@ -127,8 +125,11 @@ |
128 | 126 | |
129 | 127 | // A first approximation of time stuff. |
130 | 128 | // TODO: Implement time spec (+ 1 day etc), check if formats are complete etc. |
131 | | -// Based on http://jacwright.com/projects/javascript/date_format/, MIT |
132 | | -// licensed. |
| 129 | +// See http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time |
| 130 | +// for the full list of requirements! |
| 131 | +// |
| 132 | +// First (very rough) approximation below based on |
| 133 | +// http://jacwright.com/projects/javascript/date_format/, MIT licensed. |
133 | 134 | ParserFunctions.prototype['pf_#time'] = function ( target, argList, argDict ) { |
134 | 135 | var res, |
135 | 136 | tpl = target.trim(); |
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.js |
— | — | @@ -142,13 +142,15 @@ |
143 | 143 | sync01: |
144 | 144 | [ |
145 | 145 | IncludeOnly, |
146 | | - NoInclude |
| 146 | + NoInclude |
147 | 147 | ], |
148 | 148 | // Asynchronous out-of-order per input |
149 | 149 | async12: |
150 | 150 | [ |
| 151 | + // Insert TokenCollector for extensions here (don't expand |
| 152 | + // templates in extension contents) |
151 | 153 | TemplateHandler, |
152 | | - AttributeExpander |
| 154 | + AttributeExpander // After templates to avoid expanding unused branches |
153 | 155 | ], |
154 | 156 | // Synchronous in-order on fully expanded token stream (including |
155 | 157 | // expanded templates etc). |