html like aliases

This commit is contained in:
Guilhem Fauré 2023-04-26 14:36:56 +02:00
parent fc575696ba
commit 0e5442e98e

View File

@ -1,25 +1,25 @@
start: _N? block ( _N+ block )+ _N* start: _N? block ( _N+ block )+ _N*
?block: heading ?block: heading
| SEPARATOR | SEPARATOR -> hr
| unordered_list | unordered_list
| ordered_list | ordered_list
| table | table
| paragraph | paragraph
heading: "{{{" ( TEXT | link | nested_italic | nested_bold ) "}}}" heading: "{{{" ( TEXT | link | nested_italic | nested_bold ) "}}}" -> h2
SEPARATOR: "----" "-"* SEPARATOR: "----" "-"*
unordered_list: ( "-*" list_element _N )+ unordered_list: ( "-*" list_element _N )+ -> ul
ordered_list: ( "-#" list_element _N )+ ordered_list: ( "-#" list_element _N )+ -> ol
list_element: _inline_format list_element: _inline_format -> li
table: ( row _N )+ table: ( row _N )+ -> table
row: ( "|" cell )+ "|" row: ( "|" cell )+ "|" -> tr
cell: _inline_format cell: _inline_format -> td
paragraph: ( _inline_format _N? )+ paragraph: ( _inline_format _N? )+ -> p
// Windows or Unix line break // Windows or Unix line break
_N: /\r/? /\n/ _N: /\r/? /\n/
@ -29,11 +29,11 @@ _inline_format: bold
| link | link
| TEXT | TEXT
bold: "{{" ( TEXT | link | nested_italic )+ "}}" bold: "{{" ( TEXT | link | nested_italic )+ "}}" -> strong
italic: "{" ( TEXT | link | nested_bold )+ "}" italic: "{" ( TEXT | link | nested_bold )+ "}" -> em
nested_bold: _NOT_LBRACE "{{" ( TEXT | link ) "}}" _NOT_RBRACE -> bold nested_bold: _NOT_LBRACE "{{" ( TEXT | link ) "}}" _NOT_RBRACE -> strong
nested_italic: _NOT_LBRACE "{" ( TEXT | link ) "}" _NOT_RBRACE -> italic nested_italic: _NOT_LBRACE "{" ( TEXT | link ) "}" _NOT_RBRACE -> em
_NOT_LBRACE: /[^\{]/ _NOT_LBRACE: /[^\{]/
_NOT_RBRACE: /[^\}]/ _NOT_RBRACE: /[^\}]/