From 1ef5907f0f4aa7135bfaaa90dcbf9cd236230982 Mon Sep 17 00:00:00 2001 From: Maximilien Rigaut Date: Wed, 15 Jun 2022 13:15:03 +0200 Subject: [PATCH] Hotfix on the syntax with ulits --- src/bootstraparse/modules/syntax.py | 4 ++-- tests/modules/test_syntax.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bootstraparse/modules/syntax.py b/src/bootstraparse/modules/syntax.py index 695675a..018942a 100644 --- a/src/bootstraparse/modules/syntax.py +++ b/src/bootstraparse/modules/syntax.py @@ -538,12 +538,12 @@ one_display = ( pp.Opt(optional) ).add_parse_action(of_type(DisplayToken)) one_olist = pp.line_start + ( - pps(pp.Literal('#.')) + ( + pps(pp.Combine(pp.line_start + pp.Literal('#.'))) + ( (pp.SkipTo(optional)('text').add_parse_action(reparse(enhanced_text)) + optional) | enhanced_text) ).add_parse_action(of_type(EtOlistToken)) one_ulist = pp.line_start + ( - pps(pp.Literal('-')) + ( + pps(pp.Combine(pp.line_start + pp.Literal('-'))) + ( (pp.SkipTo(optional)('text').add_parse_action(reparse(enhanced_text)) + optional) | enhanced_text) ).add_parse_action(of_type(EtUlistToken)) diff --git a/tests/modules/test_syntax.py b/tests/modules/test_syntax.py index 8628a96..a1daf89 100644 --- a/tests/modules/test_syntax.py +++ b/tests/modules/test_syntax.py @@ -524,6 +524,7 @@ dict_advanced_syntax_input_and_expected_output = { ), __GL()), ("|---|---|", (sy.TableSeparatorToken(["---", "---"]),), __GL()), ("- Text", (sy.EtUlistToken([sy.TextToken(["Text"])]),), __GL()), + (" - Non ulist", (sy.TextToken(["- Non ulist"]),), __GL()), ("div>>", (sy.StructuralElementEndToken(["div"]),), __GL()), ("body>>", (sy.StructuralElementEndToken(["body"]),), __GL()), ("#. Text with *em* and __underline__ and {arguments}{{super-arguments}}[a=1, c=2,'ui']", ( @@ -667,6 +668,7 @@ list_of_text_input_and_readable_output = [ # Other Mostly for testing and coverage ("'", "quotes", "'"), + (" -", "line", "-"), ]