aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-07-03 09:39:15 -0400
committerWaylan Limberg <waylan@gmail.com>2013-07-03 09:39:15 -0400
commit5529647cd03468a7d2ae085c86b397d2b2379ab8 (patch)
tree493a0db21050f9ecd6a6b7d7e7271dccf0201694
parent38436802c10406a2581929cb5707ce90379857e3 (diff)
downloadmarkdown-5529647cd03468a7d2ae085c86b397d2b2379ab8.tar.gz
markdown-5529647cd03468a7d2ae085c86b397d2b2379ab8.tar.bz2
markdown-5529647cd03468a7d2ae085c86b397d2b2379ab8.zip
MetaData no longer fails with no newline. Fixes #228.
-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. """