fixed block/inline tags

This commit is contained in:
Guilhem Fauré 2023-05-04 11:54:37 +02:00
parent 8cc7d3640e
commit a113ba79c5
2 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@ def test(filename):
print(f"--- Parsing of {filename} ---\n")
parsed = spipParser.parse(open(path.dirname(__file__) + "/" + filename).read())
print(parsed, "\n")
print("--- Pretty print : ---\n\n", parsed.pretty(), "\n")
print(f"--- Parse tree of {filename} ---\n\n", parsed.pretty(), "\n")
# Test

View File

@ -37,8 +37,8 @@ _block_tag.1: pair_block_tag
pair_block_tag: _PAIR_TAG_ANGLE TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" start "</" _PURE_TEXT ">" -> tag
orphan_block_tag: _ORPHAN_TAG_ANGLE "/"? TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" -> orphan_tag
_PAIR_TAG_ANGLE: /<(?=([0-9A-Za-z_:|,=\/\-\. ]+)>[\s\S]+<\/\1>)/
_ORPHAN_TAG_ANGLE: /<(?=([0-9A-Za-z_:|,=\/\-\. ])+>)(?![\s\S]+\<\/\1\>)/
_PAIR_TAG_ANGLE: /<(?=([0-9A-Za-z_:|,=\/\-\. ]+)>\r?\n[\s\S]+<\/\1>)/
_ORPHAN_TAG_ANGLE: /<(?=([0-9A-Za-z_:|,=\/\-\. ])+>\r?\n)(?![\s\S]+\<\/\1\>)/
paragraph.-1: ( _inline{TEXT} _N? )+
@ -51,11 +51,11 @@ _inline{text}: _inline_tag
_inline_tag.1: pair_inline_tag
| orphan_inline_tag
pair_inline_tag: _PAIR_INLINE_TAG_ANGLE TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" paragraph ( "</" _PURE_TEXT ">" | _N ) -> tag
pair_inline_tag: _PAIR_INLINE_TAG_ANGLE TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" _N? paragraph ( "</" _PURE_TEXT ">" | _N ) -> tag
orphan_inline_tag: _INLINE_TAG_ANGLE "/"? TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" -> orphan_tag
_PAIR_INLINE_TAG_ANGLE.1: /\<(?=(?:quote|section|div|cadre|frame|code|poesie|del|p)(?:\|[0-9A-Za-z_:,=\/\-\. ]+)*\>)/i
_INLINE_TAG_ANGLE: /\<(?!\/?(?:quote|section|div|cadre|frame|code|poesie|del|p))(?=[0-9A-Za-z\|_:,=\/\-\. ]+\>)/i
_PAIR_INLINE_TAG_ANGLE.1: /<(?=(?:quote|section|div|cadre|frame|code|poesie|del|p|h[0-6])[0-9A-Za-z_:,=\/\.\|\- ]*>)/i
_INLINE_TAG_ANGLE: /<(?!\/?(?:quote|section|div|cadre|frame|code|poesie|del|p|h[0-6]))(?=[0-9A-Za-z\|_:,=\/\.\|\- ]+>)/i
_link: footnote
| wikilink