mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Explicitly disallow duplications of URL and save_as.
This commit is contained in:
parent
83afc5e214
commit
24a1254f03
1 changed files with 15 additions and 1 deletions
|
|
@ -31,6 +31,20 @@ except ImportError:
|
||||||
# This means that _filter_discardable_metadata() must be called on processed
|
# This means that _filter_discardable_metadata() must be called on processed
|
||||||
# metadata dicts before use, to remove the items with the special value.
|
# metadata dicts before use, to remove the items with the special value.
|
||||||
_DISCARD = object()
|
_DISCARD = object()
|
||||||
|
|
||||||
|
DUPLICATES_DEFINITIONS_ALLOWED = {
|
||||||
|
'tags': False,
|
||||||
|
'date': False,
|
||||||
|
'modified': False,
|
||||||
|
'status': False,
|
||||||
|
'category': False,
|
||||||
|
'author': False,
|
||||||
|
'save_as': False,
|
||||||
|
'URL': False,
|
||||||
|
'authors': False,
|
||||||
|
'slug': False
|
||||||
|
}
|
||||||
|
|
||||||
METADATA_PROCESSORS = {
|
METADATA_PROCESSORS = {
|
||||||
'tags': lambda x, y: ([
|
'tags': lambda x, y: ([
|
||||||
Tag(tag, y)
|
Tag(tag, y)
|
||||||
|
|
@ -264,7 +278,7 @@ class MarkdownReader(BaseReader):
|
||||||
self._md.reset()
|
self._md.reset()
|
||||||
formatted = self._md.convert(formatted_values)
|
formatted = self._md.convert(formatted_values)
|
||||||
output[name] = self.process_metadata(name, formatted)
|
output[name] = self.process_metadata(name, formatted)
|
||||||
elif name in METADATA_PROCESSORS:
|
elif not DUPLICATES_DEFINITIONS_ALLOWED.get(name, True):
|
||||||
if len(value) > 1:
|
if len(value) > 1:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'Duplicate definition of `%s` '
|
'Duplicate definition of `%s` '
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue