Refine wikitext escaping for template parameters

Take into account the position of the string token within the parameter token
array, and escape generic [{}] less aggressively in the middle of a parameter.

Added a parser test to ensure we don't escape too agressively.

Fixes
node roundtrip-test.js --prefix zh 'HUNTER×HUNTER角色列表'
echo '{{echo|{{echo| }}[bar]}}' | node parse --wt2wt

Change-Id: If1d1775225647e17db93c460144af2650d801648
Merge "Refine wikitext escaping for template parameters"