support for block & inline tags
This commit is contained in:
parent
d1702d6d19
commit
c0a7bc0f29
@ -1,12 +1,12 @@
|
||||
// Flexible SPIP Markup grammar for Lark parser
|
||||
start: _N* block ( _N+ block )* _N*
|
||||
|
||||
?block: paragraph
|
||||
?block: HORIZONTAL_RULE -> horizontal_rule
|
||||
| heading
|
||||
| list
|
||||
| table
|
||||
| tag
|
||||
| HORIZONTAL_RULE -> horizontal_rule
|
||||
| _block_tag
|
||||
| paragraph
|
||||
|
||||
HORIZONTAL_RULE: /----+/
|
||||
|
||||
@ -31,42 +31,55 @@ _TBL.1: "|"
|
||||
heading: _H _inline{MARKED_TEXT}+ "}}}"
|
||||
_H: "{{{"
|
||||
|
||||
_block_tag.1: pair_block_tag
|
||||
| orphan_block_tag
|
||||
|
||||
pair_block_tag: _PAIR_TAG_ANGLE TAG_NAME ( "|" TAG_OPTION )* ">" start "</" _PURE_TEXT ">" -> tag
|
||||
orphan_block_tag: _ORPHAN_TAG_ANGLE "/"? TAG_NAME ( "|" TAG_OPTION )* ">" -> orphan_tag
|
||||
|
||||
_PAIR_TAG_ANGLE: /\<(?=([0-9A-Za-z_:\/\-\.]+)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>[\s\S]+\<\/\1\>)/
|
||||
_ORPHAN_TAG_ANGLE: /\<(?=([0-9A-Za-z_:\/\-\.]+)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>)(?![\s\S]+\<\/\1\>)/
|
||||
|
||||
paragraph.-1: ( _inline{TEXT} _N? )+
|
||||
|
||||
_inline{text}: text
|
||||
_inline{text}: _inline_tag
|
||||
| _link
|
||||
| emphasis
|
||||
| strong
|
||||
| text
|
||||
|
||||
_inline_tag.1: pair_inline_tag
|
||||
| orphan_inline_tag
|
||||
|
||||
pair_inline_tag: _PAIR_INLINE_TAG_ANGLE TAG_NAME ( "|" TAG_OPTION )* ">" paragraph ( "</" _PURE_TEXT ">" | _N ) -> tag
|
||||
orphan_inline_tag: _INLINE_TAG_ANGLE "/"? TAG_NAME ( "|" TAG_OPTION )* ">" -> orphan_tag
|
||||
|
||||
_PAIR_INLINE_TAG_ANGLE: /\<(?=(?:quote|section|div|cadre|frame|code|poesie)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>)/
|
||||
_INLINE_TAG_ANGLE: /\<(?=([0-9A-Za-z_:\/\-\.]+)(?:\|[0-9A-Za-z_:\/\-\.]+)*\>)/
|
||||
|
||||
_link: footnote
|
||||
| wikilink
|
||||
| anchor
|
||||
| tag
|
||||
|
||||
TEXT.-1: /(?:[^\r\n\{](?![^\[\n\r]*->))+/
|
||||
TABLE_TEXT.-1: /[^\|\r\n\{]+/
|
||||
MARKED_TEXT.-1: /[^\}\r\n\{]+/
|
||||
|
||||
strong: _B ( _inline{MARKED_TEXT} )+ ( "}}" | _N )
|
||||
emphasis: _I ( _inline{MARKED_TEXT} )+ ( "}" | _N )
|
||||
_B: /{{(?=[^\{])/
|
||||
_I: /{(?=[^\{])/
|
||||
|
||||
?anchor: anchor_footnote
|
||||
| anchor_wikipedia
|
||||
| anchor_normal -> anchor
|
||||
|
||||
anchor_footnote: _FOOT HREF "]]"
|
||||
anchor_wikipedia: _WIKI HREF "]"
|
||||
anchor_normal: _A A_TEXT "->" HREF "]"
|
||||
footnote: _FOOT HREF "]]"
|
||||
wikilink: _WIKI HREF "]"
|
||||
anchor: _A A_TEXT "->" HREF "]"
|
||||
_FOOT: /\[\[/
|
||||
_WIKI: /\[\?/
|
||||
_A: /\[(?=[^\[\n\r]+->)/
|
||||
HREF: _PURE_TEXT
|
||||
A_TEXT: /[^\r\n\{]+?(?=->)/
|
||||
|
||||
tag.1: start_tag block? end_tag?
|
||||
strong: _B ( _inline{MARKED_TEXT} )+ ( "}}" | _N )
|
||||
emphasis: _I ( _inline{MARKED_TEXT} )+ ( "}" | _N )
|
||||
_B: /{{(?=[^\{])/
|
||||
_I: /{(?=[^\{])/
|
||||
|
||||
start_tag: _STAG TAG_NAME ( "|" TAG_OPTION )* ">"
|
||||
end_tag: _ETAG TAG_NAME ( "|" TAG_OPTION )* ">"
|
||||
_ETAG.1: /<\/(?=[0-9A-Za-z_:\|\/\-\.]+>)/
|
||||
_STAG.1: /<(?=[0-9A-Za-z_:\|\/\-\.]+>)/
|
||||
TEXT.-1: / (?:[^\r\n\{\<](?![^\[\n\r]*->))+
|
||||
| (?:\<(?![0-9A-Za-z_:\/\-\.]+\>))+
|
||||
/x
|
||||
TABLE_TEXT.-1: /(?:[^\|\r\n\{](?![^\[\n\r]*->))+/
|
||||
MARKED_TEXT.-1: /(?:[^\}\r\n\{](?![^\[\n\r]*->))+/
|
||||
TAG_NAME: _PURE_TEXT
|
||||
TAG_OPTION: _PURE_TEXT
|
||||
|
||||
|
@ -62,8 +62,10 @@ Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labor
|
||||
{{{Cadre de code}}}
|
||||
|
||||
<cadre>
|
||||
|
||||
def spipParser():
|
||||
return False
|
||||
|
||||
</cadre>
|
||||
|
||||
{{{Citation sans balise fermante}}}
|
||||
|
Loading…
Reference in New Issue
Block a user