Index: trunk/extensions/ParserPlayground/modules/ext.parserPlayground.renderer.js |
— | — | @@ -23,6 +23,13 @@ |
24 | 24 | }); |
25 | 25 | }; |
26 | 26 | var node; |
| 27 | + if (typeof tree == "string") { |
| 28 | + // hack |
| 29 | + tree = { |
| 30 | + type: 'text', |
| 31 | + text: tree |
| 32 | + } |
| 33 | + } |
27 | 34 | switch (tree.type) { |
28 | 35 | case 'page': |
29 | 36 | // A sequence of block-level elements... |
— | — | @@ -78,11 +85,16 @@ |
79 | 86 | var t = $('<span class="parseNode template"></span>').text('{{' + tree.target); |
80 | 87 | if ('params' in tree) { |
81 | 88 | $.each(tree.params, function(i, param) { |
82 | | - var str = param.contents; |
| 89 | + var str; |
83 | 90 | if ('name' in param) { |
84 | | - str = param.name + '=' + str; |
| 91 | + str = param.name + '='; |
| 92 | + } else { |
| 93 | + str = ''; |
85 | 94 | } |
86 | 95 | var p = $('<span></span>').text('|' + str); |
| 96 | + if ('contents' in param && param.contents) { |
| 97 | + subParseArray(param.contents, p); |
| 98 | + } |
87 | 99 | t.append(p); |
88 | 100 | }); |
89 | 101 | } |
Index: trunk/extensions/ParserPlayground/modules/ext.parserPlayground.serializer.js |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | if ('name' in param) { |
100 | 100 | src += param.name + '='; |
101 | 101 | } |
102 | | - src += param.contents; |
| 102 | + src += subParseArray(param.contents); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | src += '}}'; |
Index: trunk/extensions/ParserPlayground/modules/pegParser.pegjs.txt |
— | — | @@ -177,8 +177,19 @@ |
178 | 178 | = h:( !"}}" x:([^=|]) { return x } )* { return h.join(''); } |
179 | 179 | |
180 | 180 | template_param_text |
181 | | - = h:( !"}}" x:([^|]) { return x } )* { return h.join(''); } |
| 181 | + = template_param_text_chunk* |
| 182 | +/* = h:( !"}}" x:([^|]) { return x } )* { return h.join(''); }*/ |
182 | 183 | |
| 184 | +template_param_text_chunk |
| 185 | + = comment |
| 186 | + / ref |
| 187 | + / extlink |
| 188 | + / template |
| 189 | + / link |
| 190 | + / bold |
| 191 | + / italic |
| 192 | + / !"}}" x:([^|]) { return x } |
| 193 | + |
183 | 194 | link |
184 | 195 | = "[[" target:link_target text:("|" link_text)* "]]" { |
185 | 196 | var obj = { |