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
|
||||
< def _parse_metadata(self, document, source_path):
|
||||
---
|
||||
> def _parse_metadata(self, document, source_path, nowarning_about_missing_title):
|
||||
236,240c236,241
|
||||
< if document.first_child_matching_class(docutils.nodes.title) is None:
|
||||
< logger.warning(
|
||||
< 'Document title missing in file %s: '
|
||||
< 'Ensure exactly one top level section',
|
||||
< source_path)
|
||||
---
|
||||
> if nowarning_about_missing_title is False:
|
||||
> if document.first_child_matching_class(docutils.nodes.title) is None:
|
||||
> logger.warning(
|
||||
> 'Document title missing in file %s: '
|
||||
> 'Ensure exactly one top level section',
|
||||
> source_path)
|
||||
293,294c293,298
|
||||
< 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)
|
||||
--- /home/knut/.pyenv/versions/pelican/lib/python3.8/site-packages/pelican/readers.py.old 2021-01-16 21:53:36.342103461 +0900
|
||||
+++ /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 @@
|
||||
" Using 'en' instead.", lang_code)
|
||||
self._language_code = 'en'
|
||||
|
||||
- def _parse_metadata(self, document, source_path):
|
||||
+ def _parse_metadata(self, document, source_path, nowarning_about_missing_title):
|
||||
"""Return the dict containing document metadata"""
|
||||
formatted_fields = self.settings['FORMATTED_FIELDS']
|
||||
|
||||
output = {}
|
||||
|
||||
- if document.first_child_matching_class(docutils.nodes.title) is None:
|
||||
- logger.warning(
|
||||
- 'Document title missing in file %s: '
|
||||
- 'Ensure exactly one top level section',
|
||||
- source_path)
|
||||
+ if nowarning_about_missing_title is False:
|
||||
+ if document.first_child_matching_class(docutils.nodes.title) is None:
|
||||
+ logger.warning(
|
||||
+ 'Document title missing in file %s: '
|
||||
+ 'Ensure exactly one top level section',
|
||||
+ source_path)
|
||||
|
||||
for docinfo in document.traverse(docutils.nodes.docinfo):
|
||||
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
|
||||
typogrify
|
||||
pathlib
|
||||
virtualenv
|
||||
webassets
|
||||
pelican-pandoc-reader
|
||||
|
|
|
|||
Loading…
Reference in a new issue