Arlolra has uploaded a new change for review.

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

Change subject: [jscs] Enforce requireSpaceAfterLineComment
......................................................................

[jscs] Enforce requireSpaceAfterLineComment

 * Some of these changes may be controversial in that others may feel
   polluting the codebase with commented out console statements eases
   debuggability. My take is that they're distasteful and should be
   converted to proper log statements where they're actually seeing use.
   To support the case that these are rotting, for the most part, in the
   tokenizer they often invoke a `pp` which hasn't been defined for quite
   some time.

Change-Id: I88f268d76cc4d3f866d0a473c8eed5156f40e662
---
M .jscsrc
M lib/dom.markTreeBuilderFixups.js
M lib/dom.wrapTemplates.js
M lib/ext.core.ExtensionHandler.js
M lib/ext.core.LinkHandler.js
M lib/ext.core.NoIncludeOnly.js
M lib/ext.core.ParagraphWrapper.js
M lib/ext.core.ParserFunctions.js
M lib/ext.core.QuoteTransformer.js
M lib/ext.core.Sanitizer.js
M lib/ext.core.TemplateHandler.js
M lib/ext.util.TokenCollector.js
M lib/jsutils.js
M lib/mediawiki.ApiRequest.js
M lib/mediawiki.DOMDiff.js
M lib/mediawiki.DOMPostProcessor.js
M lib/mediawiki.DOMUtils.js
M lib/mediawiki.Diff.js
M lib/mediawiki.HTML5TreeBuilder.node.js
M lib/mediawiki.Title.js
M lib/mediawiki.TokenTransformManager.js
M lib/mediawiki.Util.js
M lib/mediawiki.WikiConfig.js
M lib/mediawiki.WikitextSerializer.js
M lib/mediawiki.parser.defines.js
M lib/mediawiki.parser.environment.js
M lib/mediawiki.parser.js
M lib/mediawiki.tokenizer.peg.js
M lib/mediawiki.tokenizer.utils.js
M lib/pegTokenizer.pegjs.txt
M lib/wts.LinkHandler.js
M lib/wts.SerializerState.js
M lib/wts.TagHandlers.js
M lib/wts.separators.js
M tests/bugSplit.js
M tests/client/client.js
M tests/mocha/apitest.localsettings.js
M tests/mockAPI.js
M tests/parserTests-whitelist.js
M tests/parserTests.js
M tests/roundtrip-test.js
M tests/rttest.localsettings.js
M tests/server/server.js
M tests/sync-parserTests.js
44 files changed, 158 insertions(+), 299 deletions(-)


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

diff --git a/.jscsrc b/.jscsrc
index 3d1609f..b681eee 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -8,7 +8,6 @@
        "maximumLineLength": null,
        "requireCamelCaseOrUpperCaseIdentifiers": null,
        "requireCapitalizedComments": null,
-       "requireSpaceAfterLineComment": null,
        "requireTrailingComma": null,
        "validateIndentation": null,
        "validateQuoteMarks": null,
diff --git a/lib/dom.markTreeBuilderFixups.js b/lib/dom.markTreeBuilderFixups.js
index 585952d..8a8c815 100644
--- a/lib/dom.markTreeBuilderFixups.js
+++ b/lib/dom.markTreeBuilderFixups.js
@@ -106,7 +106,6 @@
                                        var prevSibling = c.previousSibling;
                                        if (( prevSibling && 
prevSibling.nodeName.toLowerCase() !== expectedName ) ||
                                                (!prevSibling && 
c.parentNode.nodeName.toLowerCase() !== expectedName)) {
-                                               //console.log( 'start stripped! 
', expectedName, c.parentNode.innerHTML );
                                                if (c && cdp.stx !== 'html'
                                                                && ( 
expectedName === 'td'
                                                                        || 
expectedName === 'tr'
@@ -201,7 +200,6 @@
                                // Detect auto-inserted end-tags
                                var metaNode = findMetaShadowNode(c, 
'mw:EndTag', cNodeName);
                                if (!metaNode) {
-                                       //console.log( c.nodeName, 
c.parentNode.outerHTML );
                                        // 'c' is a html node that has tsr, but 
no end-tag marker tag
                                        // => its closing tag was 
auto-generated by treebuilder.
                                        dp.autoInsertedEnd = true;
@@ -232,7 +230,6 @@
                                                // Strip start-tag marker metas 
that has its matching node
                                                deleteShadowMeta(fc);
                                        } else {
-                                               
//console.log('autoInsertedStart:', c.outerHTML);
                                                dp.autoInsertedStart = true;
                                        }
                                } else {
@@ -250,8 +247,6 @@
                                        if (!sibling || 
sibling.nodeName.toLowerCase() !== expectedName) {
                                                // Not found, the tag was 
stripped. Insert an
                                                // mw:Placeholder for 
round-tripping
-                                               
//console.log('autoinsertedEnd', c.innerHTML, c.parentNode.innerHTML);
-                                               // 
console.warn("expected.nodeName: " + expectedName + "; sibling.nodeName: " + 
sibling.nodeName);
                                                addPlaceholderMeta(env, c, dp, 
expectedName, {end: true});
                                        } else if ( dp.stx ) {
                                                // Transfer stx flag
diff --git a/lib/dom.wrapTemplates.js b/lib/dom.wrapTemplates.js
index 78f91c7..0a98e84 100644
--- a/lib/dom.wrapTemplates.js
+++ b/lib/dom.wrapTemplates.js
@@ -798,8 +798,6 @@
                         elem.getAttribute('about') !== about)) {
                elem = elem.nextSibling;
        }
-
-       //if (elem) console.log( 'tableNode found' + elem.innerHTML );
        return elem;
 }
 
@@ -808,7 +806,7 @@
  */
 function findWrappableTemplateRanges( doc, env, root, tpls ) {
        var tplRanges = [],
-           elem = root.firstChild,
+               elem = root.firstChild,
                about, aboutRef;
 
        while (elem) {
@@ -849,7 +847,6 @@
                                                } else {
                                                        // should not happen!
                                                        
env.log("warning/template", 'start found after content for', about);
-                                                       
//console.warn("aboutRef.start " + elem.outerHTML);
                                                }
                                        } else {
                                                tpls[about] = { start: elem };
diff --git a/lib/ext.core.ExtensionHandler.js b/lib/ext.core.ExtensionHandler.js
index a4de140..bc61bc2 100644
--- a/lib/ext.core.ExtensionHandler.js
+++ b/lib/ext.core.ExtensionHandler.js
@@ -85,7 +85,6 @@
        env.dp( 'Note: trying to expand ', text );
 
        // Start a new request if none is outstanding
-       //env.dp( 'requestQueue: ', env.requestQueue );
        if ( env.requestQueue[text] === undefined ) {
                env.tp( 'Note: Starting new request for ' + text );
                env.requestQueue[text] = new PHPParseRequest( env, title, text 
);
@@ -131,7 +130,6 @@
                token.setAttribute('options', 
normalizeExtOptions(token.getAttribute('options')));
                nativeHandler(token, cb);
        } else if ( cachedExpansion ) {
-               //console.log('cache hit for', 
JSON.stringify(cacheKey.substr(0, 50)));
                // cache hit. Reuse extension expansion.
                var toks = DU.encapsulateExpansionHTML(env, token, 
cachedExpansion, { setDSR: true });
                cb({ tokens: toks });
diff --git a/lib/ext.core.LinkHandler.js b/lib/ext.core.LinkHandler.js
index 7ed80d5..22c7cac 100644
--- a/lib/ext.core.LinkHandler.js
+++ b/lib/ext.core.LinkHandler.js
@@ -1095,9 +1095,9 @@
 
        // FIXME gwicke: We don't really want to add inline styles, as people
        // will start to depend on them otherwise.
-       //if (wrapperStyles.length) {
-       //      container.addAttribute( 'style', wrapperStyles.join( ' ' ) );
-       //}
+       //  if (wrapperStyles.length) {
+       //    container.addAttribute( 'style', wrapperStyles.join( ' ' ) );
+       //  }
 
        // Set typeof and transfer existing typeof over as well
        container.addAttribute("typeof", rdfaType);
@@ -1186,7 +1186,6 @@
                                firstWrapperToken.dataAttribs.dsr[0];
                }
 
-               //console.log('cache hit for ' + token.dataAttribs.src);
                cb({ tokens: wrapperTokens });
                return;
        }
@@ -1200,8 +1199,8 @@
        // keys normalized
        // values object
        // {
-       //        v: normalized value (object with width / height for size)
-       //        src: the original source
+       //   v: normalized value (object with width / height for size)
+       //   src: the original source
        // }
        //
        var opts = {
@@ -1238,8 +1237,6 @@
                        origOptSrc = origOptSrc[0];
                }
                oText = Util.tokensToString(oContent.v, true);
-
-               //console.log( JSON.stringify( oText, null, 2 ) );
 
                if ( oText.constructor !== String ) {
                        // Might be that this is a valid option whose value is 
just
@@ -1527,9 +1524,6 @@
                href = Util.tokensToString( origHref ),
                content = Util.lookup( token.attribs, 'mw:content'),
                newAttrs, aStart, title;
-
-       //console.warn('extlink href: ' + href );
-       //console.warn( 'mw:content: ' + JSON.stringify( content, null, 2 ) );
 
        var dataAttribs = Util.clone(token.dataAttribs);
        var rdfaType = token.getAttribute('typeof'),
diff --git a/lib/ext.core.NoIncludeOnly.js b/lib/ext.core.NoIncludeOnly.js
index e2e9e18..40ded05 100644
--- a/lib/ext.core.NoIncludeOnly.js
+++ b/lib/ext.core.NoIncludeOnly.js
@@ -80,7 +80,6 @@
 };
 
 OnlyInclude.prototype.onAnyInclude = function( token, manager ) {
-       //this.manager.env.dp( 'onAnyInclude', token, this );
        var isTag, tagName, curriedBuildMetaToken, meta;
 
        if ( token.constructor === EOFTk ) {
@@ -131,11 +130,11 @@
                        this.inOnlyInclude = false;
                        meta = curriedBuildMetaToken( token.constructor === 
EndTagTk, (token.dataAttribs || {}).tsr);
                }
-               //meta.rank = this.rank;
+               // meta.rank = this.rank;
                return { token: meta };
        } else {
                if ( this.inOnlyInclude ) {
-                       //token.rank = this.rank;
+                       // token.rank = this.rank;
                        return { token: token };
                } else {
                        this.accum.push( token );
diff --git a/lib/ext.core.ParagraphWrapper.js b/lib/ext.core.ParagraphWrapper.js
index be93823..03e9582 100644
--- a/lib/ext.core.ParagraphWrapper.js
+++ b/lib/ext.core.ParagraphWrapper.js
@@ -383,8 +383,8 @@
 // popUntil: pop anything until one of the tag in this array is found.
 //           Pass null to disable.
 // popThen: after a stop is reached (or popUntil was null), continue
-//                     popping as long as the elements in this array match. 
Pass
-//                     null to disable.
+//          popping as long as the elements in this array match. Pass
+//          null to disable.
 function popTags(tblTags, popUntil, popThen) {
        while (popUntil && tblTags.length > 0 && 
popUntil.indexOf(tblTags.last()) === -1) {
                tblTags.pop();
diff --git a/lib/ext.core.ParserFunctions.js b/lib/ext.core.ParserFunctions.js
index f08d1be..41d3dac 100644
--- a/lib/ext.core.ParserFunctions.js
+++ b/lib/ext.core.ParserFunctions.js
@@ -78,10 +78,8 @@
 ParserFunctions.prototype['pf_#if'] = function( token, frame, cb, args ) {
        var target = args[0].k;
        if ( target.trim() !== '' ) {
-               //this.env.dp('#if, first branch', target.trim(), argDict[1] );
                this.expandKV( args[1], cb );
        } else {
-               //this.env.dp('#if, second branch', target.trim(), argDict[2] );
                this.expandKV( args[2], cb );
        }
 };
@@ -158,7 +156,6 @@
                                        console.trace();
                                }
                                var self = this;
-                               //console.warn( 'swtch value: ' + kv.v );
 
                                // We found a value-only entry.  However, we 
have to verify
                                // if we have any fall-through cases that this 
matches.
@@ -213,7 +210,6 @@
                                        cb: _cbNoTrim,
                                        asyncCB: cb } );
                                return;
-                               //cb ( { tokens: lastKV.v } );
                        } else {
                                cb ( {} );
                        }
