Added a couple of things inside << and >> detection (body, nav, header)
This commit is contained in:
parent
bd2fdd8519
commit
4de49410a0
|
|
@ -267,12 +267,12 @@ class DisplayToken(FinalSemanticType):
|
||||||
|
|
||||||
|
|
||||||
class StructuralElementStartToken(AddFirstElementToLabel, OpenedSemanticType, TokensToMatch):
|
class StructuralElementStartToken(AddFirstElementToLabel, OpenedSemanticType, TokensToMatch):
|
||||||
"""<<div|article|section|aside"""
|
"""<<div|article|section|aside|header|body|nav"""
|
||||||
label = 'se:start'
|
label = 'se:start'
|
||||||
|
|
||||||
|
|
||||||
class StructuralElementEndToken(AddFirstElementToLabel, ClosedSemanticType):
|
class StructuralElementEndToken(AddFirstElementToLabel, ClosedSemanticType):
|
||||||
"""div|article|section|aside>>"""
|
"""div|article|section|aside|header|body|nav>>"""
|
||||||
label = "se:end"
|
label = "se:end"
|
||||||
|
|
||||||
def counterpart(self):
|
def counterpart(self):
|
||||||
|
|
@ -470,7 +470,10 @@ structural_elements = (
|
||||||
pp.CaselessLiteral('div') |
|
pp.CaselessLiteral('div') |
|
||||||
pp.CaselessLiteral('article') |
|
pp.CaselessLiteral('article') |
|
||||||
pp.CaselessLiteral('aside') |
|
pp.CaselessLiteral('aside') |
|
||||||
pp.CaselessLiteral('section')
|
pp.CaselessLiteral('section') |
|
||||||
|
pp.CaselessLiteral('header') |
|
||||||
|
pp.CaselessLiteral('body') |
|
||||||
|
pp.CaselessLiteral('nav')
|
||||||
)('structural_element')
|
)('structural_element')
|
||||||
header_element = pp.Word('#')
|
header_element = pp.Word('#')
|
||||||
display_element = pp.Word('!')
|
display_element = pp.Word('!')
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,21 @@ _token_list_with_expected_result = [
|
||||||
],
|
],
|
||||||
__GLk(1),
|
__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(["*"]),
|
sy.EtEmToken(["*"]),
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,7 @@ dict_advanced_syntax_input_and_expected_output = {
|
||||||
("|---|---|", (sy.TableSeparatorToken(["---", "---"]),), __GL()),
|
("|---|---|", (sy.TableSeparatorToken(["---", "---"]),), __GL()),
|
||||||
("- Text", (sy.EtUlistToken([sy.TextToken(["Text"])]),), __GL()),
|
("- Text", (sy.EtUlistToken([sy.TextToken(["Text"])]),), __GL()),
|
||||||
("div>>", (sy.StructuralElementEndToken(["div"]),), __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']", (
|
("#. Text with *em* and __underline__ and {arguments}{{super-arguments}}[a=1, c=2,'ui']", (
|
||||||
sy.EtOlistToken([
|
sy.EtOlistToken([
|
||||||
sy.TextToken(["Text with"]),
|
sy.TextToken(["Text with"]),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue