From 635f53e9f82ede414f97087510043ec62d41468c Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 20 Aug 2021 11:03:03 +0200 Subject: Rename Blockquote to BlockQuote This keeps it more in line with BlockLink. Also, this adds a LineBreak block, which templates can use to enfore extra line breaks. --- wikimini/document.py | 11 ++++++++++- wikimini/templates/quotes.py | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/wikimini/document.py b/wikimini/document.py index be51108..fe979fc 100644 --- a/wikimini/document.py +++ b/wikimini/document.py @@ -193,6 +193,15 @@ class Block: return [Plain(self.plain())] +@dataclass +class LineBreak: + """Represents an enforced empty line.""" + __slots__ = () + + def plain(self): + return "\n" + + @dataclass class Paragraph(Block): """A paragraph is a piece of text, which itself can hold inline markup.""" @@ -315,7 +324,7 @@ class ItemList(Block): @dataclass -class Blockquote(Block): +class BlockQuote(Block): """A quote. Attributes: diff --git a/wikimini/templates/quotes.py b/wikimini/templates/quotes.py index fdf00cc..ef7f297 100644 --- a/wikimini/templates/quotes.py +++ b/wikimini/templates/quotes.py @@ -1,7 +1,7 @@ """Renders various quote related templates.""" from . import registry -from ..document import Blockquote +from ..document import BlockQuote def tmpl_quote(wikimini, obj): @@ -10,7 +10,7 @@ def tmpl_quote(wikimini, obj): if not text: return "" content = wikimini.convert(text.value).nodes() - return [Blockquote(content)] + return [BlockQuote(content)] registry.insert("blockquote", tmpl_quote) @@ -21,7 +21,7 @@ def tmpl_cquote(wikimini, obj): """Renders the ``{{cquote|...}}`` template.""" text = obj.params[0] content = wikimini.convert(text.value).nodes() - return [Blockquote(content)] + return [BlockQuote(content)] registry.insert("cquote", tmpl_cquote) -- cgit v1.2.3