From 11b1900034042f4f161d8b95df8bb68b33e3f260 Mon Sep 17 00:00:00 2001 From: vicky Date: Fri, 25 Mar 2022 20:02:50 +0100 Subject: [PATCH] added blockquotes --- src/bootstraparse/modules/syntax.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bootstraparse/modules/syntax.py b/src/bootstraparse/modules/syntax.py index f4e561a..2985e7d 100644 --- a/src/bootstraparse/modules/syntax.py +++ b/src/bootstraparse/modules/syntax.py @@ -184,6 +184,14 @@ class BeValueToken(SemanticType): label = "be:var" +class BlockQuoteToken(SemanticType): + label = "bq:text" + + +class BlockQuoteAuthorToken(SemanticType): + label = "bq:author" + + def of_type(token_class): """ Function creating a custom function for generating the given Token type. @@ -302,10 +310,15 @@ table_separator = pp.OneOrMore( pps('|') + pp.Word(':-') )('table_separator').add_parse_action(of_type(TableSeparatorToken)) + pps('|') # Future: Add Blockquote element +blockquote = pp.LineStart + '>' + \ + pp.SkipTo(pp.line_end)('text').add_parse_action(of_type(BlockQuoteToken)) # TODO: add reparse +blockquote_author = pp.LineStart + '> --' + \ + pp.SkipTo(pp.line_end)('author').add_parse_action(of_type(BlockQuoteAuthorToken)) table = table_separator | table_row +quotation = blockquote_author | blockquote # multi_line sums up all multi-line elements -multi_line = se | table +multi_line = se | table | quotation # Oneline elements one_header = (