@@ -501,11 +497,6 @@
 ParserFunctions.prototype._pf_time = function( target, args, isLocal ) {
        var res,
                tpl = target.trim();
-       //try {
-       //      var date = new Date( Util.tokensToString( args[1].v ) );
-       //      res = [ date.format( target ) ];
-       //} catch ( e ) {
-       //      this.env.dp( 'ERROR: #time ' + e );
 
        var date = new ParsoidDate(this.env, isLocal);
        try {
@@ -711,7 +702,7 @@
                                }
                                cb({ tokens: [
                                        // FIXME! Figure out correct prefix to 
use
-                                       //this.env.conf.wiki.wgScriptPath +
+                                       // this.env.conf.wiki.wgScriptPath +
                                        env.conf.wiki.script + '?title=' +
                                        env.normalizeTitle( target ) + '&' +
                                        expandedArgs.join('&') ]
diff --git a/lib/ext.core.QuoteTransformer.js b/lib/ext.core.QuoteTransformer.js
index 6a78939..dbf9b5e 100644
--- a/lib/ext.core.QuoteTransformer.js
+++ b/lib/ext.core.QuoteTransformer.js
@@ -87,7 +87,6 @@
 };
 
 QuoteTransformer.prototype.onAny = function( token, frame, prevToken ) {
-       //console.warn('qt onAny: ' + JSON.stringify(token, null, 2));
        this.currentChunk.push( token );
        return {};
 };
@@ -101,7 +100,7 @@
                // Nothing to do, quick abort.
                return { token: token };
        }
-       //token.rank = this.quoteAndNewlineRank;
+       // token.rank = this.quoteAndNewlineRank;
 
        // count number of bold and italics
        var numbold = 0, numitalics = 0;
@@ -131,7 +130,7 @@
                                        ctxPrevToken = prevChunk[j] + 
ctxPrevToken;
                                }
                        }
-                       //console.warn("balancing! " + ctxPrevToken);
+
                        var lastchar = ctxPrevToken[ctxPrevToken.length - 1],
                        secondtolastchar = ctxPrevToken[ctxPrevToken.length - 
2];
                        if (lastchar === ' ' && firstspace === -1) {
@@ -185,7 +184,6 @@
        this.dispatcher.removeTransform( this.quoteAndNewlineRank, 'tag', 'th' 
);
        this.dispatcher.removeTransform( this.quoteAndNewlineRank, 'newline' );
        this.dispatcher.removeTransform( this.anyRank, 'any' );
-       //console.warn( 'res:' + JSON.stringify( res, null, 2 ));
 
        return res;
 };
diff --git a/lib/ext.core.Sanitizer.js b/lib/ext.core.Sanitizer.js
index 80478d8..bd7abd9 100644
--- a/lib/ext.core.Sanitizer.js
+++ b/lib/ext.core.Sanitizer.js
@@ -13,13 +13,13 @@
 require('./mediawiki.parser.defines.js');
 var JSUtils = require('./jsutils.js').JSUtils,
        Util = require('./mediawiki.Util.js').Util,
-    defines = require('./mediawiki.parser.defines.js'),
+       defines = require('./mediawiki.parser.defines.js'),
        WikitextConstants = 
require('./mediawiki.wikitext.constants.js').WikitextConstants;
 
 // define some constructor shortcuts
 var TagTk = defines.TagTk,
-    SelfclosingTagTk = defines.SelfclosingTagTk,
-    EndTagTk = defines.EndTagTk;
+       SelfclosingTagTk = defines.SelfclosingTagTk,
+       EndTagTk = defines.EndTagTk;
 
 /**
  * @class SanitizerModule
@@ -538,7 +538,7 @@
                                // rbc
                                'rb': common,
                                'rp': common,
-                               'rt': common, //common.concat([ 'rbspan' ]),
+                               'rt': common,  // common.concat([ 'rbspan' ]),
                                'rtc': common,
 
                                // MathML root element, where used for 
extensions
@@ -566,7 +566,7 @@
                this.noEndTagSet = new Set(['br']);
 
                this.validProtocolsRE = new RegExp("^(" + 
this.validUrlProtocols.join('|') + ")$", "i" );
-               //|/?[^/])[^\\s]+$");
+               // |/?[^/])[^\\s]+$");
                this.cssDecodeRE = computeCSSDecodeRegexp();
                this.attrWhiteList = computeAttrWhiteList(this.globalConfig);
        }
@@ -980,7 +980,6 @@
        var evilUriRE = this.constants.EVIL_URI_RE;
 
        var wlist = this.getAttrWhiteList(tag);
-       //console.warn('wlist: ' + JSON.stringify(wlist));
        var newAttrs = {};
        var n = attrs.length;
        for (var i = 0; i < n; i++) {
@@ -990,8 +989,6 @@
                        v = a.v,
                        origV = a.vsrc || v,
                        psdAttr = this.isParsoidAttr(k, v, attrs);
-
-               //console.warn('k = ' + k + '; v = ' + v);
 
                // Bypass RDFa/whitelisting checks for Parsoid-inserted attrs
                // Safe to do since the tokenizer renames about/typeof attrs.
diff --git a/lib/ext.core.TemplateHandler.js b/lib/ext.core.TemplateHandler.js
index 86668fe..2b25528 100644
--- a/lib/ext.core.TemplateHandler.js
+++ b/lib/ext.core.TemplateHandler.js
@@ -63,9 +63,6 @@
  * processes the template.
  */
 TemplateHandler.prototype.onTemplate = function( token, frame, cb ) {
-       //console.warn('\nonTemplate! ' + JSON.stringify( token ) +
-       //              ' args: ' + JSON.stringify( this.manager.args ));
-       //console.warn("\toptions:", this.options);
        var env = this.env;
 
        // magic word variables can be mistaken for templates
@@ -94,7 +91,7 @@
                // - Collect stats per template and classify templates into
                // balanced/unbalanced ones based on it
                // - Always force nesting for new templates inserted by the VE
-               //state.srcCB = this._startDocumentPipeline;
+               //  state.srcCB = this._startDocumentPipeline;
 
                // Default to 'safe' token-based template encapsulation for now.
        }
@@ -128,7 +125,6 @@
                        // already
                        if (env.transclusionCache[text]) {
                                // cache hit: reuse the expansion DOM
-                               //console.log('cache hit for', 
JSON.stringify(text.substr(0, 50)));
                                var expansion = env.transclusionCache[text],
                                        opts = { setDSR: true, 
isForeignContent: true },
                                        toks = DU.encapsulateExpansionHTML(env, 
token, expansion, opts);
@@ -606,7 +602,7 @@
        // before the serializer. (something like <mw:error ../> as source)
        if ( err ) {
                src = '';
-               //this.manager.env.errCB(err);
+               //  this.manager.env.errCB(err);
        }
 
        this.manager.env.dp( 'TemplateHandler._startDocumentPipeline', 
tplArgs.name, tplArgs.attribs );
@@ -648,7 +644,7 @@
        // before the serializer. (something like <mw:error ../> as source)
        if ( err ) {
                src = '';
-               //this.manager.env.errCB(err);
+               //  this.manager.env.errCB(err);
        }
 
        var pConf = this.manager.env.conf.parsoid;
@@ -927,8 +923,6 @@
  * recycling.
  */
 TemplateHandler.prototype._onDocument = function(state, cb, doc) {
-       //console.log('_onDocument:', doc.body.outerHTML.substr(0, 100));
-
        // FIXME: This will only incorporate the wikitext parameters into 
data-mw,
        // not the HTML ones. For that, the code in _onChunk will have to 
adapted
        // here.
@@ -951,7 +945,6 @@
                { setDSR: state.token.name === 'extension', isForeignContent: 
true }
        );
 
-       //console.log('toks', JSON.stringify(toks, null, 2));
        // All done for this template, so perform a callback without async: set.
        cb({ tokens: toks });
 };
@@ -1103,7 +1096,6 @@
                env.dp( 'Note: trying to fetch ', title );
 
                // Start a new request if none is outstanding
-               //env.dp( 'requestQueue: ', env.requestQueue );
                if ( env.requestQueue[title] === undefined ) {
                        env.tp( 'Note: Starting new request for ' + title );
                        env.requestQueue[title] = new TemplateRequest( env, 
title );
@@ -1135,7 +1127,6 @@
                env.dp( 'Note: trying to expand ', text );
 
                // Start a new request if none is outstanding
-               //env.dp( 'requestQueue: ', env.requestQueue );
                if ( env.requestQueue[text] === undefined ) {
                        env.tp( 'Note: Starting new request for ' + text );
                        env.requestQueue[text] = new Processor( env, title, 
text );
@@ -1225,7 +1216,6 @@
        } else if (attribs.length > 1 ) {
                this.fetchArg(attribs[1].v, cb, asyncCB);
        } else {
-               //console.warn('no default for ' + argName + JSON.stringify( 
attribs ));
                cb({ tokens: [ '{{{' + argName + '}}}' ] });
        }
 };
diff --git a/lib/ext.util.TokenCollector.js b/lib/ext.util.TokenCollector.js
index d9699dd..66c7808 100644
--- a/lib/ext.util.TokenCollector.js
+++ b/lib/ext.util.TokenCollector.js
@@ -80,8 +80,6 @@
 
                return { };
        } else if (tc === SelfclosingTagTk) {
-               //return { tokens: [ token ] }; //
-
                // We need to handle <ref /> for example, so call the handler.
                return this.transformation( [token, token] );
        } else if (haveOpenTag) {
@@ -115,7 +113,6 @@
                        if ( res.tokens && res.tokens.length &&
                                        res.tokens.last().constructor !== EOFTk 
) {
                                this.manager.env.log("error", this.name, 
"handler dropped the EOFTk!");
-                               //this.manager.env.errCB(obj.stack);
 
                                // preserve the EOFTk
                                res.tokens.push(token);
diff --git a/lib/jsutils.js b/lib/jsutils.js
index a5dde51..7149efe 100644
--- a/lib/jsutils.js
+++ b/lib/jsutils.js
@@ -21,8 +21,6 @@
                if ( o === undefined ) {
                        return;
                } else if ( !(o instanceof Object) ) {
-                       //console.log( o );
-                       //console.trace();
                        return;
                } else if ( Object.isFrozen(o) ) {
                        return;
diff --git a/lib/mediawiki.ApiRequest.js b/lib/mediawiki.ApiRequest.js
index 95aced9..82b1c61 100644
--- a/lib/mediawiki.ApiRequest.js
+++ b/lib/mediawiki.ApiRequest.js
@@ -94,7 +94,7 @@
 ApiRequest.prototype.request = function( options, callback ) {
        // this is a good place to put debugging statements
        // if you want to watch network requests.
-       //console.log('ApiRequest', options);
+       //  console.log('ApiRequest', options);
 
        return request( options, callback );
 };
@@ -201,7 +201,6 @@
        }
        var data;
        try {
-               //console.warn( 'body: ' + body );
                data = JSON.parse( body );
        } catch (e) {
                error = new ParserError( 'Failed to parse the JSON response for 
' +
@@ -700,8 +699,6 @@
                this._processListeners( error, '' );
                return;
        }
-
-       //console.log( this.listeners('parsedHtml') );
        this._processListeners( error, body );
 };
 
diff --git a/lib/mediawiki.DOMDiff.js b/lib/mediawiki.DOMDiff.js
index d71de83..05242a0 100644
--- a/lib/mediawiki.DOMDiff.js
+++ b/lib/mediawiki.DOMDiff.js
@@ -35,10 +35,10 @@
        // FIXME gwicke: Disabled for now as the VE seems to drop data-parsoid 
on
        // the body and the serializer does not respect a 'modified' flag on the
        // body. This also assumes that we always diff on the body element.
-       //if (!this.treeEquals(this.env.page.dom, workNode, false)) {
-       //      this.markNode(workNode, 'modified');
-       //      return { isEmpty: false, dom: workNode };
-       //}
+       //  if (!this.treeEquals(this.env.page.dom, workNode, false)) {
+       //      this.markNode(workNode, 'modified');
+       //      return { isEmpty: false, dom: workNode };
+       //  }
 
        // The root nodes are equal, call recursive differ
        this.debug('ORIG:\n', this.env.page.dom.outerHTML, '\nNEW :\n', 
workNode.outerHTML );
diff --git a/lib/mediawiki.DOMPostProcessor.js 
b/lib/mediawiki.DOMPostProcessor.js
index 4ce9d52..caaa27e 100644
--- a/lib/mediawiki.DOMPostProcessor.js
+++ b/lib/mediawiki.DOMPostProcessor.js
@@ -38,7 +38,7 @@
        // the articleID is not stable across article deletion/restore, while
        // the revisionID is.  So we're going to omit the articleID from the
        // parsoid API for now; uncomment if we find a use case.
-       //id: 'mw:articleId',
+       //  id: 'mw:articleId',
 
        // 'rev_revid' is used to set the overall subject of the document, we 
don't
        // need to add a specific <meta> or <link> element for it.
diff --git a/lib/mediawiki.DOMUtils.js b/lib/mediawiki.DOMUtils.js
index bf1786a..84759bc 100644
--- a/lib/mediawiki.DOMUtils.js
+++ b/lib/mediawiki.DOMUtils.js
@@ -413,9 +413,6 @@
                                fromsrc: false
                        };
                } else if ( dp.a[name] !== curVal ) {
-                       //console.log(name, node.getAttribute(name), 
node.attributes.name.value);
-                       //console.log(
-                       //              node.outerHTML, name, 
JSON.stringify([curVal, dp.a[name]]));
                        return {
                                value: curVal,
                                modified: true,
@@ -1571,7 +1568,6 @@
                                                        // transclusion output.
                                                        key = dp.cacheKey;
                                                }
-                                               //console.log(key);
 
                                                if (key) {
                                                        expAccum[key] = {
@@ -2356,10 +2352,9 @@
 DOMUtils.normalizeHTML = function( source ) {
        try {
                var body = this.normalizeIEW( this.parseHTML( source ).body );
-               //console.log(source, this.serializeChildren(body));
                var html = this.serializeChildren(body)
                        // a few things we ignore for now..
-                       //.replace(/\/wiki\/Main_Page/g, 'Main Page')
+                       //  .replace(/\/wiki\/Main_Page/g, 'Main Page')
                        // do not expect a toc for now
                        .replace(/<div[^>]+?id="toc"[^>]*>\s*<div 
id="toctitle">[\s\S]+?<\/div>[\s\S]+?<\/div>\s*/g, '');
                return this.normalizePhpOutput( html )
diff --git a/lib/mediawiki.Diff.js b/lib/mediawiki.Diff.js
index dc7119c..8226598 100644
--- a/lib/mediawiki.Diff.js
+++ b/lib/mediawiki.Diff.js
@@ -113,7 +113,7 @@
                        bsource = b.substring(pair[1].start - context, 
pair[1].end + context);
                results.push('++++++\n' + JSON.stringify(asource));
                results.push('------\n' + JSON.stringify(bsource));
-               //results.push('======\n' + Diff.htmlDiff(a, b, color, 
onlyReportChanges, useLines));
+               // results.push('======\n' + Diff.htmlDiff(a, b, color, 
onlyReportChanges, useLines));
        });
        if ( !onlyReportChanges || diff.length > 0 ) {
                return results.join('\n');
@@ -246,12 +246,12 @@
                        if ( change.added ) {
                                diffs++;
                                return change.value.split( '\n' ).map( 
function( line ) {
-                                       return line.green + '';//add '' to 
workaround color bug
+                                       return line.green + ''; //  add '' to 
workaround color bug
                                } ).join( '\n' );
                        } else if ( change.removed ) {
                                diffs++;
                                return change.value.split( '\n' ).map( 
function( line ) {
-                                       return line.red + '';//add '' to 
workaround color bug
+                                       return line.red + '';  // add '' to 
workaround color bug
                                } ).join( '\n' );
                        } else {
                                return change.value;
diff --git a/lib/mediawiki.HTML5TreeBuilder.node.js 
b/lib/mediawiki.HTML5TreeBuilder.node.js
index 615f1c5..ad80b1d 100644
--- a/lib/mediawiki.HTML5TreeBuilder.node.js
+++ b/lib/mediawiki.HTML5TreeBuilder.node.js
@@ -109,11 +109,9 @@
 // Adapt the token format to internal HTML tree builder format, call the actual
 // html tree builder by emitting the token.
 TreeBuilder.prototype.processToken = function(token) {
-       //console.warn( 'processToken: ' + JSON.stringify( token ));
-
        var attribs = token.attribs || [],
                // Always insert data-parsoid
-           dataAttribs = token.dataAttribs || {};
+               dataAttribs = token.dataAttribs || {};
 
        if ( this.inTransclusion ) {
                dataAttribs.inTransclusion = true;
diff --git a/lib/mediawiki.Title.js b/lib/mediawiki.Title.js
index 5ca11dd..c68dc16 100644
--- a/lib/mediawiki.Title.js
+++ b/lib/mediawiki.Title.js
@@ -54,7 +54,6 @@
        var nsText = text.split( ':', 1 )[0];
        if ( nsText && nsText !== text ) {
                var ns = env.conf.wiki.namespaceIds[ 
Util.normalizeNamespaceName(nsText) ];
-               //console.warn( JSON.stringify( [ nsText, ns ] ) );
                if ( ns !== undefined ) {
                        return new Title( text.substr( nsText.length + 1 ), ns, 
nsText, env );
                } else {
diff --git a/lib/mediawiki.TokenTransformManager.js 
b/lib/mediawiki.TokenTransformManager.js
index adab017..37d0d88 100644
--- a/lib/mediawiki.TokenTransformManager.js
+++ b/lib/mediawiki.TokenTransformManager.js
@@ -230,7 +230,7 @@
        }
 };
 
-//******************** Async token transforms: Phase 2 **********************//
+/********************* Async token transforms: Phase 2 ***********************/
 
 /**
  *
@@ -523,8 +523,6 @@
                return { tokens: tokens };
        }
 
-       //console.warn('AsyncTokenTransformManager.transformTokens: ' + 
JSON.stringify(tokens) );
-
        // New accumulator chain
        var accumChain = new AccumChain(this, parentCB);
 
@@ -576,13 +574,10 @@
 
                var ts = this._getTransforms( token, minRank );
 
-               //this.env.dp( 'async token:', accumChain.state.c, token, 
minRank, ts );
-
                if ( !ts.length ) {
                        // nothing to do for this token
                        accumChain.push( token );
                } else {
-                       //this.env.tp( 'async trans' );
                        var res, resTokens;
                        for (var j = 0, lts = ts.length; j < lts; j++ ) {
                                var transformer = ts[j];
@@ -599,8 +594,6 @@
 
                                res = accumChain.state.res;
                                resTokens = res.tokens;
-
-                               //this.env.dp( 'accumChain.state.res:', 
accumChain.state.c, res );
 
                                // Check the result, which is changed using the
                                // maybeSyncReturn callback
@@ -642,7 +635,7 @@
                                                // transformer to avoid loops 
and keep the
                                                // execution model sane.
                                                resTokens.rank = resTokens.rank 
|| transformer.rank;
-                                               //resTokens.rank = Math.max( 
resTokens.rank || 0, transformer.rank );
+                                               // resTokens.rank = Math.max( 
resTokens.rank || 0, transformer.rank );
                                                if ( res.async ) {
                                                        resTokens.inAsyncMode = 
true;
                                                        // don't trigger 
activeAccum switch / _makeNextAccum call below
@@ -673,7 +666,6 @@
                        if ( token !== null ) {
                                // token is done.
                                // push to accumulator
-                               //console.warn( 'pushing ' + token );
                                accumChain.push( token );
                        }
 
@@ -810,7 +802,7 @@
 };
 
 
-//************* In-order, synchronous transformer (phase 1 and 3) 
*************/
+/************** In-order, synchronous transformer (phase 1 and 3) 
*************/
 
 /**
  * Subclass for phase 3, in-order and synchronous processing.
@@ -892,23 +884,18 @@
                        ts = this._getTransforms( token, minRank ),
                        res = { token: token };
 
-               //this.env.dp( 'sync tok:', minRank, token.rank, token, ts );
-
                // Push the token through the transformations till it morphs
                var j = 0, numTransforms = ts.length;
                while (j < numTransforms && (token === res.token)) {
                        transformer = ts[j];
                        // Transform the token.
                        res = transformer.transform( token, this, 
this.prevToken );
-                       //this.env.dp( 'sync res0:', res );
                        j++;
                }
 
                if ( res.token && res.token !== token ) {
                        res = { tokens: [res.token] };
                }
-
-               //this.env.dp( 'sync res:', res );
 
                if ( res.tokens && res.tokens.length ) {
                        if ( token.constructor === EOFTk &&
@@ -960,7 +947,7 @@
 };
 
 
-//********************** AttributeTransformManager *************************//
+/*********************** AttributeTransformManager **************************/
 
 /**
  * Utility transformation manager for attributes, using an attribute
@@ -984,7 +971,7 @@
        this.callback = callback;
        this.outstanding = 1;
        this.kvs = [];
-       //this.pipe = manager.getAttributePipeline( manager.args );
+       // this.pipe = manager.getAttributePipeline( manager.args );
 }
 
 // A few constants
@@ -1095,7 +1082,7 @@
 };
 
 
-//******************************* TokenAccumulator *************************//
+/******************************** TokenAccumulator **************************/
 
 var tid = 0;
 
@@ -1268,7 +1255,6 @@
  * Mark the sibling as done (normally at the tail of a chain).
  */
 TokenAccumulator.prototype.siblingDone = function() {
-       //console.warn( 'TokenAccumulator.siblingDone: ' );
        this.receiveToksFromSibling( { tokens: [], async: false } );
 };
 
@@ -1306,7 +1292,7 @@
 };
 
 
-//****************************** Frame ******************************//
+/******************************* Frame *******************************/
 
 /**
  * @class
@@ -1454,15 +1440,12 @@
  */
 Frame.prototype.loopAndDepthCheck = function( title, maxDepth ) {
        // XXX: set limit really low for testing!
-       //console.warn( 'Loopcheck: ' + title + JSON.stringify( this, null, 2 ) 
);
        if ( this.depth > maxDepth ) {
                // too deep
-               //console.warn( 'Loopcheck: ' + JSON.stringify( this, null, 2 ) 
);
                return 'Error: Expansion depth limit exceeded at ';
        }
        var elem = this;
        do {
-               //console.warn( 'loop check: ' + title + ' vs ' + elem.title );
                if ( elem.title === title ) {
                        // Loop detected
                        return 'Error: Expansion loop detected at ';
@@ -1478,7 +1461,6 @@
                console.trace();
                console.warn('Error in Frame._getID: no cb in options!');
        } else {
-               //console.warn('getID: ' + options.cb);
                return options.cb( this );
        }
 };
diff --git a/lib/mediawiki.Util.js b/lib/mediawiki.Util.js
index 40e7490..bda94b4 100644
--- a/lib/mediawiki.Util.js
+++ b/lib/mediawiki.Util.js
@@ -772,7 +772,7 @@
                                                for ( var i = 0, l = 
toks.length; i < l; i++ ) {
                                                        
this.accum.push(toks[i]);
                                                }
-                                               //this.accum = 
this.accum.concat(toks);
+                                               // this.accum = 
this.accum.concat(toks);
                                        } else {
                                                this.accum.push(toks);
                                        }
@@ -1023,7 +1023,6 @@
                var host = s.match(/^[a-zA-Z]+:\/\/[^\/]+(?:\/|$)/),
                        path = s,
                        anchor = null;
-               //console.warn( 'host: ' + host );
                if ( host ) {
                        path = s.substr( host[0].length );
                        host = host[0];
diff --git a/lib/mediawiki.WikiConfig.js b/lib/mediawiki.WikiConfig.js
index e63ba1b..f21b613 100644
--- a/lib/mediawiki.WikiConfig.js
+++ b/lib/mediawiki.WikiConfig.js
@@ -264,13 +264,13 @@
        // This path isn't necessary because we don't need special page aliases.
        // Before you uncomment this, make sure you actually need it, and be 
sure to
        // also add 'specialpagealiases' back into the API request for the 
config.
-       //      var specials = resultConf.specialpagealiases;
-       //      for ( var sx = 0; sx < specials.length; sx++ ) {
-       //              aliases = specials[sx].aliases;
-       //              for ( var sax = 0; sax < aliases.length; sax++ ) {
-       //                      this.specialPages[aliases[sax]] = 
specials[sx].realname;
-       //              }
-       //      }
+       //  var specials = resultConf.specialpagealiases;
+       //  for ( var sx = 0; sx < specials.length; sx++ ) {
+       //      aliases = specials[sx].aliases;
+       //      for ( var sax = 0; sax < aliases.length; sax++ ) {
+       //              this.specialPages[aliases[sax]] = specials[sx].realname;
+       //      }
+       //  }
 
        // Regex for stripping useless stuff out of the regex messages
        var stripRegex = /^\/\^(.*)\$\//;
@@ -309,7 +309,6 @@
                }
 
                try {
-                       //console.warn('new regexp for ' + prefix + ': ' + 
regexResult);
                        return new RegExp( regexResult );
                } catch (e) {
                        console.error(e);
diff --git a/lib/mediawiki.WikitextSerializer.js 
b/lib/mediawiki.WikitextSerializer.js
index c9c2b49..3af5ef8 100644
--- a/lib/mediawiki.WikitextSerializer.js
+++ b/lib/mediawiki.WikitextSerializer.js
@@ -464,10 +464,10 @@
                                                } else if 
(opts.serializeAsNamed && k === "") {
                                                        // No spacing for blank 
parameters ({{foo|=bar}})
                                                        spc = ['', '', '', ''];
-                                               } //else {
+                                               } // else {
                                                        // TODO: match the 
space style of other/ parameters!
-                                                       //spc = ['', ' ', ' ', 
''];
-                                               //}
+                                                       // spc = ['', ' ', ' ', 
''];
+                                               // }
 
                                                // The name is usually equal to 
the parameter key, but
                                                // if there's a key.wt 
attribute, use that.
@@ -736,7 +736,6 @@
        }
 
        if ( dp.src !== undefined ) {
-               //console.log(node.parentNode.outerHTML);
                if (/(^|\s)mw:Placeholder(\/\w*)?$/.test(typeOf) ||
                                (typeOf === "mw:Nowiki" && node.textContent === 
dp.src )) {
                        // implement generic src round-tripping:
@@ -759,7 +758,6 @@
                                        if ( contentSrc === dp.srcContent ) {
                                                self.emitWikitext(dp.src, 
state, cb, node);
                                        } else {
-                                               //console.log(contentSrc, 
dp.srcContent);
                                                self.emitWikitext(contentSrc, 
state, cb, node);
                                        }
                                }
@@ -823,17 +821,16 @@
                // The PHP parser won't create paragraphs on lines that also 
contain
                // block-level tags.
                if (!state.inHTMLPre && 
(!DU.allChildrenAreText(node.parentNode) ||
-                       //node.parentNode.data.parsoid.stx !== 'html' ||
                        doubleNewlineCount !== 1)) {
                        // Strip more than one consecutive newline
                        res = res.replace(/\n([ \t]*\n)+/g, '\n');
                }
                // Strip trailing newlines from text content
-               //if (node.nextSibling && DU.isElt(node.nextSibling)) {
-               //      res = res.replace(/\n$/, ' ');
-               //} else {
-               //      res = res.replace(/\n$/, '');
-               //}
+               // if (node.nextSibling && DU.isElt(node.nextSibling)) {
+               //      res = res.replace(/\n$/, ' ');
+               // } else {
+               //      res = res.replace(/\n$/, '');
+               // }
 
                // Strip leading newlines and other whitespace
                // They are already added to the separator source in 
handleSeparatorText.
@@ -848,8 +845,6 @@
        state.escapeText = (state.onSOL || !state.currNodeUnmodified) && 
!state.inNoWiki && !state.inHTMLPre;
        cb(res, node);
        state.escapeText = false;
-
-       //console.log('text', JSON.stringify(res));
 
        // Move trailing newlines into the next separator
        if (newSepMatch) {
@@ -1192,7 +1187,6 @@
                                this._serializeTextNode(node, state, cb );
                                next = DU.nextNonSepSibling(node) || 
node.parentNode;
                                if (next) {
-                                       //console.log(next.outerHTML);
                                        this.updateSeparatorConstraints(state,
                                                        node, {},
                                                        next, 
this._getDOMHandler(next, state, cb));
diff --git a/lib/mediawiki.parser.defines.js b/lib/mediawiki.parser.defines.js
index 1e1dc9e..80f08e3 100644
--- a/lib/mediawiki.parser.defines.js
+++ b/lib/mediawiki.parser.defines.js
@@ -815,7 +815,6 @@
        requireUtil();
        var args = this.slice( start, end ),
                cb = options.cb;
-       //console.warn( JSON.stringify( args ) );
        async.map(
                args,
                function( kv, cb2 ) {
@@ -833,7 +832,6 @@
                                console.trace();
                                throw JSON.stringify( err );
                        }
-                       //console.warn( 'getSlice res: ' + JSON.stringify( res 
) );
                        cb( res );
                }
        );
diff --git a/lib/mediawiki.parser.environment.js 
b/lib/mediawiki.parser.environment.js
index c51447c..3d2f880 100644
--- a/lib/mediawiki.parser.environment.js
+++ b/lib/mediawiki.parser.environment.js
@@ -213,8 +213,8 @@
 };
 
 MWParserEnvironment.prototype.getVariable = function( varname, options ) {
-       //XXX what was the original author's intention?
-       //something like this?:
+       // XXX what was the original author's intention?
+       // something like this?:
        //  return this.options[varname];
        return this[varname];
 };
@@ -377,10 +377,10 @@
                }
        }
        splitNS();
-       //name = name.split(':').map( upperFirst ).join(':');
-       //if (name === '') {
-       //      throw new Error('Invalid/empty title');
-       //}
+       // name = name.split(':').map( upperFirst ).join(':');
+       // if (name === '') {
+       //      throw new Error('Invalid/empty title');
+       // }
        return forceNS + name;
 };
 
diff --git a/lib/mediawiki.parser.js b/lib/mediawiki.parser.js
index 07877d9..269d4a5 100644
--- a/lib/mediawiki.parser.js
+++ b/lib/mediawiki.parser.js
@@ -262,7 +262,7 @@
                }
                stages.push( stage );
        }
