r92656 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92655‎ | r92656 | r92657 >
Date:18:31, 20 July 2011
Author:brion
Status:ok
Tags:
Comment:
ParserPlayground: round-tripping fixes for whitespace in extlinks, ref
Modified paths:
  • /trunk/extensions/ParserPlayground/modules/ext.parserPlayground.serializer.js (modified) (history)
  • /trunk/extensions/ParserPlayground/modules/pegParser.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserPlayground/modules/ext.parserPlayground.serializer.js
@@ -81,6 +81,9 @@
8282 }
8383 }
8484 }
 85+ if ('ws' in tree) {
 86+ src += tree.ws;
 87+ }
8588 if ('content' in tree) {
8689 src += '>';
8790 src += subParseArray(tree.content);
Index: trunk/extensions/ParserPlayground/modules/pegParser.pegjs.txt
@@ -133,7 +133,7 @@
134134 = c:[^\n]+ { return c.join(''); }
135135
136136 extlink
137 - = "[" target:url space text:extlink_text "]" {
 137+ = "[" target:url " " text:extlink_text "]" {
138138 return {
139139 type: 'extlink',
140140 target: target,
@@ -240,28 +240,34 @@
241241 ref = ref_full / ref_empty
242242
243243 ref_full
244 - = params:ref_start ">" content:ref_content+ close:ref_end {
 244+ = start:ref_start ">" content:ref_content+ close:ref_end {
245245 return {
246246 type: 'ext',
247247 name: 'ref',
248 - params: params,
 248+ params: start.params,
 249+ ws: start.ws,
249250 content: content,
250251 close: close
251252 }
252253 }
253254
254255 ref_empty
255 - = params:ref_start "/>" {
 256+ = start:ref_start close:(space* "/>") {
256257 return {
257258 type: 'ext',
258259 name: 'ref',
259 - params: params
 260+ ws: start.ws,
 261+ params: start.params,
 262+ close: close
260263 }
261264 }
262265
263266 ref_start
264 - = "<ref" params:ext_param* space* {
265 - return params;
 267+ = "<ref" params:ext_param* ws:space* {
 268+ return {
 269+ params: params,
 270+ ws: ws
 271+ };
266272 }
267273
268274 ref_end

Status & tagging log