r111485 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111484‎ | r111485 | r111486 >
Date:20:56, 14 February 2012
Author:gwicke
Status:deferred
Tags:
Comment:
Replace console.log with console.warn in all debug statements
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/ext.Cite.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/ext.core.PostExpandParagraphHandler.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/ext.core.QuoteTransformer.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/ext.core.TemplateHandler.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.DOMConverter.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.DOMPostProcessor.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.HTML5TreeBuilder.node.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.environment.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/mediawiki.tokenizer.peg.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/ext.core.QuoteTransformer.js
@@ -121,7 +121,7 @@
122122 };
123123
124124 QuoteTransformer.prototype.onAny = function ( token, frame, prevToken ) {
125 - //console.log('qt onAny: ' + JSON.stringify(token, null, 2));
 125+ //console.warn('qt onAny: ' + JSON.stringify(token, null, 2));
126126 this.currentChunk.push( token );
127127 return {};
128128 };
@@ -139,9 +139,9 @@
140140
141141 token.rank = this.quoteAndNewlineRank;
142142
143 - //console.log('chunks: ' + JSON.stringify( this.chunks, null, 2 ) );
 143+ //console.warn('chunks: ' + JSON.stringify( this.chunks, null, 2 ) );
144144
145 - //console.log("onNewLine: " + this.italics.length + 'i/b' + this.bolds.length);
 145+ //console.warn("onNewLine: " + this.italics.length + 'i/b' + this.bolds.length);
146146 // balance out tokens, convert placeholders into tags
147147 if (this.italics.length % 2 && this.bolds.length % 2) {
148148 var firstsingleletterword = -1,
@@ -149,7 +149,7 @@
150150 firstspace = -1;
151151 for (var j = 0; j < this.bolds.length; j++) {
152152 var ctx = this.bolds[j][0];
153 - //console.log("balancing!" + JSON.stringify(ctx.prevToken, null, 2));
 153+ //console.warn("balancing!" + JSON.stringify(ctx.prevToken, null, 2));
154154 if (ctx.prevToken) {
155155 if (ctx.prevToken.constructor === String) {
156156 var lastchar = prevToken[ctx.prevToken.length - 1],
@@ -195,7 +195,7 @@
196196 this.currentChunk.push( token );
197197 this._startNewChunk();
198198
199 - //console.log('chunks: ' + JSON.stringify( this.chunks, null, 2 ) );
 199+ //console.warn('chunks: ' + JSON.stringify( this.chunks, null, 2 ) );
200200
201201 // return all collected tokens including the newline
202202 res = { tokens: [].concat.apply([], this.chunks) };
@@ -214,7 +214,7 @@
215215 QuoteTransformer.prototype.convertBold = function ( i ) {
216216 var chunk = this.bolds[i],
217217 textToken = "'";
218 - //console.log('convertbold!');
 218+ //console.warn('convertbold!');
219219 if ( chunk.pos ) {
220220 this.chunks[chunk.pos - 1].push( textToken );
221221 } else {
@@ -237,9 +237,9 @@
238238 out = [];
239239
240240 for (j = 0; j < chunks.length; j++) {
241 - //console.log( 'quotesToTags ' + name + ': ' + JSON.stringify( chunks, null, 2 ) );
 241+ //console.warn( 'quotesToTags ' + name + ': ' + JSON.stringify( chunks, null, 2 ) );
242242 t = chunks[j][0].token;
243 - //console.log( 'quotesToTags t: ' + JSON.stringify( t, null, 2));
 243+ //console.warn( 'quotesToTags t: ' + JSON.stringify( t, null, 2));
244244
245245 if(toggle) {
246246 chunks[j][0] = new TagTk( name, t.attribs );
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.HTML5TreeBuilder.node.js
@@ -34,20 +34,20 @@
3535 };
3636
3737 FauxHTML5.TreeBuilder.prototype.onChunk = function ( tokens ) {
38 - //console.log( 'chunk: ' + JSON.stringify( tokens, null, 2 ) );
 38+ //console.warn( 'chunk: ' + JSON.stringify( tokens, null, 2 ) );
3939 for (var i = 0, length = tokens.length; i < length; i++) {
4040 this.processToken(tokens[i]);
4141 }
4242 };
4343
4444 FauxHTML5.TreeBuilder.prototype.onEnd = function ( ) {
45 - //console.log('Fauxhtml5 onEnd');
 45+ //console.warn('Fauxhtml5 onEnd');
4646 // FIXME HACK: For some reason the end token is not processed sometimes,
4747 // which normally fixes the body reference up.
4848 var document = this.parser.document;
4949 document.body = document.getElementsByTagName('body')[0];
5050
51 - //console.log( 'onEnd: ' + document.body.innerHTML );
 51+ //console.warn( 'onEnd: ' + document.body.innerHTML );
5252
5353 this.emit( 'document', document );
5454
@@ -128,7 +128,7 @@
129129 //this.emit('document', this.document);
130130 break;
131131 default:
132 - console.log("Unhandled token: " + JSON.stringify(token));
 132+ console.warn("Unhandled token: " + JSON.stringify(token));
133133 break;
134134 }
135135 break;
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js
@@ -214,12 +214,12 @@
215215 ts = ts.concat(tagts);
216216 ts.sort( this._cmpTransformations );
217217 }
218 - //console.log(JSON.stringify(ts, null, 2));
 218+ //console.warn(JSON.stringify(ts, null, 2));
219219 if ( ts ) {
220220 for ( i = 0, l = ts.length; i < l; i++ ) {
221221 transformer = ts[i];
222222 if ( res.token.rank && transformer.rank < res.token.rank ) {
223 - //console.log( 'SKIPPING' + JSON.stringify( token, null, 2 ) +
 223+ //console.warn( 'SKIPPING' + JSON.stringify( token, null, 2 ) +
224224 // '\ntransform:\n' + JSON.stringify( transformer, null, 2 ) );
225225 // skip transformation, was already applied.
226226 continue;
@@ -360,7 +360,7 @@
361361 * first stage of the pipeline, and 'last' pointing to the last stage.
362362 */
363363 AsyncTokenTransformManager.prototype.newChildPipeline = function ( inputType, args, title ) {
364 - //console.log( 'newChildPipeline: ' + JSON.stringify( args ) );
 364+ //console.warn( 'newChildPipeline: ' + JSON.stringify( args ) );
365365 var pipe = this.childFactories.input( inputType, args );
366366
367367 // now set up a few things on the child AsyncTokenTransformManager.
@@ -406,7 +406,7 @@
407407 // eventize: bend to event emitter callback
408408 this.tokenCB = this._returnTokens.bind( this );
409409 this.prevToken = undefined;
410 - //console.log( 'AsyncTokenTransformManager args ' + JSON.stringify( args ) );
 410+ //console.warn( 'AsyncTokenTransformManager args ' + JSON.stringify( args ) );
411411 if ( ! args ) {
412412 this.args = {}; // no arguments at the top level
413413 } else {
@@ -470,7 +470,7 @@
471471 */
472472 AsyncTokenTransformManager.prototype.transformTokens = function ( tokens, parentCB ) {
473473
474 - //console.log('AsyncTokenTransformManager.transformTokens: ' + JSON.stringify(tokens) );
 474+ //console.warn('AsyncTokenTransformManager.transformTokens: ' + JSON.stringify(tokens) );
475475
476476 var res,
477477 phaseEndRank = 2, // XXX: parametrize!
@@ -538,7 +538,7 @@
539539 i--;
540540 }
541541 } else if ( res.async ) {
542 - //console.log( 'tokens returned' );
 542+ //console.warn( 'tokens returned' );
543543 // The child now switched to activeAccum, we have to create a new
544544 // accumulator for the next potential child.
545545 activeAccum = accum;
@@ -577,7 +577,7 @@
578578 this.emit( 'chunk', tokens );
579579
580580 if ( ! notYetDone ) {
581 - //console.log('AsyncTokenTransformManager._returnTokens done. tokens:' +
 581+ //console.warn('AsyncTokenTransformManager._returnTokens done. tokens:' +
582582 // JSON.stringify( tokens, null, 2 ) + ', listeners: ' +
583583 // JSON.stringify( this.listeners( 'chunk' ), null, 2 ) );
584584 // signal our done-ness to consumers.
@@ -758,7 +758,7 @@
759759 //this.pipe.process(
760760 var pipe,
761761 ref;
762 - //console.log( 'AttributeTransformManager.process: ' + JSON.stringify( attributes ) );
 762+ //console.warn( 'AttributeTransformManager.process: ' + JSON.stringify( attributes ) );
763763
764764 // transform each argument (key and value), and handle asynchronous returns
765765 for ( var i = 0, l = attributes.length; i < l; i++ ) {
@@ -767,7 +767,7 @@
768768 var cur = attributes[i];
769769
770770 if ( ! cur ) {
771 - console.log( JSON.stringify( attributes ) );
 771+ console.warn( JSON.stringify( attributes ) );
772772 console.trace();
773773 continue;
774774 }
@@ -801,7 +801,7 @@
802802 pipe.addListener( 'end',
803803 this.onEnd.bind( this, this._returnAttributeValue.bind( this, i ) )
804804 );
805 - //console.log('starting attribute transform of ' + JSON.stringify( attributes[i].v ) );
 805+ //console.warn('starting attribute transform of ' + JSON.stringify( attributes[i].v ) );
806806 pipe.process( cur.v.concat([{type:'END'}]) );
807807 } else {
808808 kv.value = cur.v;
@@ -855,7 +855,7 @@
856856 * Callback for async argument value expansions
857857 */
858858 AttributeTransformManager.prototype._returnAttributeValue = function ( ref, tokens, notYetDone ) {
859 - //console.log( 'check _returnAttributeValue: ' + JSON.stringify( tokens ) +
 859+ //console.warn( 'check _returnAttributeValue: ' + JSON.stringify( tokens ) +
860860 // ' notYetDone:' + notYetDone );
861861 this.kvs[ref].value = this.kvs[ref].value.concat( tokens );
862862 if ( ! notYetDone ) {
@@ -871,7 +871,7 @@
872872 * Callback for async argument key expansions
873873 */
874874 AttributeTransformManager.prototype._returnAttributeKey = function ( ref, tokens, notYetDone ) {
875 - //console.log( 'check _returnAttributeKey: ' + JSON.stringify( tokens ) +
 875+ //console.warn( 'check _returnAttributeKey: ' + JSON.stringify( tokens ) +
876876 // ' notYetDone:' + notYetDone );
877877 this.kvs[ref].key = this.kvs[ref].key.concat( tokens );
878878 if ( ! notYetDone ) {
@@ -932,7 +932,7 @@
933933 this.outstanding--;
934934 }
935935
936 - //console.log( 'TokenAccumulator._returnTokens' );
 936+ //console.warn( 'TokenAccumulator._returnTokens' );
937937 if ( reference === 'child' ) {
938938 tokens = tokens.concat( this.accum );
939939 this.manager.env.dp('TokenAccumulator._returnTokens child: ' +
@@ -979,7 +979,7 @@
980980 * Mark the sibling as done (normally at the tail of a chain).
981981 */
982982 TokenAccumulator.prototype.siblingDone = function () {
983 - //console.log( 'TokenAccumulator.siblingDone: ' );
 983+ //console.warn( 'TokenAccumulator.siblingDone: ' );
984984 this._returnTokens ( 'sibling', [], false );
985985 };
986986
@@ -1035,12 +1035,12 @@
10361036 // XXX: set limit really low for testing!
10371037 if ( this.depth > maxDepth ) {
10381038 // too deep
1039 - //console.log( 'Loopcheck: ' + JSON.stringify( this, null, 2 ) );
 1039+ //console.warn( 'Loopcheck: ' + JSON.stringify( this, null, 2 ) );
10401040 return 'Error: Expansion depth limit exceeded at ';
10411041 }
10421042 var elem = this;
10431043 do {
1044 - //console.log( 'loop check: ' + title + ' vs ' + elem.title );
 1044+ //console.warn( 'loop check: ' + title + ' vs ' + elem.title );
10451045 if ( elem.title === title ) {
10461046 // Loop detected
10471047 return 'Error: Expansion loop detected at ';
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.DOMConverter.js
@@ -125,7 +125,7 @@
126126 type: 'blockquote'
127127 };
128128 default:
129 - console.log( 'HTML to Wiki DOM conversion warning: Unknown node name ' +
 129+ console.warn( 'HTML to Wiki DOM conversion warning: Unknown node name ' +
130130 nodeName );
131131 return {
132132 handler: this._convertHTMLBranch,
@@ -168,7 +168,7 @@
169169 return 'object/includeonly'; // XXX
170170 default:
171171 if ( warn ) {
172 - console.log( 'HTML to Wiki DOM conversion warning: Unsupported html annotation ' + name );
 172+ console.warn( 'HTML to Wiki DOM conversion warning: Unsupported html annotation ' + name );
173173 }
174174 return undefined;
175175 }
@@ -217,10 +217,10 @@
218218 newPara();
219219 }
220220 res = this._convertHTMLAnnotation( cnode, offset, annotationtype );
221 - //console.log( 'res leaf: ' + JSON.stringify(res, null, 2));
 221+ //console.warn( 'res leaf: ' + JSON.stringify(res, null, 2));
222222 offset += res.text.length;
223223 parNode.content.text += res.text;
224 - //console.log( 'res annotations: ' + JSON.stringify(res, null, 2));
 224+ //console.warn( 'res annotations: ' + JSON.stringify(res, null, 2));
225225 parNode.content.annotations = parNode.content.annotations
226226 .concat( res.annotations );
227227 } else {
@@ -247,7 +247,7 @@
248248 // add a comment node.
249249 break;
250250 default:
251 - console.log( "HTML to Wiki DOM conversion error. Unhandled node " +
 251+ console.warn( "HTML to Wiki DOM conversion error. Unhandled node " +
252252 cnode.innerHTML );
253253 break;
254254 }
@@ -277,7 +277,7 @@
278278 annotations: []
279279 }
280280 };
281 - //console.log( 'res wnode: ' + JSON.stringify(wnode, null, 2));
 281+ //console.warn( 'res wnode: ' + JSON.stringify(wnode, null, 2));
282282 for ( var i = 0, l = children.length; i < l; i++ ) {
283283 var cnode = children[i];
284284 switch ( cnode.nodeType ) {
@@ -286,10 +286,10 @@
287287 var annotationtype = this._getWikiDomAnnotationType( cnode, true );
288288 if ( annotationtype ) {
289289 var res = this._convertHTMLAnnotation( cnode, offset, annotationtype );
290 - //console.log( 'res leaf: ' + JSON.stringify(res, null, 2));
 290+ //console.warn( 'res leaf: ' + JSON.stringify(res, null, 2));
291291 offset += res.text.length;
292292 wnode.content.text += res.text;
293 - //console.log( 'res annotations: ' + JSON.stringify(res, null, 2));
 293+ //console.warn( 'res annotations: ' + JSON.stringify(res, null, 2));
294294 wnode.content.annotations = wnode.content.annotations
295295 .concat( res.annotations );
296296 }
@@ -303,7 +303,7 @@
304304 // add a comment annotation?
305305 break;
306306 default:
307 - console.log( "HTML to Wiki DOM conversion error. Unhandled node " +
 307+ console.warn( "HTML to Wiki DOM conversion error. Unhandled node " +
308308 cnode.innerHTML );
309309 break;
310310 }
@@ -344,7 +344,7 @@
345345 var annotationtype = this._getWikiDomAnnotationType(cnode, true);
346346 if ( annotationtype ) {
347347 var res = this._convertHTMLAnnotation( cnode, offset, annotationtype );
348 - //console.log( 'res annotations 2: ' + JSON.stringify(res, null, 2));
 348+ //console.warn( 'res annotations 2: ' + JSON.stringify(res, null, 2));
349349 text += res.text;
350350 offset += res.text.length;
351351 annotations = annotations.concat( res.annotations );
@@ -359,7 +359,7 @@
360360 // add a comment annotation?
361361 break;
362362 default:
363 - console.log( "HTML to Wiki DOM conversion error. Unhandled node " +
 363+ console.warn( "HTML to Wiki DOM conversion error. Unhandled node " +
364364 cnode.innerHTML );
365365 break;
366366 }
Index: trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js
@@ -107,7 +107,7 @@
108108 return this['pf_#time']( 'm', [], {} );
109109 };
110110 ParserFunctions.prototype['pf_currentmonthname'] = function ( target, argList, argDict ) {
111 - return this['pf_#time']( 'J', [], {} );
 111+ return this['pf_#time']( 'F', [], {} );
112112 };
113113 ParserFunctions.prototype['pf_currentmonthabbrev'] = function ( target, argList, argDict ) {
114114 return this['pf_#time']( 'M', [], {} );
@@ -299,7 +299,7 @@
300300 this.manager.env.normalizeTitle( target ) + '&' +
301301 argList.map(
302302 function( kv ) {
303 - //console.log( JSON.stringify( kv ) );
 303+ //console.warn( JSON.stringify( kv ) );
304304 return (kv.v !== '' && kv.k + '=' + kv.v ) || kv.k;
305305 }
306306 ).join('&')
Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt
@@ -11,7 +11,7 @@
1212 /* Fixme: use static functions to separate module! Unfortunately, this
1313 * does not work:
1414 * var tu = require('./mediawiki.tokenizer.utils.js');
15 - * console.log(tu.flatten([]));
 15+ * console.warn(tu.flatten([]));
1616 * Using exports in the module gets a bit further, but accesses to
1717 * tu.flatten in productions still fail. Thus, I just moved the functions
1818 * here until a solution is found:
@@ -82,7 +82,7 @@
8383 // Debug print with global switch
8484 var dp = function ( msg ) {
8585 if ( false ) {
86 - console.log(msg);
 86+ console.warn(msg);
8787 }
8888 };
8989
@@ -293,13 +293,13 @@
294294 // end is passed inline as a token, as well as a separate event for now.
295295
296296 // this does not work yet.
297 - //console.log('about to emit' + pp(self));
 297+ //console.warn('about to emit' + pp(self));
298298 //self._tokenizer.emit('chunk', [ { type: 'END' } ] );
299299 //self._tokenizer.emit('end');
300300 // Append the end (for obvious reasons this should not
301301 // be part of a stream, only when tokenizing complete
302302 // texts)
303 - //console.log( pp( flatten ( e ) ) );
 303+ //console.warn( pp( flatten ( e ) ) );
304304 cache = {};
305305 __parseArgs[2]( [ new EOFTk( ) ] );
306306 return []; //flatten(e);
@@ -476,7 +476,7 @@
477477 = r:( ts:(!inline_breaks t:[^=<>{\n\r&'"\t ] {return t})+ { return ts.join(''); }
478478 / directive
479479 / !inline_breaks [&%] )* {
480 - //console.log('prep');
 480+ //console.warn('prep');
481481 return flatten_string ( r );
482482 }
483483 attribute_preprocessor_text_single
@@ -489,7 +489,7 @@
490490 = r:( t:[^{&"]+ { return t.join(''); }
491491 / directive
492492 / !inline_breaks [{&] )* {
493 - //console.log( 'double:' + pp(r) );
 493+ //console.warn( 'double:' + pp(r) );
494494 return flatten_string ( r );
495495 }
496496
@@ -510,7 +510,7 @@
511511 bs.dataAttribs = {};
512512 }
513513 bs.dataAttribs.sourcePos = [blockStart, pos];
514 - //console.log( 'toplevelblock: ' + pp( bs ));
 514+ //console.warn( 'toplevelblock: ' + pp( bs ));
515515 }
516516
517517 // Emit tokens for this toplevelblock. This feeds a chunk to the parser
@@ -594,11 +594,11 @@
595595 / & { return syntaxFlags['linkdesc']; } link_end { return true; }
596596 / & { return syntaxFlags['h']; } '='+ space* newline { return true; }
597597 / & { return syntaxFlags['template']; } ('|' / '}}' ) {
598 - //console.log( 'template break @' + pos + input.substr(pos-1, 4) );
 598+ //console.warn( 'template break @' + pos + input.substr(pos-1, 4) );
599599 return true;
600600 }
601601 / & { return syntaxFlags['equal']; } '=' {
602 - //console.log( 'equal stop @' + pos + input.substr(pos-1, 4) );
 602+ //console.warn( 'equal stop @' + pos + input.substr(pos-1, 4) );
603603 return true;
604604 }
605605
@@ -624,7 +624,7 @@
625625 if (text.length) {
626626 out.push( text.join('') );
627627 }
628 - //console.log('inline out:' + pp(out));
 628+ //console.warn('inline out:' + pp(out));
629629 return out;
630630 }
631631
@@ -760,7 +760,7 @@
761761 ] ),
762762 ].concat( text
763763 , [ new EndTagTk( 'a' )]);
764 - //console.log( JSON.stringify( res, null, 2 ) );
 764+ //console.warn( JSON.stringify( res, null, 2 ) );
765765 return res;
766766 }
767767 / "[" & { clearFlag('extlink'); return false; }
@@ -838,7 +838,7 @@
839839 // again.
840840 params.unshift( { k: '', v: flatten( target ) } );
841841 var obj = new SelfclosingTagTk( 'template', params );
842 - //console.log( 'tokenizer template ' + JSON.stringify( target ));
 842+ //console.warn( 'tokenizer template ' + JSON.stringify( target ));
843843 return obj;
844844 }
845845
@@ -854,16 +854,16 @@
855855 name = flatten( name );
856856 params.unshift( { k: '', v: name } );
857857 var obj = new SelfclosingTagTk( 'templatearg', params );
858 - //console.log( 'tokenizer tplarg ' + JSON.stringify( obj, null, 2 ));
 858+ //console.warn( 'tokenizer tplarg ' + JSON.stringify( obj, null, 2 ));
859859 return obj;
860860 }
861861
862862 template_param
863863 = name:template_param_name space*
864864 value:( s0:"=" s1:space*
865 - //& { console.log( 'entering value' ); return true }
 865+ //& { console.warn( 'entering value' ); return true }
866866 s2:template_param_text { return [s0, s1, s2] } )? {
867 - //console.log( 'named template_param matched' + pp([name, value ]) );
 867+ //console.warn( 'named template_param matched' + pp([name, value ]) );
868868 if ( value !== '' ) {
869869 return new KV(name, flatten( value[2] ) || []);
870870 } else {
@@ -880,7 +880,7 @@
881881 tpt:template_param_text
882882 {
883883 clearFlag( 'equal' );
884 - //console.log( 'template param name matched: ' + pp( tpt ) );
 884+ //console.warn( 'template param name matched: ' + pp( tpt ) );
885885 return tpt;
886886 }
887887
@@ -891,7 +891,7 @@
892892 = & { return setFlag('template') }
893893 il:inline {
894894 clearFlag('template');
895 - //console.log( 'tpt match: ' + pp (il));
 895+ //console.warn( 'tpt match: ' + pp (il));
896896 return il;
897897 }
898898 / & { return clearFlag('template'); }
@@ -927,7 +927,7 @@
928928 textTokens = $.extend(true, [], target);
929929 }
930930 }
931 - //console.log( "XXX:" + pp([obj].concat(textTokens, [new EndTagTk( 'a' )])) );
 931+ //console.warn( "XXX:" + pp([obj].concat(textTokens, [new EndTagTk( 'a' )])) );
932932 return [obj].concat(textTokens, [new EndTagTk( 'a' )]);
933933 }
934934
@@ -948,7 +948,7 @@
949949 // '=' here.
950950 hs:( '=' inline)?
951951 {
952 - //console.log('link_text' + pp(h) + pp(hs));
 952+ console.warn('link_text' + pp(h) + pp(hs));
953953 clearFlag('linkdesc');
954954 if( hs !== '' ) {
955955 return h.concat(hs);
@@ -993,7 +993,7 @@
994994 / !"</pre>" t2:. { return t2 })+
995995 ("</pre>" / eof) {
996996 // return nowiki tags as well?
997 - //console.log('inpre');
 997+ //console.warn('inpre');
998998 return [ new TagTk( 'pre', attribs ) ]
999999 .concat(ts, [ new EndTagTk( 'pre' ) ]);
10001000 }
@@ -1001,31 +1001,31 @@
10021002
10031003 nowiki
10041004 = "<nowiki>" nc:nowiki_content "</nowiki>" {
1005 - //console.log( 'full nowiki return: ' + pp(nc));
 1005+ //console.warn( 'full nowiki return: ' + pp(nc));
10061006 return nc;
10071007 }
10081008 / "<nowiki>" {
1009 - //console.log('nowiki fallback');
 1009+ //console.warn('nowiki fallback');
10101010 return ['<nowiki>'];
10111011 }
10121012 / "</nowiki>" {
1013 - //console.log('nowiki end fallback');
 1013+ //console.warn('nowiki end fallback');
10141014 return ['</nowiki>'];
10151015 }
10161016
10171017 nowiki_content
10181018 = ts:( t:[^<]+ { return t.join('') }
10191019 / "<pre" p0:space* p1:[^>]* ">" p2:nowiki_content "</pre>" {
1020 - //console.log('nested pre in nowiki');
 1020+ //console.warn('nested pre in nowiki');
10211021 return ["<pre"].concat(p0, p1, [">"], p2, ["</pre>"]).join('');
10221022 }
10231023 / (!("</"( "nowiki>" / "pre>")) c:. {
1024 - //console.log('nowiki: single char' + c);
 1024+ //console.warn('nowiki: single char' + c);
10251025 return c;
10261026 })
10271027 )* {
10281028 // return nowiki tags as well?
1029 - //console.log('nowiki_content: return' + pp(ts));
 1029+ //console.warn('nowiki_content: return' + pp(ts));
10301030 return [ts.join('')];
10311031 }
10321032
@@ -1211,7 +1211,7 @@
12121212 tl:table_line
12131213 tls:( s:sol tl2:table_line { return s.concat(tl2); } )* {
12141214 clearFlag('table');
1215 - //console.log('table_lines: ' + pp(tl.concat(tls)));
 1215+ //console.warn('table_lines: ' + pp(tl.concat(tls)));
12161216 return tl.concat( tls );
12171217 }
12181218 / & { return clearFlag('table'); }
@@ -1248,7 +1248,7 @@
12491249
12501250
12511251 table_row_tag
1252 - = //& { console.log("table row enter"); return true; }
 1252+ = //& { console.warn("table row enter"); return true; }
12531253 "|-"
12541254 a:generic_attribute*
12551255 space*
@@ -1277,7 +1277,7 @@
12781278 = //& { dp("table_data enter, pos=" + pos + input.substr(pos,10)); return true; }
12791279 ! [}+-]
12801280 a:table_cell_args?
1281 - //& { console.log("past attrib, pos=" + pos + input.substr(pos,10)); return true; }
 1281+ //& { console.warn("past attrib, pos=" + pos + input.substr(pos,10)); return true; }
12821282 // use inline_breaks to break on tr etc
12831283 td:( !inline_breaks
12841284 //& { dp("table_data 2, pos=" + pos + input.substr(pos,10)); return true; }
Index: trunk/extensions/VisualEditor/modules/parser/ext.Cite.js
@@ -134,7 +134,7 @@
135135 // fall through for further processing!
136136 } else {
137137 // Inside ref block: Collect all other tokens in refTokens and abort
138 - //console.log(JSON.stringify(tokenCTX.token, null, 2));
 138+ //console.warn(JSON.stringify(tokenCTX.token, null, 2));
139139 this.refTokens.push(tokenCTX.token);
140140 tokenCTX.token = null;
141141 return tokenCTX;
@@ -204,7 +204,7 @@
205205
206206 var arrow = '↑';
207207 var renderLine = function( ref ) {
208 - //console.log('reftokens: ' + JSON.stringify(ref.tokens, null, 2));
 208+ //console.warn('reftokens: ' + JSON.stringify(ref.tokens, null, 2));
209209 var out = [{
210210 type: 'TAG',
211211 name: 'li',
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.tokenizer.peg.js
@@ -31,10 +31,10 @@
3232 if ( !this.parser ) {
3333 // Only create a single parser, as parse() is a static method.
3434 var parserSource = PEG.buildParser(this.src).toSource();
35 - //console.log( parserSource );
 35+ //console.warn( parserSource );
3636 parserSource = parserSource.replace( 'parse: function(input, startRule) {',
3737 'parse: function(input, startRule) { var __parseArgs = arguments;' );
38 - //console.log( parserSource );
 38+ //console.warn( parserSource );
3939 PegTokenizer.prototype.parser = eval( parserSource );
4040 // add reference to this for event emission
4141 // XXX: pass a cb into parse() instead, but need to modify pegjs a bit
@@ -42,7 +42,7 @@
4343 //PegTokenizer.prototype.parser._tokenizer = undefined;
4444
4545 // Print the generated parser source
46 - //console.log(this.parser.toSource());
 46+ //console.warn(this.parser.toSource());
4747 }
4848
4949 // some normalization
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.DOMPostProcessor.js
@@ -28,7 +28,7 @@
2929 for(var i = 0, length = cnodes.length; i < length; i++) {
3030 var child = cnodes[i - deleted],
3131 ctype = child.nodeType;
32 - //console.log(child + ctype);
 32+ //console.warn(child + ctype);
3333 if ((ctype === 3 && (inParagraph || !isElementContentWhitespace( child ))) ||
3434 (ctype === Node.COMMENT_NODE && inParagraph ) ||
3535 (ctype !== Node.TEXT_NODE &&
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.js
@@ -90,7 +90,7 @@
9191 this.treeBuilder = new FauxHTML5.TreeBuilder();
9292 this.treeBuilder.listenForTokensFrom( this.tokenPostProcessor );
9393 //this.tokenPostProcessor.on('chunk', function( c ) {
94 - // console.log( JSON.stringify( c, null, 2 ));
 94+ // console.warn( JSON.stringify( c, null, 2 ));
9595 //} );
9696
9797 /**
@@ -145,7 +145,7 @@
146146 ParserPipeline.prototype.makeInputPipeline = function ( inputType, args, isNoInclude ) {
147147 switch ( inputType ) {
148148 case 'text/wiki':
149 - //console.log( 'makeInputPipeline ' + JSON.stringify( args ) );
 149+ //console.warn( 'makeInputPipeline ' + JSON.stringify( args ) );
150150 if ( this.pipelineCache['text/wiki'].input.length ) {
151151 var pipe = this.pipelineCache['text/wiki'].input.pop();
152152 pipe.last.args = args;
@@ -309,7 +309,7 @@
310310 * Feed input tokens to the first pipeline stage
311311 */
312312 CachedTokenPipeline.prototype.process = function ( chunk ) {
313 - //console.log( 'CachedTokenPipeline::process: ' + chunk );
 313+ //console.warn( 'CachedTokenPipeline::process: ' + chunk );
314314 this.first.process( chunk );
315315 };
316316
@@ -318,7 +318,7 @@
319319 * Forward chunks to our listeners
320320 */
321321 CachedTokenPipeline.prototype.forwardChunk = function ( chunk ) {
322 - //console.log( 'CachedTokenPipeline.forwardChunk: ' +
 322+ //console.warn( 'CachedTokenPipeline.forwardChunk: ' +
323323 // JSON.stringify( chunk, null, 2 )
324324 // );
325325
@@ -331,7 +331,7 @@
332332 * the given pipeline stage and returns it to a cache.
333333 */
334334 CachedTokenPipeline.prototype.forwardEndAndRecycleSelf = function ( ) {
335 - //console.log( 'CachedTokenPipeline.forwardEndAndRecycleSelf: ' +
 335+ //console.warn( 'CachedTokenPipeline.forwardEndAndRecycleSelf: ' +
336336 // JSON.stringify( this.listeners( 'chunk' ), null, 2 ) );
337337 // first, forward the event
338338 this.emit( 'end' );
Index: trunk/extensions/VisualEditor/modules/parser/ext.core.TemplateHandler.js
@@ -54,7 +54,7 @@
5555 * processes the template.
5656 */
5757 TemplateHandler.prototype.onTemplate = function ( token, frame, cb ) {
58 - //console.log('onTemplate! ' + JSON.stringify( token, null, 2 ) +
 58+ //console.warn('onTemplate! ' + JSON.stringify( token, null, 2 ) +
5959 // ' args: ' + JSON.stringify( this.manager.args ));
6060
6161
@@ -143,7 +143,7 @@
144144 * target were expanded.
145145 */
146146 TemplateHandler.prototype._expandTemplate = function ( tplExpandData ) {
147 - //console.log('TemplateHandler.expandTemplate: ' +
 147+ //console.warn('TemplateHandler.expandTemplate: ' +
148148 // JSON.stringify( tplExpandData, null, 2 ) );
149149 var res;
150150
@@ -293,7 +293,7 @@
294294 // Could also encapsulate the template tokens here, if that turns out
295295 // better for the editor.
296296
297 - //console.log( 'TemplateHandler._onEnd: ' + JSON.stringify( res, null, 2 ) );
 297+ //console.warn( 'TemplateHandler._onEnd: ' + JSON.stringify( res, null, 2 ) );
298298
299299 if ( tplExpandData.overallAsync ) {
300300 this.manager.env.dp( 'TemplateHandler._onEnd: calling back with res:' +
@@ -371,11 +371,11 @@
372372
373373 if ( token.resultTokens !== false ) {
374374 // synchronous return
375 - //console.log( 'synchronous attribute expand: ' + JSON.stringify( token.resultTokens ) );
 375+ //console.warn( 'synchronous attribute expand: ' + JSON.stringify( token.resultTokens ) );
376376
377377 return { tokens: token.resultTokens };
378378 } else {
379 - //console.log( 'asynchronous attribute expand: ' + JSON.stringify( token, null, 2 ) );
 379+ //console.warn( 'asynchronous attribute expand: ' + JSON.stringify( token, null, 2 ) );
380380 // asynchronous return
381381 token.resultTokens = [];
382382 return { async: true };
@@ -383,12 +383,12 @@
384384 };
385385
386386 TemplateHandler.prototype._returnArgAttributes = function ( token, cb, frame, attributes ) {
387 - //console.log( '_returnArgAttributes: ' + JSON.stringify( attributes ));
 387+ //console.warn( '_returnArgAttributes: ' + JSON.stringify( attributes ));
388388 var argName = this.manager.env.tokensToString( attributes[0].v ).trim(),
389389 res;
390390 if ( argName in this.manager.args ) {
391391 // return tokens for argument
392 - //console.log( 'templateArg found: ' + argName +
 392+ //console.warn( 'templateArg found: ' + argName +
393393 // ' vs. ' + JSON.stringify( this.manager.args ) );
394394 res = this.manager.args[argName];
395395 } else {
@@ -437,7 +437,7 @@
438438 }
439439 },
440440 function (error, response, body) {
441 - //console.log( 'response for ' + title + ' :' + body + ':' );
 441+ //console.warn( 'response for ' + title + ' :' + body + ':' );
442442 if(error) {
443443 manager.env.dp(error);
444444 self.emit('src', 'Page/template fetch failure for title ' + title, title);
@@ -446,14 +446,14 @@
447447 data,
448448 normalizedTitle;
449449 try {
450 - //console.log( 'body: ' + body );
 450+ //console.warn( 'body: ' + body );
451451 data = JSON.parse( body );
452452 } catch(e) {
453 - console.log( "Error: while parsing result. Error was: " );
454 - console.log( e );
455 - console.log( "Response that didn't parse was:");
456 - console.log( "------------------------------------------\n" + body );
457 - console.log( "------------------------------------------" );
 453+ console.warn( "Error: while parsing result. Error was: " );
 454+ console.warn( e );
 455+ console.warn( "Response that didn't parse was:");
 456+ console.warn( "------------------------------------------\n" + body );
 457+ console.warn( "------------------------------------------" );
458458 }
459459 try {
460460 $.each( data.query.pages, function(i, page) {
@@ -463,10 +463,10 @@
464464 }
465465 });
466466 } catch ( e2 ) {
467 - console.log( 'Did not find page revisions in the returned body:' + body );
 467+ console.warn( 'Did not find page revisions in the returned body:' + body );
468468 src = '';
469469 }
470 - //console.log( 'Page ' + title + ': got ' + src );
 470+ //console.warn( 'Page ' + title + ': got ' + src );
471471 manager.env.tp( 'Retrieved ' + title );
472472 manager.env.pageCache[title] = src;
473473 self.emit( 'src', src, title );
@@ -493,7 +493,7 @@
494494 titles: title
495495 },
496496 success: function(data, statusString, xhr) {
497 - console.log( 'Page ' + title + ' success ' + JSON.stringify( data ) );
 497+ console.warn( 'Page ' + title + ' success ' + JSON.stringify( data ) );
498498 var src = null, title = null;
499499 $.each(data.query.pages, function(i, page) {
500500 if (page.revisions && page.revisions.length) {
@@ -502,17 +502,17 @@
503503 }
504504 });
505505 if (typeof src !== 'string') {
506 - console.log( 'Page ' + title + 'not found! Got ' + src );
 506+ console.warn( 'Page ' + title + 'not found! Got ' + src );
507507 callback( 'Page ' + title + ' not found' );
508508 } else {
509509 // Add to cache
510 - console.log( 'Page ' + title + ': got ' + src );
 510+ console.warn( 'Page ' + title + ': got ' + src );
511511 this.manager.env.pageCache[title] = src;
512512 callback(src, title);
513513 }
514514 },
515515 error: function(xhr, msg, err) {
516 - console.log( 'Page/template fetch failure for title ' +
 516+ console.warn( 'Page/template fetch failure for title ' +
517517 title + ', url=' + url + JSON.stringify(xhr) + ', err=' + err );
518518 callback('Page/template fetch failure for title ' + title);
519519 },
Index: trunk/extensions/VisualEditor/modules/parser/ext.core.PostExpandParagraphHandler.js
@@ -32,7 +32,7 @@
3333 };
3434
3535 PostExpandParagraphHandler.prototype.reset = function ( token, frame, cb ) {
36 - //console.log( 'PostExpandParagraphHandler.reset ' + JSON.stringify( this.tokens ) );
 36+ //console.warn( 'PostExpandParagraphHandler.reset ' + JSON.stringify( this.tokens ) );
3737 if ( this.newLines ) {
3838 return { tokens: this._finish() };
3939 } else {
@@ -56,7 +56,7 @@
5757 // Handle NEWLINE tokens, which trigger the actual quote analysis on the
5858 // collected quote tokens so far.
5959 PostExpandParagraphHandler.prototype.onNewLine = function ( token, frame, cb ) {
60 - //console.log( 'PostExpandParagraphHandler.onNewLine: ' + JSON.stringify( token, null , 2 ) );
 60+ //console.warn( 'PostExpandParagraphHandler.onNewLine: ' + JSON.stringify( token, null , 2 ) );
6161 var res;
6262 this.tokens.push( token );
6363
@@ -71,7 +71,7 @@
7272
7373
7474 PostExpandParagraphHandler.prototype.onAny = function ( token, frame, cb ) {
75 - //console.log( 'PostExpandParagraphHandler.onAny' );
 75+ //console.warn( 'PostExpandParagraphHandler.onAny' );
7676 this.tokens.push( token );
7777 if ( token.type === 'COMMENT' ||
7878 ( token.constructor === String && token.match( /^[\t ]+$/ ) )
@@ -83,9 +83,9 @@
8484 // XXX: Only open paragraph if inline token follows!
8585
8686 // None of the tokens we are interested in, so abort processing..
87 - //console.log( 'PostExpandParagraphHandler.onAny: ' + JSON.stringify( this.tokens, null , 2 ) );
 87+ //console.warn( 'PostExpandParagraphHandler.onAny: ' + JSON.stringify( this.tokens, null , 2 ) );
8888 if ( this.newLines >= 2 && ! u.isBlockToken( token ) ) {
89 - //console.log( 'insert p:' + JSON.stringify( token, null, 2 ) );
 89+ //console.warn( 'insert p:' + JSON.stringify( token, null, 2 ) );
9090 return { tokens: [ new TagTk( 'p' ) ].concat( this._finish() ) };
9191 } else {
9292 return { tokens: this._finish() };
Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.environment.js
@@ -36,7 +36,7 @@
3737
3838 MWParserEnvironment.prototype.KVtoHash = function ( kvs ) {
3939 if ( ! kvs ) {
40 - console.log( "Invalid kvs!: " + JSON.stringify( kvs, null, 2 ) );
 40+ console.warn( "Invalid kvs!: " + JSON.stringify( kvs, null, 2 ) );
4141 return {};
4242 }
4343 var res = {};
@@ -47,7 +47,7 @@
4848 res[key] = kv.v;
4949 }
5050 }
51 - //console.log( 'KVtoHash: ' + JSON.stringify( res ));
 51+ //console.warn( 'KVtoHash: ' + JSON.stringify( res ));
5252 return res;
5353 }
5454
@@ -120,7 +120,7 @@
121121
122122 MWParserEnvironment.prototype.tokensToString = function ( tokens ) {
123123 var out = [];
124 - //console.log( 'MWParserEnvironment.tokensToString, tokens: ' + JSON.stringify( tokens ) );
 124+ //console.warn( 'MWParserEnvironment.tokensToString, tokens: ' + JSON.stringify( tokens ) );
125125 // XXX: quick hack, track down non-array sources later!
126126 if ( ! $.isArray( tokens ) ) {
127127 tokens = [ tokens ];
@@ -145,7 +145,7 @@
146146 //out.push( tstring );
147147 }
148148 }
149 - //console.log( 'MWParserEnvironment.tokensToString result: ' + out.join('') );
 149+ //console.warn( 'MWParserEnvironment.tokensToString result: ' + out.join('') );
150150 return out.join('');
151151 };
152152
@@ -156,9 +156,9 @@
157157 MWParserEnvironment.prototype.dp = function ( ) {
158158 if ( this.debug ) {
159159 if ( arguments.length > 1 ) {
160 - console.log( JSON.stringify( arguments, null, 2 ) );
 160+ console.warn( JSON.stringify( arguments, null, 2 ) );
161161 } else {
162 - console.log( arguments[0] );
 162+ console.warn( arguments[0] );
163163 }
164164 }
165165 };
@@ -169,9 +169,9 @@
170170 MWParserEnvironment.prototype.tp = function ( ) {
171171 if ( this.debug || this.trace ) {
172172 if ( arguments.length > 1 ) {
173 - console.log( JSON.stringify( arguments, null, 2 ) );
 173+ console.warn( JSON.stringify( arguments, null, 2 ) );
174174 } else {
175 - console.log( arguments[0] );
 175+ console.warn( arguments[0] );
176176 }
177177 }
178178 };

Status & tagging log