-       //console.warn( 'stages' + stages + JSON.stringify( stages ) );
+
        return new ParserPipeline(
                type,
                stages,
@@ -359,9 +359,7 @@
                // happen in resetState. We'd need to avoid doing so when 
called from
                // processToplevelDoc though, so lets do it here for now.
                pipe.removeAllListeners('chunk');
-               //console.log('got cached pipe', cacheKey, pipe.id);
        } else {
-               //console.log('making new pipe', cacheKey);
                options.cacheKey = cacheKey;
                pipe = this.makePipeline( type, options );
        }
@@ -384,8 +382,7 @@
  */
 ParserPipelineFactory.prototype.returnPipeline = function( cacheKey, pipe ) {
        // Clear all listeners, but do so after all other handlers have fired
-       //pipe.on('end', function() { pipe.removeAllListeners( ) });
-       //console.log('ret pipe', pipe.id);
+       // pipe.on('end', function() { pipe.removeAllListeners( ) });
        var cache = this.pipelineCache[cacheKey];
        if (!cache) {
                cache = this.pipelineCache[cacheKey] = [];
diff --git a/lib/mediawiki.tokenizer.peg.js b/lib/mediawiki.tokenizer.peg.js
index 2988e68..2c36b2f 100644
--- a/lib/mediawiki.tokenizer.peg.js
+++ b/lib/mediawiki.tokenizer.peg.js
@@ -161,9 +161,9 @@
        text = String(text || "");
 
        // Some input normalization: force a trailing newline
-       //if ( text.substring(text.length - 1) !== "\n" ) {
-       //      text += "\n";
-       //}
+       // if ( text.substring(text.length - 1) !== "\n" ) {
+       //      text += "\n";
+       // }
 
        var chunkCB = this.emit.bind( this, 'chunk' );
 
diff --git a/lib/mediawiki.tokenizer.utils.js b/lib/mediawiki.tokenizer.utils.js
index 233b85f..78a0b02 100644
--- a/lib/mediawiki.tokenizer.utils.js
+++ b/lib/mediawiki.tokenizer.utils.js
@@ -188,7 +188,6 @@
                        }
                        case '|': {
                                return stops.onStack('pipe') ||
-                                       //counters.template ||
                                        counters.linkdesc || (
                                                stops.onStack('table') && (
                                                        counters.tableCellArg 
|| (
diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index d4373cd..2642236 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -41,12 +41,10 @@
                 l = tokens.length;
 
             while (i < l) {
-                //console.warn('emitting partial chunk', i);
                 options.cb(tokens.slice(i, i + chunkLimit));
                 i += chunkLimit;
             }
         } else {
-            //console.warn('emitting single chunk', tokens.length);
             options.cb(tokens);
         }
     };
@@ -133,7 +131,6 @@
   / newline* eof {
         // Clear saved sol state!
         options.pegTokenizer.savedSOL = null;
-        // console.warn("-- EOF!");
         emitChunk( [ new EOFTk( ) ] );
 
         return { eof: true };
@@ -232,7 +229,6 @@
     // eat an empty line before the block
     s2:(os:optionalSpaceToken so:sol { return os.concat(so); })?
     bl:block_line {
-        //console.warn( 'bl', JSON.stringify(bl, null, 2) );
         var s2_ = (s2 !== null) ? s2 : [];
         return s.concat(s2_, bl);
     }
@@ -298,7 +294,6 @@
 
 inline
   = c:(urltext / (!inline_breaks !pre_start r:(inline_element / . ) { return 
r; }))+ {
-      //console.warn('inline out:' + pp(c));
       return tu.flatten_stringlist( c );
   }
 
@@ -445,12 +440,11 @@
               )?
         "]" {
             stops.pop('extlink');
-            //if ( text === '' ) {
-            //    // XXX: Link numbering should be implemented in 
post-processor.
-            //    text = [ "[" + linkCount + "]" ];
-            //    linkCount++;
-            //}
-            //console.warn( 'extlink text: ' + pp( text ) );
+            // if ( text === '' ) {
+            //     // XXX: Link numbering should be implemented in 
post-processor.
+            //     text = [ "[" + linkCount + "]" ];
+            //     linkCount++;
+            // }
             return [
                 new SelfclosingTagTk( 'extlink', [
                     new KV('href', target),
@@ -704,8 +698,6 @@
       // again.
       params.unshift( new KV(tu.flattenIfArray( target.tokens ), '', 
target.srcOffsets) );
       var obj = new SelfclosingTagTk( 'template', params, {tsr: 
[peg$reportedPos, peg$currPos], src: text()} );
-      //console.warn( 'tokenizer template ' + peg$currPos + );
-      //console.warn('template @' + peg$currPos + '::' + 
input.substr(peg$currPos, 40) );
       return obj;
     }
 
@@ -731,8 +723,6 @@
         params.unshift( new KV( '', '') );
       }
       var obj = new SelfclosingTagTk( 'templatearg', params, {tsr: 
[peg$reportedPos, peg$currPos], src: text()} );
-      //console.warn( 'tokenizer tplarg ' + JSON.stringify( obj, null, 2 ));
-      //console.warn('template arg @' + peg$currPos + '::' + 
input.substr(peg$currPos, 40) );
       return obj;
   }
 
@@ -750,7 +740,6 @@
             return { kEndPos: kEndPos, vStartPos: vStartPos, value: (tpv && 
tpv.tokens) || [] };
         }
     )? {
-      //console.warn( 'named template_param matched' + pp([name, value ]) );
       if ( val !== null ) {
           if ( val.value !== null ) {
             return new KV( name, tu.flattenIfArray( val.value ), 
[peg$reportedPos, val.kEndPos, val.vStartPos, peg$currPos] );
@@ -771,7 +760,6 @@
     tpt:(template_param_text / &'=' { return ''; })
     {
         stops.pop( 'equal' );
-        //console.warn( 'template param name matched: ' + pp( tpt ) );
         return tpt;
     }
 
@@ -784,7 +772,6 @@
     {
         stops.dec( 'nopre' );
         stops.pop( 'equal' );
-        //console.warn( 'template param value matched: ' + pp( tpt ) );
         return { tokens: tpt, srcOffsets: [peg$reportedPos, peg$currPos] };
     }
   / & { stops.dec( 'nopre' ); return stops.pop( 'equal' ); }
@@ -805,11 +792,9 @@
         stops.pop('extlink');
         stops.pop('pipe');
         stops.dec('template');
-        //console.warn( 'tpt match: ' + pp (il) + " stops: " + pp(stops));
         // il is guaranteed to be an array -- so, tu.flattenIfArray will
         // always return an array
         var r = tu.flattenIfArray( il );
-        //console.warn('tpl param name' + peg$currPos + r[0] + '::' + 
input.substr(peg$currPos, 40) );
         if ( r.length === 1 && r[0].constructor === String ) {
             r = r[0];
         }
@@ -846,7 +831,6 @@
       if ( lcontent === null ) {
           lcontent = { content: [] };
       }
-      //console.warn('lcontent: ' + JSON.stringify( lcontent, null, 2 ) );
 
       if ( target === null ) {
         var src = text();
@@ -859,7 +843,7 @@
           hrefKV = new KV('href', target);
       hrefKV.vsrc = input.substring(peg$reportedPos + 2, tpos);
       // XXX: Point to object with path, revision and input information
-      //obj.source = input;
+      // obj.source = input;
       obj.attribs.push(hrefKV);
       obj.attribs = obj.attribs.concat( lcontent.content );
       obj.dataAttribs = {
@@ -880,7 +864,6 @@
           r:( inline_element / '[' text_char+ ']' / . ) { return r; }
          )
     )+ {
-      // console.warn('inline out:' + 
JSON.stringify(tu.flatten_stringlist(c)));
       return tu.flatten_stringlist( c );
   }
 
@@ -891,7 +874,6 @@
     // '=' here.
     hs:( '=' link_text_fragment )?
     {
-        //console.warn('link_text' + pp(h) + pp(hs));
         stops.dec('linkdesc');
         if ( hs !== null ) {
             return h.concat(hs);
@@ -908,7 +890,6 @@
     // '=' here.
     hs:( '=' inline)?
     {
-        //console.warn('link_option' + pp(h) + pp(hs));
         stops.pop('pipe');
         stops.dec('linkdesc');
         if ( hs !== null ) {
@@ -998,7 +979,6 @@
 
 // Don't recognize tabs
 pre_indent_line = " " l:nested_block_line {
-    //console.warn( JSON.stringify( [s, l] ) );
     return [' '].concat(l);
 }
 
@@ -1202,7 +1182,6 @@
     nc:nowiki_content
     endTagStartPos:({return peg$currPos;})
     "</" nowiki_tag_name space* ">" {
-        // console.warn( 'full nowiki return: ' + pp(nc));
         return [
             new TagTk( 'span',
                     [
@@ -1220,7 +1199,6 @@
   // nowiki fallback: source-based round-tripping of <nowiki />.
   / nw0:({return peg$currPos;})
     "<" nowiki_tag_name space* "/" space* ">" {
-      // console.warn('<nowiki/>');
       return [
           new SelfclosingTagTk('meta',
                   [new KV('typeof', 'mw:Placeholder')],
@@ -1235,7 +1213,6 @@
   / ! { return stops.counters.pre > 0; }
     nw0:({return peg$currPos;})
     "<" "/"? nowiki_tag_name space* "/"? space* ">" {
-      // console.warn('nowiki text');
       var nowiki = input.substring(nw0, peg$currPos);
       return [
             new TagTk( 'span', [ new KV( 'typeof', 'mw:Placeholder' ) ], {
@@ -1252,23 +1229,19 @@
 // Should allow the </pre> in nowiki:
 //   <nowiki></pre></nowiki>
 pre_break = & "</pre>" {
-    //console.log( stops.counters );
     return stops.counters.pre > 0 ? undefined : peg$FAILED;
 }
 
 nowiki_content
   = ts:(   (htmlentity / [^&<]+)+
            / "<pre" p0:optionalSpaceToken p1:[^>]* ">" p2:nowiki_content 
"</pre>" {
-                 //console.warn('nested pre in nowiki');
                  return ["<pre"].concat(p0, p1, [">"], p2, 
["</pre>"]).join('');
                }
            / (!pre_break !("</" nowiki_tag_name space* ">") c:(htmlentity / .) 
{
-               //console.warn('nowiki: single char' + c);
                return c;
            })
        )* {
             // return nowiki tags as well?
-            //console.warn('nowiki_content: return' + pp(ts));
             return tu.flatten_stringlist(ts);
           }
 
@@ -1340,7 +1313,6 @@
     valueData:( space_or_newline*
         v:generic_attribute_newline_value { return v; })?
 {
-    //console.warn('generic_newline_attribute: ' + pp( name ))
     var res;
 
     // Encapsulate protected attributes.
@@ -1372,7 +1344,6 @@
     valueData:(optionalSpaceToken
         v:generic_attribute_value { return v; })?
 {
-    //console.warn( 'generic attribute: ' + pp([name, value]));
     // FIXME: name might just be a template, which can expand to a key-value
     // pair later. We'll need to handle that in the AttributeTransformManager.
     var res;
@@ -1620,8 +1591,7 @@
  
******************************************************************************/
 
 full_table_in_link_caption
-  = // & { console.warn('enter full_table_in_link_caption: ' + 
input.substr(peg$currPos, 20)); return true; }
-    (! inline_breaks / & '{{!}}' )
+  = (! inline_breaks / & '{{!}}' )
     r:(
         & { return stops.push('table', true); }
         tbl:(
@@ -1636,15 +1606,13 @@
     ) { return r; }
 
 table_lines
-  = // & { console.warn('enter table_lines: ' + input.substr(peg$currPos, 
20)); return true; }
-    (! inline_breaks / & '{{!}}' )
+  = (! inline_breaks / & '{{!}}' )
     r:(
         & { return stops.push('table', true); }
         tl:table_line
         nls:optionalNewlines
         {
             stops.pop('table');
-            // console.warn('table_lines: ' + JSON.stringify(tl.concat(nls)));
             return tl.concat(nls);
         }
       / & { return stops.pop('table'); }
@@ -1700,8 +1668,7 @@
     }
 
 table_row_tag
-  = // & { console.warn("table row enter @" + input.substr(peg$currPos, 30)); 
return true; }
-    // avoid recursion via nested_block_in_table
+  = // avoid recursion via nested_block_in_table
     ! { return stops.onStack('tableDataBlock'); }
     p:pipe dashes:"-"+
     & { return stops.push('table', false); }
@@ -1781,10 +1748,8 @@
     }
 
 table_data_tag
-  = // & { console.warn("table_data_tag enter @" + input.substr(peg$currPos, 
30)); return true; }
-    ! "}"
+  = ! "}"
     arg:row_syntax_table_args?
-    //& { console.warn("past attrib, pos=" + peg$currPos + 
input.substr(peg$currPos,10)); return true; }
     // use inline_breaks to break on tr etc
     tagEndPos:({return peg$currPos;})
     td:nested_block_in_table*
@@ -1793,8 +1758,7 @@
     }
 
 table_heading_tags
-  = //& { console.warn( 'th enter @' + input.substr(peg$currPos, 10)); return 
true; }
-    "!"
+  = "!"
     th:table_heading_tag
     ths:( pp:("!!" / pipe_pipe) tht:table_heading_tag {
             var da = tht[0].dataAttribs;
@@ -1808,7 +1772,6 @@
             return tht;
           }
     )* {
-        //console.warn( 'thts: ' + pp([th, ths]));
         th[0].dataAttribs.tsr[0]--; // include "!"
         return th.concat(ths);
     }
@@ -1819,7 +1782,6 @@
     tagEndPos:({return peg$currPos;})
     c:nested_block_in_table* {
         stops.pop('th');
-        //console.warn( 'table_heading_tag: ' + pp( [a, c] ) );
         return tu.buildTableTokens("th", "!", arg, [peg$reportedPos, 
tagEndPos], peg$currPos, c);
     }
     / & { return stops.pop('th'); }
@@ -1843,7 +1805,6 @@
   = & { return stops.push('pipe', true); }
     as:generic_attributes s:space* p:pipe {
         stops.pop('pipe');
-        //console.warn( 'tcargs' + JSON.stringify( as ) + " stops: " + 
pp(stops) );
         return [as, s, p];
     }
     / & { return stops.pop('pipe'); }
@@ -1857,7 +1818,6 @@
     & could_be_attribute
     as:generic_attributes s:space* p:pipe !pipe {
         stops.dec('tableCellArg');
-        //console.warn( 'tcargs' + JSON.stringify( as ) + " stops: " + 
pp(stops) );
         return [as, s, p];
     }
     / & { return stops.dec('tableCellArg'); }
@@ -1948,7 +1908,6 @@
 //text = t:[A-Za-z0-9,._ "?!\t-]+ { return t.join('') }
 
 htmlentity = "&" c:[#0-9a-zA-Z]+ ";" {
-    //return "&" + c.join('') + ";";
     var m = "&" + c.join('') + ";",
         cc = Util.decodeEntities(m);
     // if this is an invalid entity, don't tag it with 'mw:Entity'
@@ -2165,7 +2124,6 @@
     ) { return r; }
   )+
   {
-      //console.warn('prep');
       return tu.flatten_string( r );
   }
 
@@ -2196,7 +2154,6 @@
     / [{}&<\-] ) { return r; }
   )*
   {
-      //console.warn( 'double:' + pp(r) );
       return tu.flatten_string( r );
   }
 
