Slight optimization
This commit is contained in:
parent
e7db190fca
commit
7a7e135f2b
12
meta_yaml.py
12
meta_yaml.py
@ -96,14 +96,10 @@ class MetaYamlPreprocessor(Preprocessor):
|
|||||||
lines.insert(0, line)
|
lines.insert(0, line)
|
||||||
if yaml_block:
|
if yaml_block:
|
||||||
meta = yaml.load("\n".join(yaml_block), Loader)
|
meta = yaml.load("\n".join(yaml_block), Loader)
|
||||||
# case-insensitize meta data keys:
|
|
||||||
meta = {
|
# Compat with PyMarkdown's meta: Keys are lowercase, values are lists
|
||||||
k.lower(): meta[k] for k in meta
|
meta = {k.lower(): v if isinstance(v, list) else [v] for k, v in meta.items()}
|
||||||
}
|
|
||||||
# PyMarkdown's Meta compat: ensure everything's a list
|
|
||||||
meta = {
|
|
||||||
k: v if isinstance(v, list) else [v] for k, v in meta.items()
|
|
||||||
}
|
|
||||||
self.markdown.Meta = meta
|
self.markdown.Meta = meta
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user