Added test for quotations

This commit is contained in:
Maximilien Rigaut 2022-03-26 13:14:24 +01:00
parent bcfb07e5c3
commit 2949830f0c
2 changed files with 40 additions and 2 deletions

View File

@ -310,9 +310,9 @@ table_separator = pp.OneOrMore(
pps('|') + pp.Word(':-')
)('table_separator').add_parse_action(of_type(TableSeparatorToken)) + pps('|')
# Future: Add Blockquote element
blockquote = pp.LineStart + '>' + \
blockquote = pp.Literal('>') + \
pp.SkipTo(pp.line_end)('text').add_parse_action(of_type(BlockQuoteToken)) # TODO: add reparse
blockquote_author = pp.LineStart + '> --' + \
blockquote_author = pp.Literal('> --') + \
pp.SkipTo(pp.line_end)('author').add_parse_action(of_type(BlockQuoteAuthorToken))
table = table_separator | table_row
quotation = blockquote_author | blockquote

View File

@ -527,6 +527,44 @@ dict_advanced_syntax_input_and_expected_output = {
]),
), __GL(),),
],
"blockquote": [
("> Text", (sy.BlockQuoteToken([sy.TextToken(["Text"])]),), __GL(), __XF),
("> Text with *em* and __underline__", (
sy.BlockQuoteToken([
sy.TextToken(["Text with"]),
sy.EtEmToken(["*"]),
sy.TextToken(["em"]),
sy.EtEmToken(["*"]),
sy.TextToken(["and"]),
sy.EtUnderlineToken(["__"]),
sy.TextToken(["underline"]),
sy.EtUnderlineToken(["__"]),
]),
), __GL(), __XF),
],
"blockquote_author": [
("> -- Author Name", (
sy.BlockQuoteAuthorToken(["Author Name"]),
), __GL(), __XF),
],
"quotation": [
("> Text", (sy.BlockQuoteToken([sy.TextToken(["Text"])]),), __GL(), __XF),
("> Text with *em* and __underline__", (
sy.BlockQuoteToken([
sy.TextToken(["Text with"]),
sy.EtEmToken(["*"]),
sy.TextToken(["em"]),
sy.EtEmToken(["*"]),
sy.TextToken(["and"]),
sy.EtUnderlineToken(["__"]),
sy.TextToken(["underline"]),
sy.EtUnderlineToken(["__"]),
]),
), __GL(), __XF),
("> -- Author Name", (
sy.BlockQuoteAuthorToken(["Author Name"]),
), __GL(), __XF),
],
}
# Cursed zipping oneline