Merge branch 'develop' of github.com:vkyfox/bootstraparse-presentation into develop

This commit is contained in:
vicky 2022-06-15 13:50:08 +02:00
commit e36a31dc61
3 changed files with 26 additions and 5 deletions

View File

@ -267,12 +267,12 @@ class DisplayToken(FinalSemanticType):
class StructuralElementStartToken(AddFirstElementToLabel, OpenedSemanticType, TokensToMatch):
"""<<div|article|section|aside"""
"""<<div|article|section|aside|header|body|nav"""
label = 'se:start'
class StructuralElementEndToken(AddFirstElementToLabel, ClosedSemanticType):
"""div|article|section|aside>>"""
"""div|article|section|aside|header|body|nav>>"""
label = "se:end"
def counterpart(self):
@ -470,7 +470,10 @@ structural_elements = (
pp.CaselessLiteral('div') |
pp.CaselessLiteral('article') |
pp.CaselessLiteral('aside') |
pp.CaselessLiteral('section')
pp.CaselessLiteral('section') |
pp.CaselessLiteral('header') |
pp.CaselessLiteral('body') |
pp.CaselessLiteral('nav')
)('structural_element')
header_element = pp.Word('#')
display_element = pp.Word('!')
@ -535,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))

View File

@ -64,6 +64,21 @@ _token_list_with_expected_result = [
],
__GLk(1),
],
[
[
sy.StructuralElementStartToken(["header"]),
sy.TextToken(["1"]),
sy.StructuralElementEndToken(["header"]),
],
[
context_mngr.SeContainer([
sy.StructuralElementStartToken(["header"]),
context_mngr.TextContainer([sy.TextToken(["1"])]),
sy.StructuralElementEndToken(["header"])
]),
],
__GLk(1),
],
[
[
sy.EtEmToken(["*"]),

View File

@ -524,7 +524,9 @@ 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']", (
sy.EtOlistToken([
sy.TextToken(["Text with"]),
@ -666,6 +668,7 @@ list_of_text_input_and_readable_output = [
# Other Mostly for testing and coverage
("'", "quotes", "'"),
(" -", "line", "-"),
]