diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-08-20 11:03:03 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-08-20 11:03:03 +0200 |
commit | 635f53e9f82ede414f97087510043ec62d41468c (patch) | |
tree | 06296a4d84da10db39d88518c739cd003732d4a1 | |
parent | 05bb70ce36a11550222c718c6e69185b44793ca4 (diff) | |
download | wikimini-635f53e9f82ede414f97087510043ec62d41468c.tar.gz wikimini-635f53e9f82ede414f97087510043ec62d41468c.tar.bz2 wikimini-635f53e9f82ede414f97087510043ec62d41468c.zip |
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.
-rw-r--r-- | wikimini/document.py | 11 | ||||
-rw-r--r-- | 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 @@ -194,6 +194,15 @@ class Block: @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.""" __slots__ = ("nodes",) @@ -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) |