1.1 --- a/ImprovedTableParser.py Fri Jul 13 00:39:56 2012 +0200
1.2 +++ b/ImprovedTableParser.py Fri Jul 13 01:03:11 2012 +0200
1.3 @@ -23,7 +23,7 @@
1.4 # Within text:
1.5 "markers" : (r"([{]{3,}|[}]{3,})", re.MULTILINE | re.DOTALL), # {{{... or }}}...
1.6 "columns" : (r"\|\|[ \t]*", 0), # || ws-excl-nl
1.7 - "continuations" : (r"^\s*\.\.[ \t]?", re.MULTILINE), # .. ws-excl-nl
1.8 + "continuations" : (r"^\s*\.\.(?!\.)[ \t]?", re.MULTILINE), # .. ws-excl-nl or .. not-dot
1.9
1.10 # At start of column text:
1.11 "column" : (r"^\s*<(.*?)>\s*(.*)", re.DOTALL), # ws < attributes > ws
2.1 --- a/pages/HelpOnImprovedTableParser Fri Jul 13 00:39:56 2012 +0200
2.2 +++ b/pages/HelpOnImprovedTableParser Fri Jul 13 01:03:11 2012 +0200
2.3 @@ -81,24 +81,48 @@
2.4 until the next row or the end of the table
2.5 }}}
2.6
2.7 +==== Indented Column Text and Line Continuation ====
2.8 +
2.9 Sometimes it can be convenient to present a table in a formatted fashion, with alignment of column content even when viewed as plain text. However, this can present problems with indentation:
2.10
2.11 +{{{{
2.12 +{{{#!table
2.13 +First column || Second column
2.14 + ...this should be part of the same paragraph,
2.15 + but isn't until now.
2.16 +}}}
2.17 +}}}}
2.18 +
2.19 +The result is as follows:
2.20 +
2.21 {{{#!table
2.22 First column || Second column
2.23 - ...this should be part of
2.24 - the same paragraph, but isn't
2.25 + ...this should be part of the same paragraph,
2.26 + but isn't until now.
2.27 }}}
2.28
2.29 -To achieve the desired effect, a line continuation syntax is available that prevents !MoinMoin from treating the second and subsequent lines as being indented paragraphs:
2.30 +Note how !MoinMoin lost one of the dots on the second line of the second column's text. This is a feature of the Wiki text parser.
2.31 +
2.32 +To achieve the desired effect, a line continuation syntax is available that prevents !MoinMoin from treating the second and subsequent lines as indented paragraph text:
2.33 +
2.34 +{{{{
2.35 +{{{#!table
2.36 +First column || Second column
2.37 + .. ...this should be part of the same paragraph, and it now is,
2.38 + .. as is this text.
2.39 +}}}
2.40 +}}}}
2.41 +
2.42 +Note that the `..` marker must be the first non-space characters on a line: it is not a column separator, and does not therefore provide a way of writing column content side by side.
2.43 +
2.44 +The result is this:
2.45
2.46 {{{#!table
2.47 First column || Second column
2.48 - .. ...this should be part of
2.49 - .. the same paragraph, but isn't
2.50 + .. ...this should be part of the same paragraph, and it now is,
2.51 + .. as is this text.
2.52 }}}
2.53
2.54 -Note that the `..` marker must be the first non-space characters on a line: it is not a column separator, and does not therefore provide a way of writing column content side by side.
2.55 -
2.56 ==== Styles and Formatting ====
2.57
2.58 Style and formatting options are placed at the start of a row or column inside `<` and `>` markers, with the options corresponding to HTML attributes as described for the [[HelpOnTables|default syntax for tables]] being supported.
3.1 --- a/tests/test_table.py Fri Jul 13 00:39:56 2012 +0200
3.2 +++ b/tests/test_table.py Fri Jul 13 01:03:11 2012 +0200
3.3 @@ -44,17 +44,20 @@
3.4 The first column || The second
3.5 .. with the continuation of
3.6 .. the text without indentation occurring.
3.7 +==
3.8 +A test || Of...
3.9 + ...non-continuation
3.10 """
3.11
3.12 attrs, rows = parse(table)
3.13 -expected = 12
3.14 +expected = 13
3.15
3.16 print table
3.17 print attrs
3.18 print rows
3.19 print len(rows) == expected, ": length is", len(rows), "==", expected
3.20 print
3.21 -for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3, 2, 2, 2, 3, 3, 2, 2]):
3.22 +for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2]):
3.23 print row_attrs
3.24 print columns
3.25 non_continuation_columns = [
3.26 @@ -71,4 +74,8 @@
3.27 text = rows[11][1][1][1]
3.28 print text == expected_text, ": text is", repr(text)
3.29
3.30 +expected_text = "Of...\n ...non-continuation\n"
3.31 +text = rows[12][1][1][1]
3.32 +print text == expected_text, ": text is", repr(text)
3.33 +
3.34 # vim: tabstop=4 expandtab shiftwidth=4