mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Simplier metadata processing, using dict's 'get' method with default value.
This commit is contained in:
parent
3decf7f519
commit
658e1203b2
1 changed files with 3 additions and 5 deletions
|
|
@ -51,11 +51,9 @@ class MarkdownReader(object):
|
|||
metadatas = {}
|
||||
for name, value in md.Meta.items():
|
||||
name = name.lower()
|
||||
if name in _METADATAS_FIELDS:
|
||||
meta = _METADATAS_FIELDS[name](value[0])
|
||||
else:
|
||||
meta = value[0]
|
||||
metadatas[name] = meta
|
||||
metadatas[name] = _METADATAS_FIELDS.get(
|
||||
name, lambda x:x
|
||||
)(value[0])
|
||||
return content, metadatas
|
||||
|
||||
_EXTENSIONS = {'rst': RstReader, 'md': MarkdownReader} # supported formats
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue