From ce118d6418eda1a41f5f2446ffc1ed833ba07dbb Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 23 Jun 2013 08:47:02 +0100 Subject: Allow MarkdownParser to parse multiple files Reported-by: Daniel Silverstone --- yarnlib/mdparser.py | 2 +- yarnlib/mdparser_tests.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'yarnlib') diff --git a/yarnlib/mdparser.py b/yarnlib/mdparser.py index 6708369..9917f8b 100644 --- a/yarnlib/mdparser.py +++ b/yarnlib/mdparser.py @@ -67,7 +67,7 @@ class MarkdownParser(object): ext = ParseScenarioTestBlocks() f = StringIO.StringIO() markdown.markdown(text, output=f, extensions=[ext]) - self.blocks = ext.blocks + self.blocks.extend(ext.blocks) def parse_file(self, filename): # pragma: no cover with open(filename) as f: diff --git a/yarnlib/mdparser_tests.py b/yarnlib/mdparser_tests.py index af0c7af..a9b9cb7 100644 --- a/yarnlib/mdparser_tests.py +++ b/yarnlib/mdparser_tests.py @@ -82,3 +82,12 @@ More text. ''') self.assertEqual(self.parser.blocks, ['this is a code block\n']) + def test_parses_multiple_files(self): + self.parser.parse_string(''' + block 1 +''') + self.parser.parse_string(''' + block 2 +''') + self.assertEqual(self.parser.blocks, ['block 1\n', 'block 2\n']) + -- cgit v1.2.1