progress on supporting raw html tags

This commit is contained in:
Guilhem Fauré 2023-05-03 17:00:15 +02:00
parent 64a0deac93
commit 1ccc95b894
2 changed files with 23 additions and 17 deletions

View File

@ -24,7 +24,7 @@ def test(filename):
# Test # Test
test("../test/0.spip") test("../test/0.spip")
# test("../test/1.spip") test("../test/1.spip")
# test("../test/2.spip") test("../test/2.spip")
# test("../test/3.spip") test("../test/3.spip")
# test("../test/4.spip") test("../test/4.spip")

View File

@ -34,11 +34,11 @@ _H: "{{{"
_block_tag.1: pair_block_tag _block_tag.1: pair_block_tag
| orphan_block_tag | orphan_block_tag
pair_block_tag: _PAIR_TAG_ANGLE TAG_NAME ( "|" TAG_OPTION )* ">" start "</" _PURE_TEXT ">" -> 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 ( "|" TAG_OPTION )* ">" -> orphan_tag orphan_block_tag: _ORPHAN_TAG_ANGLE "/"? TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" -> orphan_tag
_PAIR_TAG_ANGLE: /\<(?=([0-9A-Za-z_:\/\-\.]+)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>[\s\S]+\<\/\1\>)/ _PAIR_TAG_ANGLE: /<(?=([0-9A-Za-z_:|,=\/\-\. ]+)>[\s\S]+<\/\1>)/
_ORPHAN_TAG_ANGLE: /\<(?=([0-9A-Za-z_:\/\-\.]+)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>)(?![\s\S]+\<\/\1\>)/ _ORPHAN_TAG_ANGLE: /<(?=([0-9A-Za-z_:|,=\/\-\. ])+>)(?![\s\S]+\<\/\1\>)/
paragraph.-1: ( _inline{TEXT} _N? )+ paragraph.-1: ( _inline{TEXT} _N? )+
@ -51,11 +51,11 @@ _inline{text}: _inline_tag
_inline_tag.1: pair_inline_tag _inline_tag.1: pair_inline_tag
| orphan_inline_tag | orphan_inline_tag
pair_inline_tag: _PAIR_INLINE_TAG_ANGLE TAG_NAME ( "|" TAG_OPTION )* ">" _inline{TEXT} ( "</" _PURE_TEXT ">" | _N ) -> tag pair_inline_tag: _PAIR_INLINE_TAG_ANGLE TAG_NAME ( _OPTION_SEP TAG_OPTION )* ">" paragraph ( "</" _PURE_TEXT ">" | _N ) -> tag
orphan_inline_tag: _INLINE_TAG_ANGLE "/"? TAG_NAME ( "|" TAG_OPTION )* ">" -> orphan_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)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>)/ _PAIR_INLINE_TAG_ANGLE.1: /\<(?=(?:quote|section|div|cadre|frame|code|poesie|del|p|P)(?:\|[0-9A-Za-z_:,=\/\-\. ]+)*\>)/
_INLINE_TAG_ANGLE: /\<(?!\/?(?:quote|section|div|cadre|frame|code|poesie|del))(?=[0-9A-Za-z\|_:\/\-\.]+\>)/ _INLINE_TAG_ANGLE: /\<(?!\/?(?:quote|section|div|cadre|frame|code|poesie|del|p|P))(?=[0-9A-Za-z\|_:,=\/\-\. ]+\>)/
_link: footnote _link: footnote
| wikilink | wikilink
@ -63,12 +63,12 @@ _link: footnote
footnote: _FOOT FOOTNOTE_CONTENT "]]" footnote: _FOOT FOOTNOTE_CONTENT "]]"
wikilink: _WIKI HREF "]" wikilink: _WIKI HREF "]"
anchor: _A A_TEXT "->" HREF "]" anchor: _A A_TEXT "->" " "* HREF " "* "]"
_FOOT: /\[\[/ _FOOT: /\[\[/
_WIKI: /\[\?/ _WIKI: /\[\?/
_A: /\[(?=[^\[\n\r]+->)/ _A: /\[(?=[^\[\n\r]+->)/
FOOTNOTE_CONTENT: /[0-9A-Za-z_:\/\-\.\ ]+/ FOOTNOTE_CONTENT: /[0-9A-Za-z_:\/\-\.\ ]+/
HREF: _PURE_TEXT HREF: _PURE_TEXT | _PLACEHOLDER
A_TEXT: /[^\r\n\{]+?(?=->)/ A_TEXT: /[^\r\n\{]+?(?=->)/
strong: _B ( _inline{MARKED_TEXT} )+ ( "}}" | _N ) strong: _B ( _inline{MARKED_TEXT} )+ ( "}}" | _N )
@ -76,8 +76,12 @@ emphasis: _I ( _inline{MARKED_TEXT} )+ ( "}" | _N )
_B: /{{(?=[^\{])/ _B: /{{(?=[^\{])/
_I: /{(?=[^\{])/ _I: /{(?=[^\{])/
TEXT.-1: / (?:[^\r\n\{\<](?![^\[\n\r]*->|\?[^\[\n\r]*\]|\[[^\[\n\r]*\]\]))+ TEXT.-1: / (?:[^\r\n\{\<](?!
| (?:\<(?![0-9A-Za-z_:\/\-\.]+\>))+ [^\[\n\r]*->
|\?[^\[\n\r]*\]
|\[[^\[\n\r]*\]\]
))+
| (?:\<(?![0-9A-Za-z_:|,=\/\-\. ]+\>))+
| \\{ | \\{
/x /x
TABLE_TEXT.-1: /(?:[^\|\r\n\{](?![^\[\n\r]*->))+/ TABLE_TEXT.-1: /(?:[^\|\r\n\{](?![^\[\n\r]*->))+/
@ -85,5 +89,7 @@ MARKED_TEXT.-1: /(?:[^\}\r\n\{](?![^\[\n\r]*->))+/
TAG_NAME: _PURE_TEXT TAG_NAME: _PURE_TEXT
TAG_OPTION: _PURE_TEXT TAG_OPTION: _PURE_TEXT
_OPTION_SEP: " "* "|" " "* | " "+
_N: /\r?\n/ _N: /\r?\n/
_PURE_TEXT: /[0-9A-Za-z_:\/\-\.]+/ _PURE_TEXT: /[0-9A-Za-z_:,=\/\-\.]+/
_PLACEHOLDER: /[\*]+/