summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-02-18 19:30:12 +0000
committerrsiddharth <s@ricketyspace.net>2018-02-18 19:30:12 +0000
commit1560df979ae7a72dc5409ad4ed334ca293759eb0 (patch)
tree6a9c7717870f0a143fda1222734140d4084b294e
parent8c4f391f27dd7bcfe8e8c97843952125a8f0d16f (diff)
md_tw.py: Add TWMarkdown.output_block_quote.
* md_tw.py (TWMarkdown)[output_block_quote]: New method.
-rw-r--r--md_tw.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/md_tw.py b/md_tw.py
index 481e94a..9a169d7 100644
--- a/md_tw.py
+++ b/md_tw.py
@@ -303,5 +303,22 @@ class TWMarkdown(mistune.Markdown):
return '{}\n'.format(out.strip('\n'))
+ def output_block_quote(self):
+ # Set renderer to prepend '> '
+ prefix = self.renderer.tw_get('initial_indent') + '> '
+ self.renderer.tw_set(initial_indent=prefix,
+ subsequent_indent=prefix)
+
+ # Render block quote
+ rendered_bq = super(TWMarkdown, self).output_block_quote()
+
+ # Remove prefix
+ prefix = self.renderer.tw_get('initial_indent')[:-2]
+ self.renderer.tw_set(initial_indent=prefix,
+ subsequent_indent=prefix)
+
+ return rendered_bq
+
+
def main():
print('USAGE: md_tw 72 file.md file2.md [...]')