add terminals spip syntax

This commit is contained in:
Guilhem Fauré 2023-04-25 14:30:01 +02:00
parent dbf9de70c7
commit 2132fdfd68

View File

@ -6,9 +6,9 @@ spipParser = Lark(
( heading ( heading
| list | list
| table | table
| separator
| quote | quote
| paragraph | paragraph
| SEPARATOR
) /\n\r?/ ) /\n\r?/
heading: "{{{" paragraph "}}}" heading: "{{{" paragraph "}}}"
@ -27,33 +27,35 @@ spipParser = Lark(
row: /\n\r?\|/ cell+ row: /\n\r?\|/ cell+
cell: paragraph "|" cell: paragraph "|"
separator: /-{4,}/
quote: "<quote>" paragraph "</quote>" quote: "<quote>" paragraph "</quote>"
paragraph: text+ paragraph: text+
text: format_text text: format_text
| link | link
| /[^\n\r]+/ | PURE_TEXT
format_text: italic format_text: italic
| bold | bold
| bold_italic | bold_italic
italic: "{" /[^\n\r]+/ "}" italic: "{" PURE_TEXT "}"
bold: "{{" /[^\n\r]+/ "}}" bold: "{{" PURE_TEXT "}}"
bold_italic: "{{ {" /[^\n\r]+/ "} }}" | "{ {{" /[^\n\r]+/ "}} }" bold_italic: "{{ {" PURE_TEXT "} }}" | "{ {{" PURE_TEXT "}} }"
link: internal_link link: internal_link
| external_link | external_link
| footnote | footnote
| glossary | glossary
internal_link: "[" /[^\n\r]+/ "->" /[^\n\r]+/ "]" internal_link: "[" PURE_TEXT "->" PURE_TEXT "]"
external_link: "[" /[^\n\r]+/ "->" /[a-z]{3,6}://[^\n\r]+/ "]" external_link: "[" PURE_TEXT "->" /[a-z]{3,6}:\/\// PURE_TEXT "]"
footnote: "[[" /[^\n\r]+/ "]]" footnote: "[[" PURE_TEXT "]]"
footnote: "[?" /[^\n\r]+/ "]" footnote: "[?" PURE_TEXT "]"
PURE_TEXT: /[^\n\r]+/
SEPARATOR: /-{4,}/
""", """,
start="section", start="section",
) )