diff --git a/spip2md/content.py b/spip2md/content.py index e186386..5dcea42 100644 --- a/spip2md/content.py +++ b/spip2md/content.py @@ -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 diff --git a/spip2md/spip.lark b/spip2md/spip.lark index 8bb3902..236bcec 100644 --- a/spip2md/spip.lark +++ b/spip2md/spip.lark @@ -37,8 +37,8 @@ _block_tag.1: pair_block_tag pair_block_tag: _PAIR_TAG_ANGLE TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" start "" -> 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 ( "" | _N ) -> tag +pair_inline_tag: _PAIR_INLINE_TAG_ANGLE TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" _N? paragraph ( "" | _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