summaryrefslogtreecommitdiffstats
path: root/md_tw.py
diff options
context:
space:
mode:
Diffstat (limited to 'md_tw.py')
-rw-r--r--md_tw.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/md_tw.py b/md_tw.py
index bd9d991..6c73903 100644
--- a/md_tw.py
+++ b/md_tw.py
@@ -18,6 +18,7 @@
# along with markdown-textwrap (see COPYING). If not, see
# <http://www.gnu.org/licenses/>.
+import re
import textwrap
import mistune
@@ -29,6 +30,13 @@ class TWBlockLexer(mistune.BlockLexer):
def __init__(self, rules=None, **kwargs):
super(TWBlockLexer, self).__init__(rules, **kwargs)
+ # from mistune
+ self._key_pattern = re.compile(r'\s+')
+
+ # from mistune
+ def _keyify(self, key):
+ key = mistune.escape(key.lower(), quote=True)
+ return self._key_pattern.sub(' ', key)
class TWInlineLexer(mistune.InlineLexer):