Bug 50587: Parse template parameters to DOM or other non-wikitext types
where possible

Output template args as encoded HTML in data-mw:parts.template.params.

New blacklisted result: References: 6. <references /> from a transclusion
(html2html) due to parserTests not knowing how to normalize the about
attribute inside an HTML template parameter.

Change-Id: Idba17c0b2276ee1117d86abcc6aae40989c3ba38
Bug 50587: Serialize DOM template parameters back to wikitext

Parse transclusion parameters from data-mw:parts.template.params.html
if no wikitext parameter present.

Change-Id: I8e4ec1cf1fb4da10b5bd57b50bd5eff8fc73717f
DOM tpl params: Avoid going async if all params are simple

If the param is composed by just strings, comments and newlines,
which would produce the same text as the wikitext, we can skip
going into a sub-pipeline to get the html.

Change-Id: Id2d068da3df45b5ecb7bba3dfff83c0a1b86449f
Refresh the blacklist with HTML parameters

Change-Id: I6e75c0ccc3f1b8f656446c78a0830821b2568310
Minor cleanup: move helpers out of _onChunk

Change-Id: Id7cf151912bc9d60f0931b7c7a3d2a742130a0d7
Move phase end rank handling out of the TokenAccumulator

We'd like to generalize the TokenAccumulator so that it can be used more
generically where async expansions are initiated in token transformers. One
example of such a transformer is the TemplateHandler.

This patch works towards this goal with several parts:

* Track down problematic callers with env.log

* Set the phaseEndRank in AccumChain.push, maybeSyncReturn,
  TemplateHandler._onEnd/._onChunk and a few other places.

Overall most, but not all, broken callers of TokenAccumulator are fixed by
this patch. Once we have fixed all callers we can remove the phaseEndRank
logic from TokenAccumulator.

Change-Id: I26b66fb53ad1b44df6ac60bc6783d46d2efbcf9b
Small optimization: Concat child and sibling chunk

Concat child and sibling chunks if the child is done and the ranks of child
and sibling are matching.

Change-Id: I7c67bc699c632d4c7dfa788414612a75279855b8
TemplateHandler: Process template parameters while waiting for template
expansion

Change-Id: I59205bbbbeb11688db7fa339f2d56294dc95cdab
TemplateHandler: Add a flag to skip processing tpl params to HTML

New flag in localsettings addHTMLTemplateParameters, defaults to
false. When true, template parameters are processed to HTML.

Also reverted parserTests and blacklist so that tests pass without HTML
parameters.

Change-Id: I71b6666787fcedca7e0729eeeba5eaa237d84867
Move data-mw-arginfo to dataAttribs

Change-Id: I1f26222a933341b2746008a8f1f23282c478cb7d
Merge branch 'dom_tpl_params_4'

Some additional changes as part of the merge commit

* Fixed how {{{arg}}} wikitext was being encapsulated to
  be more in line with master.

* Reverted some incorrect changes to parserTests.txt

* Stripped srcOffsets from data-parsoid of transclusion data-mw
  target node (this eliminated spurious parserTests and blacklist
  changes).

* Updated blacklist to reflect changes.
  Most of the 101 wt2html changes are because of:
  - #mwt id changes.

  - id attribute not added on mw:Transclusion wrappers anymore.
    * --filter "Bug 529"
    * ... and possibly others ...

  - mw:Transclusion typeof added on all magicword transclusions
    like {{CURRENTMONTH1}}, {{TALKSPACE}}, etc.
    * This probably needs checking separately if this is okay
      since there is no source available for it and previously,
      these were just plain mw:Placeholder spans. Now, they get
      both.

  - Some (originally failing wt2html) tests now parse better in
    the branch than on master.
    * --filter "bug 3298"
    * --filter "Template with invalid target containing"
    * --filter "Template with targets containing wikilinks"
    * ... and possibly others ...

  - Improved template wrapping on several tests where a containing
    <p> tag gets mw:Transclusion typeof instead of all its children
    getting wrapped individually (curious what caused this)
    * -- filter "Special:Search page linking"
    * -- filter "Strip marker in grammar"
    * ... and many others ...

  - Improvements to autoInsertedStart/End flags on some tests (not
    sure how that happened).
    * -- filter "BUG 529"
    * ... and possibly others ...

  The wt2wt and selser changes are because of wt2html changes above.
  Nothing concerning.

Change-Id: I3fac26410b3cb74ddf4ea8a337e407190127b3d7
Merge "Merge branch 'dom_tpl_params_4'"