From 06fd732f8d1b4b1d6ef7313df8f441009c781cd7 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Tue, 2 Jan 2018 00:39:27 +0000 Subject: md_tw: Add TWBlockLexer.parse_heading. * md_tw.py (TWBlockLexer.parse_heading): New method. * tests/data/blexer-heading.md: New file. * tests/test_md_tw.py (TestTWBlockLexer.test_parse_heading): New test. --- md_tw.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'md_tw.py') diff --git a/md_tw.py b/md_tw.py index 218d324..64c9ced 100644 --- a/md_tw.py +++ b/md_tw.py @@ -52,6 +52,13 @@ class TWBlockLexer(mistune.BlockLexer): 'text': m.group(0), }) + def parse_heading(self, m): + self.tokens.append({ + 'type': 'heading', + 'level': len(m.group(1)), + 'text': m.group(0), + }) + class TWInlineLexer(mistune.InlineLexer): """Text Wrap Inline level lexer for inline gramars.""" -- cgit v1.2.3