1.1 --- a/ImprovedTableParser.py Fri Feb 24 21:39:12 2012 +0100
1.2 +++ b/ImprovedTableParser.py Sat Feb 25 19:28:58 2012 +0100
1.3 @@ -17,11 +17,11 @@
1.4
1.5 syntax = {
1.6 # For section markers.
1.7 - "markers" : (r"^\s*(?P<n>\\+)(?P<b>{|})(?P=n)(?P=b)(?P=n)(?P=b)", re.MULTILINE),
1.8 + "markers" : (r"(?P<n>\\+)(?P<b>{|})(?P=n)(?P=b)(?P=n)(?P=b)", re.MULTILINE),
1.9 "marker" : (r"(\\+)", 0),
1.10
1.11 # At start of line:
1.12 - "sections" : (r"(^\s*{{{.*?^\s*}}})", re.MULTILINE | re.DOTALL), # {{{ ... }}}
1.13 + "sections" : (r"({{{.*?}}})", re.MULTILINE | re.DOTALL), # {{{ ... }}}
1.14 "rows" : (r"^==(?!.*?==$)", re.MULTILINE), # == not-heading
1.15
1.16 # Within text:
2.1 --- a/tests/test_sections.py Fri Feb 24 21:39:12 2012 +0100
2.2 +++ b/tests/test_sections.py Sat Feb 25 19:28:58 2012 +0100
2.3 @@ -7,7 +7,7 @@
2.4 Hello
2.5 \\{\\{\\{
2.6 Hello again
2.7 -But not \\{\\{\\{ this \\}\\}\\}
2.8 +And also \\\\{\\\\{\\\\{ this \\\\}\\\\}\\\\}
2.9 \\\\{\\\\{\\\\{
2.10 And once again
2.11 \\\\}\\\\}\\\\}
3.1 --- a/tests/test_table.py Fri Feb 24 21:39:12 2012 +0100
3.2 +++ b/tests/test_table.py Sat Feb 25 19:28:58 2012 +0100
3.3 @@ -32,16 +32,19 @@
3.4 == This, despite the == is in a new row.
3.5 ||
3.6 And this is the second column.
3.7 +==
3.8 +Some \\{\\{\\{preformatted text\\}\\}\\} || Some `preformatted text` || Observe the region notation inline.
3.9 """
3.10
3.11 attrs, rows = parse(table)
3.12 +expected = 9
3.13
3.14 print table
3.15 print attrs
3.16 print rows
3.17 -print len(rows) == 8, ": length is", len(rows), "==", 8
3.18 +print len(rows) == expected, ": length is", len(rows), "==", expected
3.19 print
3.20 -for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3, 2, 2, 2]):
3.21 +for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3, 2, 2, 2, 3]):
3.22 print row_attrs
3.23 print columns
3.24 non_continuation_columns = [