diff options
author | David Chambers <David.Chambers.05@gmail.com> | 2011-02-17 00:15:18 -0800 |
---|---|---|
committer | David Chambers <David.Chambers.05@gmail.com> | 2011-02-17 00:15:18 -0800 |
commit | cf76cc82b24feb13ec006cb0b560b7b207e60338 (patch) | |
tree | 773fcdb48d4d5a725815357d99890566b17fbd23 | |
parent | 9fa60ed5f06d58270c0e6804fb39a50b69bedeab (diff) | |
download | markdown-cf76cc82b24feb13ec006cb0b560b7b207e60338.tar.gz markdown-cf76cc82b24feb13ec006cb0b560b7b207e60338.tar.bz2 markdown-cf76cc82b24feb13ec006cb0b560b7b207e60338.zip |
Added an alternative meta list syntax.
Implicit syntax (existing):
tag: Python
Markdown
Explicit syntax (new):
tag: Python
tag: Markdown
These two examples are now equivalent. Previously, the latter would produce
`{u'tag': [u'Markdown']}` rather than `{u'tag': [u'Python', u'Markdown']}`.
-rw-r--r-- | markdown/extensions/meta.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/markdown/extensions/meta.py b/markdown/extensions/meta.py index e0c2414..8983fc8 100644 --- a/markdown/extensions/meta.py +++ b/markdown/extensions/meta.py @@ -70,7 +70,11 @@ class MetaPreprocessor(markdown.preprocessors.Preprocessor): m1 = META_RE.match(line) if m1: key = m1.group('key').lower().strip() - meta[key] = [m1.group('value').strip()] + value = m1.group('value').strip() + try: + meta[key].append(value) + except KeyError: + meta[key] = [value] else: m2 = META_MORE_RE.match(line) if m2 and key: |