forked from github/pelican
MarkdownReader: don't raise AttributeError on empty files
Markdown.convert() returns early, without running any preprocessors, if source.strip() is empty. Before, Pelican would raise AttributeError in this case; now, it logs a more friendly error: ERROR: Skipping ./foo.md: could not find information about 'NameError: title' which is more consistent with the error from empty .rst files: ERROR: Skipping ./foo.rst: could not find information about 'NameError: date'
This commit is contained in:
parent
5d860471ac
commit
904f57d9c3
1 changed files with 4 additions and 1 deletions
|
|
@ -288,7 +288,10 @@ class MarkdownReader(BaseReader):
|
|||
with pelican_open(source_path) as text:
|
||||
content = self._md.convert(text)
|
||||
|
||||
metadata = self._parse_metadata(self._md.Meta)
|
||||
if hasattr(self._md, 'Meta'):
|
||||
metadata = self._parse_metadata(self._md.Meta)
|
||||
else:
|
||||
metadata = {}
|
||||
return content, metadata
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue