pelican updated 4.5.4 + patch re-generated. + pandoc plugin installed
This commit is contained in:
parent
616ed8f90f
commit
590f2e4e4f
2 changed files with 44 additions and 28 deletions
|
|
@ -1,27 +1,42 @@
|
||||||
230c230
|
--- /home/knut/.pyenv/versions/pelican/lib/python3.8/site-packages/pelican/readers.py.old 2021-01-16 21:53:36.342103461 +0900
|
||||||
< def _parse_metadata(self, document, source_path):
|
+++ /home/knut/.pyenv/versions/pelican/lib/python3.8/site-packages/pelican/readers.py 2021-01-16 22:06:47.699735450 +0900
|
||||||
---
|
@@ -210,17 +210,18 @@
|
||||||
> def _parse_metadata(self, document, source_path, nowarning_about_missing_title):
|
" Using 'en' instead.", lang_code)
|
||||||
236,240c236,241
|
self._language_code = 'en'
|
||||||
< if document.first_child_matching_class(docutils.nodes.title) is None:
|
|
||||||
< logger.warning(
|
- def _parse_metadata(self, document, source_path):
|
||||||
< 'Document title missing in file %s: '
|
+ def _parse_metadata(self, document, source_path, nowarning_about_missing_title):
|
||||||
< 'Ensure exactly one top level section',
|
"""Return the dict containing document metadata"""
|
||||||
< source_path)
|
formatted_fields = self.settings['FORMATTED_FIELDS']
|
||||||
---
|
|
||||||
> if nowarning_about_missing_title is False:
|
output = {}
|
||||||
> if document.first_child_matching_class(docutils.nodes.title) is None:
|
|
||||||
> logger.warning(
|
- if document.first_child_matching_class(docutils.nodes.title) is None:
|
||||||
> 'Document title missing in file %s: '
|
- logger.warning(
|
||||||
> 'Ensure exactly one top level section',
|
- 'Document title missing in file %s: '
|
||||||
> source_path)
|
- 'Ensure exactly one top level section',
|
||||||
293,294c293,298
|
- source_path)
|
||||||
< metadata = self._parse_metadata(pub.document, source_path)
|
+ if nowarning_about_missing_title is False:
|
||||||
< metadata.setdefault('title', parts.get('title'))
|
+ if document.first_child_matching_class(docutils.nodes.title) is None:
|
||||||
---
|
+ logger.warning(
|
||||||
> title = parts.get('title')
|
+ 'Document title missing in file %s: '
|
||||||
> if title:
|
+ 'Ensure exactly one top level section',
|
||||||
> metadata = self._parse_metadata(pub.document, source_path, nowarning_about_missing_title=False)
|
+ source_path)
|
||||||
> metadata.setdefault('title', title)
|
|
||||||
> else:
|
for docinfo in document.traverse(docutils.nodes.docinfo):
|
||||||
> metadata = self._parse_metadata(pub.document, source_path, nowarning_about_missing_title=True)
|
for element in docinfo.children:
|
||||||
|
@@ -272,8 +273,12 @@
|
||||||
|
parts = pub.writer.parts
|
||||||
|
content = parts.get('body')
|
||||||
|
|
||||||
|
- metadata = self._parse_metadata(pub.document, source_path)
|
||||||
|
- metadata.setdefault('title', parts.get('title'))
|
||||||
|
+ title = parts.get('title')
|
||||||
|
+ if title:
|
||||||
|
+ metadata = self._parse_metadata(pub.document, source_path, nowarning_about_missing_title=False)
|
||||||
|
+ metadata.setdefault('title', title)
|
||||||
|
+ else:
|
||||||
|
+ metadata = self._parse_metadata(pub.document, source_path, nowarning_about_missing_title=True)
|
||||||
|
|
||||||
|
return content, metadata
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
pelican ~= 4.2.0
|
pelican ~= 4.5.4
|
||||||
markdown
|
markdown
|
||||||
typogrify
|
typogrify
|
||||||
pathlib
|
pathlib
|
||||||
virtualenv
|
virtualenv
|
||||||
webassets
|
webassets
|
||||||
|
pelican-pandoc-reader
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue