From cb36324e9afe1f63ed53dd90eebb841b76456fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Faur=C3=A9?= Date: Thu, 27 Apr 2023 15:16:30 +0200 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20use=20inner=20text=20as=20text?= =?UTF-8?q?=20is=20now=20more=20strict=20anyway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spip2md/spip.lark | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/spip2md/spip.lark b/spip2md/spip.lark index f4f4281..cd179b7 100644 --- a/spip2md/spip.lark +++ b/spip2md/spip.lark @@ -19,7 +19,7 @@ table: ( row _N )+ -> table row: ( _PIPE cell )+ _PIPE -> tr cell: _inline_format -> td -heading: _O_CURLY_3 ( INNER_TEXT | link | nested_italic | nested_bold ) _C_CURLY_3 -> h2 +heading: _O_CURLY_3 ( TEXT | link | nested_italic | nested_bold ) _C_CURLY_3 -> h2 paragraph: ( _inline_format _N? )+ -> p @@ -28,10 +28,10 @@ _inline_format: TEXT | bold | link -bold: _O_CURLY_2 ( INNER_TEXT | link | nested_italic )+ _C_CURLY_2 -> strong -italic: _O_CURLY ( INNER_TEXT | link | nested_bold )+ _C_CURLY -> em -nested_bold: TEXT+ _O_CURLY_2 ( INNER_TEXT | link )+ _C_CURLY_2 -> strong -nested_italic: TEXT+ _O_CURLY ( INNER_TEXT | link )+ _C_CURLY -> em +bold: _O_CURLY_2 ( TEXT | link | nested_italic )+ _C_CURLY_2 -> strong +italic: _O_CURLY ( TEXT | link | nested_bold )+ _C_CURLY -> em +nested_bold: TEXT+ _O_CURLY_2 ( TEXT | link )+ _C_CURLY_2 -> strong +nested_italic: TEXT+ _O_CURLY ( TEXT | link )+ _C_CURLY -> em ?link: footnote | wikipedia_link @@ -72,22 +72,25 @@ SEPARATOR: "----" "-"* /// Text // - Don’t contains line breaks -// - Don’t contains any opening markup elements… +// - Don’t contains any markup element… // - EXCEPTED when they are used as in regular text -TEXT: /[^\r\n\{\[\<]+/ +TEXT: /[^\r\n\{\}\[\]\<\>]+/ | /\[(?!.*->.*\])/ + | /\]/ /// Inner text : // - Don’t contains line breaks // - Don’t contains markup closing right curly braces -INNER_TEXT: /[^\r\n\}]+/ +// INNER_TEXT: /[^\r\n\}]+/ /// Link href : // - Don’t contains line breaks // - Don’t contains markup closing right square brackets -HREF: /[^\r\n\]]+/ +// HREF: /[^\r\n\]]+/ +HREF: TEXT /// Link text : // - Don’t contains line breaks +// - Don’t contains an opening or closing square bracket // - Don’t contains an hyphen angle bracket arrow ( -> ) LINK_TEXT: /[^\r\n\[\]]+(?=->)/