aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/extensions/meta.py2
-rw-r--r--tests/test_extensions.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/markdown/extensions/meta.py b/markdown/extensions/meta.py
index aaff436..c4a4b21 100644
--- a/markdown/extensions/meta.py
+++ b/markdown/extensions/meta.py
@@ -65,7 +65,7 @@ class MetaPreprocessor(Preprocessor):
""" Parse Meta-Data and store in Markdown.Meta. """
meta = {}
key = None
- while 1:
+ while lines:
line = lines.pop(0)
if line.strip() == '':
break # blank line - done
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index cce2adf..4eb600b 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -297,6 +297,13 @@ The body. This is paragraph one.'''
'</code></pre>')
self.assertEqual(self.md.Meta, {})
+ def testMetaDataWithoutNewline(self):
+ """ Test doocument with only metadata and no newline at end."""
+ text = 'title: No newline'
+ self.assertEqual(self.md.convert(text), '')
+ self.assertEqual(self.md.Meta, {'title': ['No newline']})
+
+
class TestWikiLinks(unittest.TestCase):
""" Test Wikilinks Extension. """