From c14195a0a2e6f9b234cdc247507c2609943498c5 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 13 Jan 2019 11:59:36 +0200 Subject: Fix: undo HTML escaping of code blocks --- yarnlib/mdparser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'yarnlib') diff --git a/yarnlib/mdparser.py b/yarnlib/mdparser.py index 4bd59d3..67851ec 100644 --- a/yarnlib/mdparser.py +++ b/yarnlib/mdparser.py @@ -17,6 +17,7 @@ import logging +import HTMLParser import markdown import StringIO from markdown.treeprocessors import Treeprocessor @@ -40,10 +41,12 @@ class GatherCodeBlocks(Treeprocessor): self.blocks = blocks def run(self, root): + h = HTMLParser.HTMLParser() for child in root.getchildren(): if child.tag == 'pre': code = child.find('code') - self.blocks.append(code.text) + text = h.unescape(code.text) + self.blocks.append(text) return root # This is the Python Markdown extension to call the code block -- cgit v1.2.1