summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--md_tw.py6
-rw-r--r--tests/data/blexer-hrules.md19
-rw-r--r--tests/test_md_tw.py13
3 files changed, 38 insertions, 0 deletions
diff --git a/md_tw.py b/md_tw.py
index 10bd0a8..238cbb2 100644
--- a/md_tw.py
+++ b/md_tw.py
@@ -67,6 +67,12 @@ class TWBlockLexer(mistune.BlockLexer):
'text': m.group(0),
})
+ def parse_hrule(self, m):
+ self.tokens.append({
+ 'type': 'hrule',
+ 'text': m.group(0)
+ })
+
class TWInlineLexer(mistune.InlineLexer):
"""Text Wrap Inline level lexer for inline gramars."""
diff --git a/tests/data/blexer-hrules.md b/tests/data/blexer-hrules.md
new file mode 100644
index 0000000..2b2bc24
--- /dev/null
+++ b/tests/data/blexer-hrules.md
@@ -0,0 +1,19 @@
+* * *
+
+Dresden Dolls
+
+***
+
+God Damn The Sun
+
+*****
+
+Backstabber
+
+- - -
+
+Sorry Bunch
+
+---------------------------------------
+
+Gravity
diff --git a/tests/test_md_tw.py b/tests/test_md_tw.py
index a71c191..da7981c 100644
--- a/tests/test_md_tw.py
+++ b/tests/test_md_tw.py
@@ -90,6 +90,19 @@ class TestTWBlockLexer(object):
self._validate(tokens, 'heading', expected_lhs)
+ def test_parse_hrule(self):
+ tokens = self._parse('blexer-hrules.md')
+
+ expected_hrs = [
+ '* * *\n\n',
+ '***\n\n',
+ '*****\n\n',
+ '- - -\n\n',
+ '---------------------------------------\n\n'
+ ]
+
+ self._validate(tokens, 'hrule', expected_hrs)
+
def teardown(self):
pass