ImprovedTableParser

Changeset

45:fbbdfe601473
2015-12-20 Paul Boddie raw files shortlog changelog graph Minor help and test updates.
pages/HelpOnImprovedTableParser (file) tests/test_table.py (file)
     1.1 --- a/pages/HelpOnImprovedTableParser	Mon Feb 23 23:25:43 2015 +0100
     1.2 +++ b/pages/HelpOnImprovedTableParser	Sun Dec 20 00:06:00 2015 +0100
     1.3 @@ -263,7 +263,7 @@
     1.4  || Amstrad CPC464 ||<colspan="2"> 64K || 32K || 1984 || 249 (green screen), 349 (colour) ||
     1.5  || Amstrad CPC6128 ||<colspan="2"> 128K || 48K || 1985 || 299 (colour) ||
     1.6  || Sinclair ZX81 || 1K || 16K || 8K || 1981 || 70 (assembled), 50 (kit) ||
     1.7 -|| VIC-20 || 5K || 32K || 16K || 1980 || 200 (estimated) ||
     1.8 +|| VIC-20 || 5K || 32K || 16K || 1980 || 199 ||
     1.9  
    1.10  Here is how it is written in the default table syntax:
    1.11  
    1.12 @@ -276,7 +276,7 @@
    1.13  || Amstrad CPC464 ||<colspan="2"> 64K || 32K || 1984 || 249 (green screen), 349 (colour) ||
    1.14  || Amstrad CPC6128 ||<colspan="2"> 128K || 48K || 1985 || 299 (colour) ||
    1.15  || Sinclair ZX81 || 1K || 16K || 8K || 1981 || 70 (assembled), 50 (kit) ||
    1.16 -|| VIC-20 || 5K || 32K || 16K || 1980 || 200 (estimated) ||
    1.17 +|| VIC-20 || 5K || 32K || 16K || 1980 || 199 ||
    1.18  }}}
    1.19  
    1.20  Although the lines are not too long, it is somewhat difficult to interpret and edit the text.
    1.21 @@ -331,7 +331,7 @@
    1.22  || 70 (assembled), 50 (kit)
    1.23  ==
    1.24  VIC-20 || 5K || 32K || 16K || 1980
    1.25 -|| 200 (estimated)
    1.26 +|| 199
    1.27  }}}
    1.28  }}}}
    1.29  
    1.30 @@ -384,7 +384,7 @@
    1.31  || 70 (assembled), 50 (kit)
    1.32  ==
    1.33  VIC-20 || 5K || 32K || 16K || 1980
    1.34 -|| 200 (estimated)
    1.35 +|| 199
    1.36  }}}
    1.37  
    1.38  === Adding Table Sorting ===
    1.39 @@ -453,7 +453,7 @@
    1.40  || 70 (assembled), 50 (kit)
    1.41  ==
    1.42  VIC-20 || 5K || 32K || 16K || 1980
    1.43 -|| 200 (estimated)
    1.44 +|| 199
    1.45  }}}
    1.46  
    1.47  By pointing to the header cells, a pop-up dialogue allows the sorting criteria to be edited.
     2.1 --- a/tests/test_table.py	Mon Feb 23 23:25:43 2015 +0100
     2.2 +++ b/tests/test_table.py	Sun Dec 20 00:06:00 2015 +0100
     2.3 @@ -47,17 +47,19 @@
     2.4  ==
     2.5  A test || Of...
     2.6            ...non-continuation
     2.7 +==
     2.8 +<<Macro>>
     2.9  """
    2.10  
    2.11  attrs, rows = parse(table)
    2.12 -expected = 13
    2.13 +expected = 14
    2.14  
    2.15  print table
    2.16  print attrs
    2.17  print rows
    2.18  print len(rows) == expected, ": length is", len(rows), "==", expected
    2.19  print
    2.20 -for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2]):
    2.21 +for (row_attrs, columns), expected in zip(rows, [3, 2, 3, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2, 1]):
    2.22      print row_attrs
    2.23      print columns
    2.24      non_continuation_columns = [
    2.25 @@ -78,4 +80,8 @@
    2.26  text = rows[12][1][1][1]
    2.27  print text == expected_text, ": text is", repr(text)
    2.28  
    2.29 +expected_text = "\n<<Macro>>\n"
    2.30 +text = rows[13][1][0][1]
    2.31 +print text == expected_text, ": text is", repr(text)
    2.32 +
    2.33  # vim: tabstop=4 expandtab shiftwidth=4