From ca0e9af4b477c043a829d72f78bc27a044e2048c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Faur=C3=A9?= Date: Tue, 9 May 2023 10:24:56 +0200 Subject: [PATCH] remove last priority, definin text non-starting char --- spip2md/spip.lark | 20 +++++++++++++++----- test/0.spip | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/spip2md/spip.lark b/spip2md/spip.lark index dde78c1..62e9795 100644 --- a/spip2md/spip.lark +++ b/spip2md/spip.lark @@ -32,7 +32,7 @@ heading: _H _inline{MARKED_TEXT}+ "}}}" _H: "{{{" _block_tag: pair_block_tag - | orphan_block_tag + | orphan_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 @@ -40,7 +40,7 @@ orphan_block_tag: _ORPHAN_TAG_ANGLE "/"? TAG_NAME ( _OPTION_SEP TAG_OPTION )* "> _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{text}.-1: ( _inline{text} _N? )+ +paragraph{text}: _inline{PARAGRAPH_TEXT} _N? ( _inline{text} _N? )* _inline{text}: _inline_tag | _link @@ -76,10 +76,20 @@ emphasis: _I ( _inline{MARKED_TEXT} )+ ( "}" | _N ) _B: /{{(?=[^\{])/ _I: /{(?=[^\{])/ +PARAGRAPH_TEXT: / [^\r\n|\-{<] + (?:[^\r\n{<](?! + [^\[\r\n]*-> + |\?[^\[\r\n]*\] + |\[[^\[\r\n]*\]\] + ))* + | (?:\<(?![0-9A-Za-z_:|,=\/\-\. ]+\>))+ + | \\{ + /x + TEXT: / (?:[^\r\n{<](?! - [^\[\n\r]*-> - |\?[^\[\n\r]*\] - |\[[^\[\n\r]*\]\] + [^\[\r\n]*-> + |\?[^\[\r\n]*\] + |\[[^\[\r\n]*\]\] ))+ | (?:\<(?![0-9A-Za-z_:|,=\/\-\. ]+\>))+ | \\{ diff --git a/test/0.spip b/test/0.spip index e7151f0..62868ec 100644 --- a/test/0.spip +++ b/test/0.spip @@ -38,7 +38,7 @@ Conclut par un {{ {Lorem ipsum} }} dolor sit amet, officia excepteur ex fugiat r Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est accolade impromptue } proident. Du def pythonCode(): pass code python. Nostrud officia {{pariatur}} ut officia. Sit [un lien->https://google.com]irure elit esse lien [?wikipedia] ea nulla sunt ex occaecat texte biffé on dit barré non ? Reprehenderit commodo footnote[[content of footnote]] officia dolor Lorem duis laboris cupidatat officia voluptate. -Culpa proident adipisicing id {nulla} nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non [excepteur] duis unexpected pipe | sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. +Culpa proident adipisicing id {nulla} nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non [excepteur] duis unexpected pipe | sunt velit enim. Voluptate laboris sint cupidatat {{strong then}}- dash ullamco ut ea consectetur et est culpa et culpa duis. ----