@@ -2207,7 +2164,6 @@
     / [{}&<\-] ) { return r; }
   )*
   {
-      //console.warn( 'double:' + pp(r) );
       return tu.flatten_string( r );
   }
 
@@ -2222,13 +2178,11 @@
               // <hiddentext>generated with.. </hiddentext>
               / &generic_tag nb:nested_block_line { return nb; }
               / !(space_or_newline / [\[=>]) c:. {
-                    //console.warn( 'aptl: ' + pp(c) );
                     return c;
                 }
             ) { return t; }
       )+
   {
-      //console.warn('prep');
       return tu.flatten_string( r );
   }
 
diff --git a/lib/wts.LinkHandler.js b/lib/wts.LinkHandler.js
index 80c821e..541d290 100644
--- a/lib/wts.LinkHandler.js
+++ b/lib/wts.LinkHandler.js
@@ -204,7 +204,6 @@
                                        target.value = localPrefix + 
oldPrefix[1] + ':' + interWikiMatch[1];
                                }
                                // Else: preserve old encoding
-                               //console.log(oldPrefix[1], interWikiMatch);
                        } else if 
(/\bmw:PageProp\/Language\b/.test(rtData.type)) {
                                target.value = 
interWikiMatch.join(':').replace(/^:/, '');
                        } else if (rtData.isLocal) {
@@ -416,7 +415,7 @@
                // Special-case handling for template-affected sort keys
                // FIXME: sort keys cannot be modified yet, but if they are,
                // we need to fully shadow the sort key.
-               //if ( ! target.modified ) {
+               // if ( !target.modified ) {
                        // The target and source key was not modified
                        var sortKeySrc = 
state.serializer.serializedAttrVal(node, 'mw:sortKey');
                        if ( sortKeySrc.value !== null ) {
@@ -427,7 +426,7 @@
                                // structure as its return value?
                                linkData.content.fromsrc = true;
                        }
-               //}
+               // }
        } else if ( linkData.type === 'mw:PageProp/Language' ) {
                // Fix up the the content string
                // TODO: see if linkData can be cleaner!
diff --git a/lib/wts.SerializerState.js b/lib/wts.SerializerState.js
index eb08788..d9be844 100644
--- a/lib/wts.SerializerState.js
+++ b/lib/wts.SerializerState.js
@@ -164,7 +164,6 @@
                                // advance the child
                                child = child.nextSibling;
                        } else {
-                               //console.log('nextChild', nextChild && 
nextChild.outerHTML);
                                child = nextChild;
                        }
                }
diff --git a/lib/wts.TagHandlers.js b/lib/wts.TagHandlers.js
index 06186be..7a6ecee 100644
--- a/lib/wts.TagHandlers.js
+++ b/lib/wts.TagHandlers.js
@@ -339,7 +339,7 @@
                                        return {min: 1, max: 2};
                                }
                        },
-                       after: wtListEOL //id({min:1, max:2})
+                       after: wtListEOL
                }
        };
 }
@@ -535,7 +535,7 @@
                        before: function(node, otherNode) {
                                if ((otherNode === node.parentNode && 
otherNode.nodeName in {UL: 1, OL: 1}) ||
                                        (DU.isElt(otherNode) && 
DU.getDataParsoid( otherNode ).stx === 'html')) {
-                                       return {}; //{min:0, max:1};
+                                       return {};
                                } else {
                                        return {min: 1, max: 2};
                                }
@@ -978,7 +978,6 @@
                                        case 'mw:DiffMarker':
                                        case 'mw:Separator': {
                                                // just ignore it
-                                               //cb('');
                                                break;
                                        }
                                        default: {
diff --git a/lib/wts.separators.js b/lib/wts.separators.js
index b3a019a..6237584 100644
--- a/lib/wts.separators.js
+++ b/lib/wts.separators.js
@@ -158,11 +158,11 @@
                                state.onSOL = true;
                        }
 
-                       //if (!state.sep.lastSourceNode) {
-                       //      // FIXME: Actually set lastSourceNode when the 
source is
-                       //      // emitted / buildAndEmitSep is called!
-                       //      state.sep.lastSourceNode = node.previousSibling 
|| node.parentNode;
-                       //}
+                       // if (!state.sep.lastSourceNode) {
+                       //      // FIXME: Actually set lastSourceNode when the 
source is
+                       //      // emitted / buildAndEmitSep is called!
+                       //      state.sep.lastSourceNode = node.previousSibling 
|| node.parentNode;
+                       // }
                        return true;
                } else {
                        if (node.nodeValue.match(/^[ \t]*\n+\s*/)) {
@@ -171,11 +171,11 @@
                                // Same caveat about onSOL and <li> nodes (see 
WSP._serializeTextNode)
                                // applies here as well.
                                state.onSOL = true;
-                               //if (!state.sep.lastSourceNode) {
-                               //      // FIXME: Actually set lastSourceNode 
when the source is
-                               //      // emitted / buildAndEmitSep is called!
-                               //      state.sep.lastSourceNode = 
node.previousSibling || node.parentNode;
-                               //}
+                               // if (!state.sep.lastSourceNode) {
+                               //      // FIXME: Actually set lastSourceNode 
when the source is
+                               //      // emitted / buildAndEmitSep is called!
+                               //      state.sep.lastSourceNode = 
node.previousSibling || node.parentNode;
+                               // }
                        }
                        return false;
                }
@@ -297,7 +297,6 @@
  * constraints?
  */
 function mergeConstraints(env, oldConstraints, newConstraints) {
-       //console.log(oldConstraints);
        var res = {a: oldConstraints.a, b: newConstraints.b};
        res.min = Math.max(oldConstraints.min || 0, newConstraints.min || 0);
        res.max = Math.min(oldConstraints.max !== undefined ? 
oldConstraints.max : 2,
@@ -368,12 +367,12 @@
        if (state.sep.constraints) {
                // Merge the constraints
                state.sep.constraints = mergeConstraints(this.env, 
state.sep.constraints, nlConstraints);
-               //if (state.sep.lastSourceNode && 
DU.isText(state.sep.lastSourceNode) {
-               //      state.sep.lastSourceNode = nodeA;
-               //}
+               // if (state.sep.lastSourceNode && 
DU.isText(state.sep.lastSourceNode) {
+               //      state.sep.lastSourceNode = nodeA;
+               // }
        } else {
                state.sep.constraints = nlConstraints;
-               //state.sep.lastSourceNode = state.sep.lastSourceNode || nodeA;
+               // state.sep.lastSourceNode = state.sep.lastSourceNode || nodeA;
        }
 
        this.env.log('debug/wts/sep', function() {
@@ -390,7 +389,6 @@
                nodeB: nodeB
        };
 
-       //console.log('nlConstraints', state.sep.constraints);
 };
 
 function makeSepIndentPreSafe(state, sep, nlConstraints) {
@@ -581,7 +579,6 @@
                                }
                        } else {
                                /* jshint noempty: false */
-                               //console.log( prevNode.nodeValue, 
prevNode.parentNode.outerHTML);
                        }
                } else {
                        dsrA = DU.getDataParsoid( prevNode ).dsr;
@@ -636,7 +633,6 @@
 
                // FIXME: Maybe we shouldn't set dsr in the dsr pass if both 
aren't valid?
                if (Util.isValidDSR(dsrA) && Util.isValidDSR(dsrB)) {
-                       //console.log(prevNode.data.parsoid.dsr, 
node.data.parsoid.dsr);
                        // Figure out containment relationship
                        if (dsrA[0] <= dsrB[0]) {
                                if (dsrB[1] <= dsrA[1]) {
@@ -665,7 +661,6 @@
                        }
 
                        if (state.sep.lastSourceSep) {
-                               //console.log('lastSourceSep', 
state.sep.lastSourceSep);
                                sep = state.sep.lastSourceSep + sep;
                        }
                }
diff --git a/tests/bugSplit.js b/tests/bugSplit.js
index 9df6413..4720bfe 100755
--- a/tests/bugSplit.js
+++ b/tests/bugSplit.js
@@ -42,7 +42,7 @@
        }
 
        // Move bug report into the new dir so it doesn't clutter the base dir
-       //fs.renameSync( bugfileName, dirName + "/" + 
bugfileName.replace(/^.*\//, ''));
+       // fs.renameSync( bugfileName, dirName + "/" + 
bugfileName.replace(/^.*\//, ''));
 }
 
 function main() {
diff --git a/tests/client/client.js b/tests/client/client.js
index db6e3c3..efad2c1 100755
--- a/tests/client/client.js
+++ b/tests/client/client.js
@@ -132,7 +132,7 @@
                                lastCommit = cobj[1];
                                // convert the timestamp to UTC
                                lastCommitTime = new 
Date(cobj[2]).toISOString();
-                               //console.log( 'New commit: ', cobj[1], 
lastCommitTime );
+                               // console.log( 'New commit: ', cobj[1], 
lastCommitTime );
                                cb(null, cobj[1], lastCommitTime);
                        }
                } );
diff --git a/tests/mocha/apitest.localsettings.js 
b/tests/mocha/apitest.localsettings.js
index e071d93..d688412 100644
--- a/tests/mocha/apitest.localsettings.js
+++ b/tests/mocha/apitest.localsettings.js
@@ -11,7 +11,7 @@
        // The URL of your MediaWiki API endpoint. Optionally, you can also pass
        // in a proxy specific to this prefix (overrides defaultAPIProxyURI), or
        // null to disable proxying for this end point.
-       //parsoidConfig.setInterwiki( 'localhost', 'http://localhost/w/api.php' 
);
+       //  parsoidConfig.setInterwiki( 'localhost', 
'http://localhost/w/api.php' );
        if ( process.env.PARSOID_MOCKAPI_URL ) {
                parsoidConfig.setInterwiki( 'localhost', 
process.env.PARSOID_MOCKAPI_URL );
        }
@@ -19,17 +19,17 @@
        // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
        // for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
        // 'enwikivoyage' etc. (default true)
-       //parsoidConfig.loadWMF = false;
+       //  parsoidConfig.loadWMF = false;
 
        // A default proxy to connect to the API endpoints. Default: undefined
        // (no proxying). Overridden by per-wiki proxy config in setInterwiki.
-       //parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080';
+       //  parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080';
 
        // Enable debug mode (prints extra debugging messages)
-       //parsoidConfig.debug = true;
+       //  parsoidConfig.debug = true;
 
        // Use the PHP preprocessor to expand templates via the MW API (default 
true)
-       //parsoidConfig.usePHPPreProcessor = false;
+       //  parsoidConfig.usePHPPreProcessor = false;
 
        // Use selective serialization (default false)
        parsoidConfig.useSelser = true;
@@ -37,26 +37,26 @@
        // Allow cross-domain requests to the API (default '*')
        // Sets Access-Control-Allow-Origin header
        // disable:
-       //parsoidConfig.allowCORS = false;
+       //  parsoidConfig.allowCORS = false;
        // restrict:
-       //parsoidConfig.allowCORS = 'some.domain.org';
+       //  parsoidConfig.allowCORS = 'some.domain.org';
 
        // Allow override of port/interface:
-       //parsoidConfig.serverPort = 8000;
-       //parsoidConfig.serverInterface = '127.0.0.1';
+       //  parsoidConfig.serverPort = 8000;
+       //  parsoidConfig.serverInterface = '127.0.0.1';
 
        // The URL of your LintBridge API endpoint
-       //parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
+       //  parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
 
        // Require SSL certificates to be valid (default true)
        // Set to false when using self-signed SSL certificates
-       //parsoidConfig.strictSSL = false;
+       //  parsoidConfig.strictSSL = false;
 
        // Use a different server for CSS style modules.
        // Set to true to use bits.wikimedia.org, or to a string with the URI.
        // Leaving it undefined (the default) will use the same URI as the MW 
API,
        // changing api.php for load.php.
-       //parsoidConfig.modulesLoadURI = true;
+       //  parsoidConfig.modulesLoadURI = true;
 
        // Set to true to enable Performance timing
        parsoidConfig.useDefaultPerformanceTimer = false;
diff --git a/tests/mockAPI.js b/tests/mockAPI.js
index 0631a70..c1e2c19 100644
--- a/tests/mockAPI.js
+++ b/tests/mockAPI.js
@@ -10,8 +10,8 @@
 // configuration to match PHP parserTests
 var IMAGE_BASE_URL = 'http://example.com/images';
 var IMAGE_DESC_URL = IMAGE_BASE_URL;
