From d78ac3764a90fc959862777f37fc9f175e5272e1 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Tue, 2 Jan 2018 00:41:45 +0000 Subject: md_tw.py: Add TWBlockLexer.parse_lheading. * md_tw.py (TWBlockLexer.parse_lheading): New method. * tests/test_md_tw.py (TestTWBlockLexer.test_parse_lheading): New method. * tests/data/blexer-lheading.md: New file. --- md_tw.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'md_tw.py') diff --git a/md_tw.py b/md_tw.py index 64c9ced..10bd0a8 100644 --- a/md_tw.py +++ b/md_tw.py @@ -59,6 +59,14 @@ class TWBlockLexer(mistune.BlockLexer): 'text': m.group(0), }) + def parse_lheading(self, m): + """Parse setext heading.""" + self.tokens.append({ + 'type': 'heading', + 'level': 1 if m.group(2) == '=' else 2, + 'text': m.group(0), + }) + class TWInlineLexer(mistune.InlineLexer): """Text Wrap Inline level lexer for inline gramars.""" -- cgit v1.2.3