lost-train/patch/pelican_readers.patch

28 lines
1.2 KiB
Diff

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.setdefault('title', title)
> metadata = self._parse_metadata(pub.document, source_path, nowarning_about_missing_title=False)
> else:
> metadata = self._parse_metadata(pub.document, source_path, nowarning_about_missing_title=True)