-//IMAGE_BASE_URL='http://upload.wikimedia.org/wikipedia/commons';
-//IMAGE_DESC_URL='http://commons.wikimedia.org/wiki';
+// IMAGE_BASE_URL='http://upload.wikimedia.org/wikipedia/commons';
+// IMAGE_DESC_URL='http://commons.wikimedia.org/wiki';
 var FILE_PROPS = {
        'Foobar.jpg': {
                size: 7881, width: 1941, height: 220, bits: 8, mime: 
'image/jpeg'
diff --git a/tests/parserTests-whitelist.js b/tests/parserTests-whitelist.js
index 42105be..9e4c033 100644
--- a/tests/parserTests-whitelist.js
+++ b/tests/parserTests-whitelist.js
@@ -38,7 +38,7 @@
 
 // We preserve the trailing whitespace in a table cell, while the PHP parser
 // strips it. It renders the same, and round-trips with the space.
-//testWhiteList["Table rowspan"] = "<table border=\"1\" 
data-parsoid=\"{&quot;tsr&quot;:[0,11],&quot;bsp&quot;:[0,121]}\">\n<tbody><tr><td
 data-parsoid=\"{&quot;tsr&quot;:[12,13]}\"> Cell 1, row 1 \n</td><td 
rowspan=\"2\" data-parsoid=\"{&quot;tsr&quot;:[29,40]}\"> Cell 2, row 1 (and 2) 
\n</td><td data-parsoid=\"{&quot;tsr&quot;:[64,65]}\"> Cell 3, row 1 
\n</td></tr><tr data-parsoid=\"{&quot;tsr&quot;:[81,84]}\">\n<td 
data-parsoid=\"{&quot;tsr&quot;:[85,86]}\"> Cell 1, row 2 \n</td><td 
data-parsoid=\"{&quot;tsr&quot;:[102,103]}\"> Cell 3, row 2 
\n</td></tr></tbody></table>";
+// testWhiteList["Table rowspan"] = "<table border=\"1\" 
data-parsoid=\"{&quot;tsr&quot;:[0,11],&quot;bsp&quot;:[0,121]}\">\n<tbody><tr><td
 data-parsoid=\"{&quot;tsr&quot;:[12,13]}\"> Cell 1, row 1 \n</td><td 
rowspan=\"2\" data-parsoid=\"{&quot;tsr&quot;:[29,40]}\"> Cell 2, row 1 (and 2) 
\n</td><td data-parsoid=\"{&quot;tsr&quot;:[64,65]}\"> Cell 3, row 1 
\n</td></tr><tr data-parsoid=\"{&quot;tsr&quot;:[81,84]}\">\n<td 
data-parsoid=\"{&quot;tsr&quot;:[85,86]}\"> Cell 1, row 2 \n</td><td 
data-parsoid=\"{&quot;tsr&quot;:[102,103]}\"> Cell 3, row 2 
\n</td></tr></tbody></table>";
 
 // The PHP parser strips the hash fragment for non-existent pages, but Parsoid 
does not.
 // TODO: implement link target detection in a DOM postprocessor or on the 
client
@@ -55,10 +55,10 @@
 
 // Very minor whitespace difference at end of cell (MediaWiki inserts a
 // newline before the close tag even if there was no trailing space in the 
cell)
-//testWhiteList["Table rowspan"] = "<table border=\"1\"><tbody><tr><td> Cell 
1, row 1 </td><td rowspan=\"2\"> Cell 2, row 1 (and 2) </td><td> Cell 3, row 1 
</td></tr><tr><td> Cell 1, row 2 </td><td> Cell 3, row 2 
</td></tr></tbody></table>";
+// testWhiteList["Table rowspan"] = "<table border=\"1\"><tbody><tr><td> Cell 
1, row 1 </td><td rowspan=\"2\"> Cell 2, row 1 (and 2) </td><td> Cell 3, row 1 
</td></tr><tr><td> Cell 1, row 2 </td><td> Cell 3, row 2 
</td></tr></tbody></table>";
 
 // Inter-element whitespace only
-//testWhiteList["Indented table markup mixed with indented pre content 
(proposed in bug 6200)"] = "   \n\n<table><tbody><tr><td><pre>\nText that 
should be rendered preformatted\n</pre></td></tr></tbody></table>";
+// testWhiteList["Indented table markup mixed with indented pre content 
(proposed in bug 6200)"] = "   \n\n<table><tbody><tr><td><pre>\nText that 
should be rendered preformatted\n</pre></td></tr></tbody></table>";
 
 
 /* Misc sanitizer / HTML5 differences */
diff --git a/tests/parserTests.js b/tests/parserTests.js
index bc5c5bc..b72d212 100755
--- a/tests/parserTests.js
+++ b/tests/parserTests.js
@@ -392,7 +392,7 @@
  */
 ParserTests.prototype.processArticle = function( item, cb ) {
        var norm = this.env.normalizeTitle(item.title);
-       //console.log( 'processArticle ' + norm );
+       // console.log( 'processArticle ' + norm );
        this.articles[norm] = item.text;
        setImmediate( cb );
 };
@@ -1883,7 +1883,7 @@
                item.cachedBODY = null;
                item.cachedNormalizedHTML = null;
 
-               //console.log( 'processCase ' + i + JSON.stringify( item )  );
+               // console.log( 'processCase ' + i + JSON.stringify( item )  );
                if ( typeof item === 'object' ) {
                        switch (item.type) {
                                case 'article': {
diff --git a/tests/roundtrip-test.js b/tests/roundtrip-test.js
index 2290351..9d545ed 100755
--- a/tests/roundtrip-test.js
+++ b/tests/roundtrip-test.js
@@ -317,7 +317,7 @@
                str = str.replace(/ +/g, " ");
                // Eliminate spaces around wikitext chars
                // gwicke: disabled for now- too aggressive IMO
-               //str = str.replace(/([<"'!#\*:;+-=|{}\[\]\/]) /g, "$1");
+               // str = str.replace(/([<"'!#\*:;+-=|{}\[\]\/]) /g, "$1");
                // Ignore capitalization of tags and void tag indications
                str = str.replace(/<(\/?)([^ >\/]+)((?:[^>\/]|\/(?!>))*)\/?>/g, 
function(match, close, name, remaining) {
                        return '<' + close + name.toLowerCase() + 
remaining.replace(/ $/, '') + '>';
@@ -383,7 +383,7 @@
                // compute wt diffs
                var wt1 = src.substring( offset[0].start, offset[0].end );
                var wt2 = out.substring( offset[1].start, offset[1].end );
-               //thisResult.wtDiff = Util.contextDiff(wt1, wt2, false, true, 
true);
+               // thisResult.wtDiff = Util.contextDiff(wt1, wt2, false, true, 
true);
 
                // Get diff substrings from offsets
                /* jshint loopfunc: true */ // this function doesn't use loop 
variables
@@ -409,7 +409,7 @@
                                normWT2 = normalizeWikitext(wt2);
 
                        if ( normWT1 !== normWT2 ) {
-                               //console.log( 'normDiff: =======\n' + normWT1 
+ '\n--------\n' + normWT2);
+                               // console.log( 'normDiff: =======\n' + normWT1 
+ '\n--------\n' + normWT2);
                                thisResult.htmlDiff = diff;
                                thisResult.type = 'fail';
                                // Provide context for semantic diffs
@@ -718,8 +718,9 @@
 
        if ( title ) {
                callback = cbCombinator.bind( null,
-                                             Util.booleanOption( argv.xml ) ?
-                                             xmlCallback : plainCallback, 
consoleOut );
+                       Util.booleanOption( argv.xml ) ?
+                               xmlCallback : plainCallback, consoleOut
+               );
                if ( !argv.parsoidURL ) {
                        // Start our own Parsoid server
                        // TODO: This will not be necessary once we have a 
top-level testing
diff --git a/tests/rttest.localsettings.js b/tests/rttest.localsettings.js
index 75d9c9f..422ce2b 100644
--- a/tests/rttest.localsettings.js
+++ b/tests/rttest.localsettings.js
@@ -11,7 +11,7 @@
        // The URL of your MediaWiki API endpoint. Optionally, you can also pass
        // in a proxy specific to this prefix (overrides defaultAPIProxyURI), or
        // null to disable proxying for this end point.
-       //parsoidConfig.setInterwiki( 'localhost', 'http://localhost/w/api.php' 
);
+       //  parsoidConfig.setInterwiki( 'localhost', 
'http://localhost/w/api.php' );
        if ( process.env.PARSOID_MOCKAPI_URL ) {
                parsoidConfig.setInterwiki( 'localhost', 
process.env.PARSOID_MOCKAPI_URL );
        }
@@ -19,44 +19,44 @@
        // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
        // for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
        // 'enwikivoyage' etc. (default true)
-       //parsoidConfig.loadWMF = false;
+       //  parsoidConfig.loadWMF = false;
 
        // A default proxy to connect to the API endpoints. Default: undefined
        // (no proxying). Overridden by per-wiki proxy config in setInterwiki.
-       //parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080';
+       //  parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080';
 
        // Enable debug mode (prints extra debugging messages)
-       //parsoidConfig.debug = true;
+       //  parsoidConfig.debug = true;
 
        // Use the PHP preprocessor to expand templates via the MW API (default 
true)
-       //parsoidConfig.usePHPPreProcessor = false;
+       //  parsoidConfig.usePHPPreProcessor = false;
 
        // Use selective serialization (default false)
-       //parsoidConfig.useSelser = true;
+       //  parsoidConfig.useSelser = true;
 
        // Allow cross-domain requests to the API (default '*')
        // Sets Access-Control-Allow-Origin header
        // disable:
-       //parsoidConfig.allowCORS = false;
+       //  parsoidConfig.allowCORS = false;
        // restrict:
-       //parsoidConfig.allowCORS = 'some.domain.org';
+       //  parsoidConfig.allowCORS = 'some.domain.org';
 
        // Allow override of port/interface:
-       //parsoidConfig.serverPort = 8000;
-       //parsoidConfig.serverInterface = '127.0.0.1';
+       //  parsoidConfig.serverPort = 8000;
+       //  parsoidConfig.serverInterface = '127.0.0.1';
 
        // The URL of your LintBridge API endpoint
-       //parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
+       //  parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
 
        // Require SSL certificates to be valid (default true)
        // Set to false when using self-signed SSL certificates
-       //parsoidConfig.strictSSL = false;
+       //  parsoidConfig.strictSSL = false;
 
        // Use a different server for CSS style modules.
        // Set to true to use bits.wikimedia.org, or to a string with the URI.
        // Leaving it undefined (the default) will use the same URI as the MW 
API,
        // changing api.php for load.php.
-       //parsoidConfig.modulesLoadURI = true;
+       //  parsoidConfig.modulesLoadURI = true;
 
        // Set rtTestMode to true for round-trip testing
        parsoidConfig.rtTestMode = true;
diff --git a/tests/server/server.js b/tests/server/server.js
index e9b103e..43a9fa6 100755
--- a/tests/server/server.js
+++ b/tests/server/server.js
@@ -379,23 +379,25 @@
 // Limit to 100 recent commits
 var dbCommits =
        'SELECT hash, timestamp ' +
-       //// get the number of fixes column
-       //      '(SELECT count(*) ' +
-       //      'FROM pages ' +
-       //              'JOIN stats AS s1 ON s1.page_id = pages.id ' +
-       //              'JOIN stats AS s2 ON s2.page_id = pages.id ' +
-       //      'WHERE s1.commit_hash = (SELECT hash FROM commits c2 where 
c2.timestamp < c1.timestamp ORDER BY timestamp DESC LIMIT 1 ) ' +
-       //              'AND s2.commit_hash = c1.hash AND s1.score < s2.score) 
as numfixes, ' +
-       //// get the number of regressions column
-       //      '(SELECT count(*) ' +
-       //      'FROM pages ' +
-       //              'JOIN stats AS s1 ON s1.page_id = pages.id ' +
-       //              'JOIN stats AS s2 ON s2.page_id = pages.id ' +
-       //      'WHERE s1.commit_hash = (SELECT hash FROM commits c2 where 
c2.timestamp < c1.timestamp ORDER BY timestamp DESC LIMIT 1 ) ' +
-       //              'AND s2.commit_hash = c1.hash AND s1.score > s2.score) 
as numregressions, ' +
-       //
-       //// get the number of tests for this commit column
-       //      '(select count(*) from stats where stats.commit_hash = c1.hash) 
as numtests ' +
+       /*
+       // get the number of fixes column
+               '(SELECT count(*) ' +
+               'FROM pages ' +
+                       'JOIN stats AS s1 ON s1.page_id = pages.id ' +
+                       'JOIN stats AS s2 ON s2.page_id = pages.id ' +
+               'WHERE s1.commit_hash = (SELECT hash FROM commits c2 where 
c2.timestamp < c1.timestamp ORDER BY timestamp DESC LIMIT 1 ) ' +
+                       'AND s2.commit_hash = c1.hash AND s1.score < s2.score) 
as numfixes, ' +
+       // get the number of regressions column
+               '(SELECT count(*) ' +
+               'FROM pages ' +
+                       'JOIN stats AS s1 ON s1.page_id = pages.id ' +
+                       'JOIN stats AS s2 ON s2.page_id = pages.id ' +
+               'WHERE s1.commit_hash = (SELECT hash FROM commits c2 where 
c2.timestamp < c1.timestamp ORDER BY timestamp DESC LIMIT 1 ) ' +
+                       'AND s2.commit_hash = c1.hash AND s1.score > s2.score) 
as numregressions, ' +
+
+       // get the number of tests for this commit column
+               '(select count(*) from stats where stats.commit_hash = c1.hash) 
as numtests ' +
+       */
        'FROM commits c1 ' +
        'ORDER BY timestamp DESC LIMIT 100';
 
@@ -656,8 +658,8 @@
        var trans = db.startTransaction();
        // console.warn("got: " + JSON.stringify([title, commitHash, result, 
skipCount, failCount, errorCount]));
        if ( errorCount > 0 && dneError ) {
-               // Page fetch error, increment the fetch error count so, when 
it goes over
-               /// maxFetchRetries, it won't be considered for tests again.
+               // Page fetch error, increment the fetch error count so, when 
it goes
+               // over maxFetchRetries, it won't be considered for tests again.
                console.log( 'XX', prefix + ':' + title );
                trans.query( dbIncrementFetchErrorCount, [commitHash, title, 
prefix],
                        transUpdateCB.bind( null, title, prefix, commitHash, 
"page fetch error count", res, trans, null ) )
diff --git a/tests/sync-parserTests.js b/tests/sync-parserTests.js
index 1a7d7f0..c634926 100755
--- a/tests/sync-parserTests.js
+++ b/tests/sync-parserTests.js
@@ -144,8 +144,8 @@
        console.log(' git review');
 
        // XXX to rebase semi-automatically, we might do something like:
-       //mwexec('git rebase origin/master'.split(' '))(function(err, code) {
-       //});
+       //  mwexec('git rebase origin/master'.split(' '))(function(err, code) {
+       //  });
        // XXX but it seems rather confusing to do it this way, since the
        // current working directory when we finish is still parsoid.
 

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

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