corrected table_separators and their tests
This commit is contained in:
parent
6086820548
commit
69a962dac9
|
|
@ -246,7 +246,8 @@ table_row = (
|
||||||
pp.SkipTo('|')('table_cell').add_parse_action(of_type(TableCellToken)) + '|'
|
pp.SkipTo('|')('table_cell').add_parse_action(of_type(TableCellToken)) + '|'
|
||||||
).add_parse_action(of_type(TableRowToken))
|
).add_parse_action(of_type(TableRowToken))
|
||||||
table_separator = pp.OneOrMore(
|
table_separator = pp.OneOrMore(
|
||||||
pp.Regex(r'\|-+'))('table_separator').add_parse_action(of_type(TableSeparatorToken)) + '|'
|
pps('|') + pp.Word(':-')
|
||||||
|
)('table_separator').add_parse_action(of_type(TableSeparatorToken)) + pps('|')
|
||||||
table = table_row + pp.Opt(table_separator) + pp.OneOrMore(table_row) + optional
|
table = table_row + pp.Opt(table_separator) + pp.OneOrMore(table_row) + optional
|
||||||
# multi_line sums up all multi-line elements
|
# multi_line sums up all multi-line elements
|
||||||
multi_line = se | table
|
multi_line = se | table
|
||||||
|
|
@ -255,6 +256,7 @@ multi_line = se | table
|
||||||
one_header = (
|
one_header = (
|
||||||
header_element + pp.SkipTo(pp.match_previous_literal(header_element))
|
header_element + pp.SkipTo(pp.match_previous_literal(header_element))
|
||||||
).add_parse_action(of_type(HeaderToken))
|
).add_parse_action(of_type(HeaderToken))
|
||||||
|
# TODO : Add display to tests
|
||||||
one_display = (
|
one_display = (
|
||||||
display_element + pp.SkipTo(pp.match_previous_literal(display_element))
|
display_element + pp.SkipTo(pp.match_previous_literal(display_element))
|
||||||
).add_parse_action(of_type(DisplayToken))
|
).add_parse_action(of_type(DisplayToken))
|
||||||
|
|
@ -271,7 +273,7 @@ one_line = one_header | one_display | one_olist | one_ulist
|
||||||
enhanced_text = pp.ZeroOrMore(
|
enhanced_text = pp.ZeroOrMore(
|
||||||
markup | pp.SkipTo(markup)('text').add_parse_action(of_type(TextToken)) + markup
|
markup | pp.SkipTo(markup)('text').add_parse_action(of_type(TextToken)) + markup
|
||||||
) + pp.Opt(pp.rest_of_line("text").add_parse_action(of_type(TextToken)))
|
) + pp.Opt(pp.rest_of_line("text").add_parse_action(of_type(TextToken)))
|
||||||
line = enhanced_text | one_line | multi_line | markup
|
line = enhanced_text | one_line | multi_line
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
@ -297,4 +299,7 @@ if __name__ == '__main__': # pragma: no cover
|
||||||
|
|
||||||
if not os.path.exists('../../../dev_outputs/'):
|
if not os.path.exists('../../../dev_outputs/'):
|
||||||
os.mkdir('../../../dev_outputs/')
|
os.mkdir('../../../dev_outputs/')
|
||||||
enhanced_text.create_diagram("../../../dev_outputs/diagram.html")
|
line.create_diagram("../../../dev_outputs/diagram_line.html")
|
||||||
|
multi_line.create_diagram("../../../dev_outputs/diagram_multi_line.html")
|
||||||
|
one_line.create_diagram("../../../dev_outputs/diagram_one_line.html")
|
||||||
|
enhanced_text.create_diagram("../../../dev_outputs/diagram_enchanced_text.html")
|
||||||
|
|
|
||||||
|
|
@ -278,8 +278,8 @@ list_of_text_input_and_readable_output = [
|
||||||
# Tables
|
# Tables
|
||||||
("| Text1 | Text2 |", "table", "<table: | Text1 | Text2 |>"),
|
("| Text1 | Text2 |", "table", "<table: | Text1 | Text2 |>"),
|
||||||
("| Text1 |3 Text2 |", "table", "<table: | Text1 |3 Text2 |>"),
|
("| Text1 |3 Text2 |", "table", "<table: | Text1 |3 Text2 |>"),
|
||||||
("|---|---|", "table_separator", "<table_separator: |---|---|>"),
|
("|---|---|", "table_separator", "<table:separator = '---,---' />"),
|
||||||
("|:--|-:-|--:|--:|", "table_separator", "<table_separator: |:--|-:-|--:|--:|>"),
|
("|:--|-:-|--:|--:|", "table_separator", "<table:separator = ':--,-:-,--:,--:' />"),
|
||||||
|
|
||||||
# Other Mostly for testing and coverage
|
# Other Mostly for testing and coverage
|
||||||
("'", "quotes", "'"),
|
("'", "quotes", "'"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue