r107060 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107059‎ | r107060 | r107061 >
Date:11:58, 22 December 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Re-add support for row-only tables.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt
@@ -1031,16 +1031,22 @@
10321032 "|-"
10331033 a:generic_attribute*
10341034 space*
 1035+ // handle tables with missing table cells after a row
 1036+ td:( s:sol !'!' tdt:table_data_tag { return s.concat(tdt); } )?
10351037 {
10361038 // We rely on our tree builder to close the row as needed. This is
10371039 // needed to support building tables from fragment templates with
10381040 // individual cells or rows.
1039 - return [{type: 'TAG', name: 'tr', attribs: a}];
 1041+ var trToken = [{type: 'TAG', name: 'tr', attribs: a}];
 1042+ if ( !td ) {
 1043+ return trToken;
 1044+ } else {
 1045+ return trToken.concat(td);
 1046+ }
10401047 }
10411048
10421049 table_data_tags
1043 - = //("|" / !'!') // move the missing-'|' case to table_row_tag!
1044 - "|"
 1050+ = "|"
10451051 td:table_data_tag
10461052 tds:( "||" tdt:table_data_tag { return tdt } )* {
10471053 return td.concat(tds);
@@ -1049,9 +1055,7 @@
10501056 table_data_tag
10511057 = //& { dp("table_data enter, pos=" + pos + input.substr(pos,10)); return true; }
10521058 ! [}+-]
1053 - //& { dp('before attrib, pos=' + pos); return true; }
10541059 a:table_cell_args?
1055 - //& { dp('past attrib, pos=' + pos); return true; }
10561060 //& { console.log("past attrib, pos=" + pos + input.substr(pos,10)); return true; }
10571061 // use inline_breaks to break on tr etc
10581062 td:( !inline_breaks

Follow-up revisions

RevisionCommit summaryAuthorDate
r107061Fix regression introduced by r107060 for regular table cells. Good to have a...gwicke12:09, 22 December 2011

Status & tagging log