From 0e5442e98eb5e6a314e59751ce483d535ba582a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Faur=C3=A9?= Date: Wed, 26 Apr 2023 14:36:56 +0200 Subject: [PATCH] html like aliases --- spip2md/spip.lark | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spip2md/spip.lark b/spip2md/spip.lark index 4f14b57..85066d4 100644 --- a/spip2md/spip.lark +++ b/spip2md/spip.lark @@ -1,25 +1,25 @@ start: _N? block ( _N+ block )+ _N* ?block: heading - | SEPARATOR + | SEPARATOR -> hr | unordered_list | ordered_list | table | paragraph -heading: "{{{" ( TEXT | link | nested_italic | nested_bold ) "}}}" +heading: "{{{" ( TEXT | link | nested_italic | nested_bold ) "}}}" -> h2 SEPARATOR: "----" "-"* -unordered_list: ( "-*" list_element _N )+ -ordered_list: ( "-#" list_element _N )+ -list_element: _inline_format +unordered_list: ( "-*" list_element _N )+ -> ul +ordered_list: ( "-#" list_element _N )+ -> ol +list_element: _inline_format -> li -table: ( row _N )+ -row: ( "|" cell )+ "|" -cell: _inline_format +table: ( row _N )+ -> table +row: ( "|" cell )+ "|" -> tr +cell: _inline_format -> td -paragraph: ( _inline_format _N? )+ +paragraph: ( _inline_format _N? )+ -> p // Windows or Unix line break _N: /\r/? /\n/ @@ -29,11 +29,11 @@ _inline_format: bold | link | TEXT -bold: "{{" ( TEXT | link | nested_italic )+ "}}" -italic: "{" ( TEXT | link | nested_bold )+ "}" +bold: "{{" ( TEXT | link | nested_italic )+ "}}" -> strong +italic: "{" ( TEXT | link | nested_bold )+ "}" -> em -nested_bold: _NOT_LBRACE "{{" ( TEXT | link ) "}}" _NOT_RBRACE -> bold -nested_italic: _NOT_LBRACE "{" ( TEXT | link ) "}" _NOT_RBRACE -> italic +nested_bold: _NOT_LBRACE "{{" ( TEXT | link ) "}}" _NOT_RBRACE -> strong +nested_italic: _NOT_LBRACE "{" ( TEXT | link ) "}" _NOT_RBRACE -> em _NOT_LBRACE: /[^\{]/ _NOT_RBRACE: /[^\}]/