summaryrefslogtreecommitdiff
path: root/yarnlib/mdparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'yarnlib/mdparser.py')
-rw-r--r--yarnlib/mdparser.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/yarnlib/mdparser.py b/yarnlib/mdparser.py
index 67851ec..9adf057 100644
--- a/yarnlib/mdparser.py
+++ b/yarnlib/mdparser.py
@@ -17,9 +17,9 @@
import logging
-import HTMLParser
+import html.parser
import markdown
-import StringIO
+import io
from markdown.treeprocessors import Treeprocessor
@@ -41,7 +41,7 @@ class GatherCodeBlocks(Treeprocessor):
self.blocks = blocks
def run(self, root):
- h = HTMLParser.HTMLParser()
+ h = html.parser.HTMLParser()
for child in root.getchildren():
if child.tag == 'pre':
code = child.find('code')
@@ -68,13 +68,12 @@ class MarkdownParser(object):
def parse_string(self, text):
ext = ParseScenarioTestBlocks()
- f = StringIO.StringIO()
+ f = io.StringIO()
markdown.markdown(text, output=f, extensions=[ext])
self.blocks.extend(ext.blocks)
return ext.blocks
def parse_file(self, filename): # pragma: no cover
with open(filename) as f:
- binary = f.read()
- text = binary.decode('utf-8')
+ text = f.read()
return self.parse_string(text)