redefined enhanced_text (tentative)
This commit is contained in:
parent
dde18df5cf
commit
921ec0b1e5
|
|
@ -188,17 +188,16 @@ display_element = pp.OneOrMore(pp.Literal('!'))
|
|||
# Optional elements
|
||||
optional = (pp.Opt(html_insert)("html_insert") + pp.Opt(var)("var"))("optional") # TODO : Make an optional token ? and maybe a htmlInsertToken and a varToken # noqa E501 (line too long)
|
||||
|
||||
# TODO :
|
||||
# Everywhere : Avoid text at all costs since it is not a valid token, make a new token for it or use pp.SkipTo or (...)
|
||||
# Enhanced text elements # TODO: Add all markups so that they can be parsed, they no longer need to be linked
|
||||
# et_em = ('*' + enhanced_text + '*')('em').add_parse_action(of_type(EtEmToken))
|
||||
# et_strong = ('**' + enhanced_text + '**')('strong').add_parse_action(of_type(EtStrongToken))
|
||||
# et_underline = ('__' + enhanced_text + '__')('underline').add_parse_action(of_type(EtUnderlineToken))
|
||||
# et_strikethrough = ('~~' + enhanced_text + '~~')('strikethrough').add_parse_action(of_type(EtStrikethroughToken))
|
||||
# custom_span = ('(#' + pp.Word(pp.nums)('span_id') + ')').set_name('span_tag')
|
||||
# et_custom_span = \
|
||||
# (custom_span + enhanced_text + pp.match_previous_literal(custom_span))('custom_span')\
|
||||
# .add_parse_action(of_type(EtCustomSpanToken))
|
||||
|
||||
# Enhanced text elements
|
||||
et_em = ('*' + ... + '*')('em').add_parse_action(of_type(EtEmToken))
|
||||
et_strong = ('**' + ... + '**')('strong').add_parse_action(of_type(EtStrongToken))
|
||||
et_underline = ('__' + ... + '__')('underline').add_parse_action(of_type(EtUnderlineToken))
|
||||
et_strikethrough = ('~~' + ... + '~~')('strikethrough').add_parse_action(of_type(EtStrikethroughToken))
|
||||
custom_span = ('(#' + pp.Word(pp.nums)('span_id') + ')').set_name('span_tag')
|
||||
et_custom_span = (
|
||||
custom_span + ... + pp.match_previous_literal(custom_span)
|
||||
)('custom_span').add_parse_action(of_type(EtCustomSpanToken))
|
||||
# enhanced_text <== (text | et_strong | et_em | et_underline |
|
||||
# et_strikethrough | et_custom_span) + pp.Opt(enhanced_text)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue