Skip to content

Commit

Permalink
Fix #3008 -- make compiler metadata less important
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 25, 2018
1 parent cb122fe commit 53b3761
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGES.txt
Expand Up @@ -61,7 +61,9 @@ Features
Bugfixes
--------

* Renamed ``DISABLE_INDEXES_PLUGIN_INDEX_AND_ATOM_FEED`` to ``DISABLE_INDEXES``
* Read file metadata if compiler metadata exists and prefer it over
compiler metadata (Issue #3008)
* Rename ``DISABLE_INDEXES_PLUGIN_INDEX_AND_ATOM_FEED`` to ``DISABLE_INDEXES``
and ``DISABLE_INDEXES_PLUGIN_RSS_FEED`` to ``DISABLE_MAIN_RSS_FEED`` (Issue #3039)
* Make chart shortcode its own plugin and make the reST directive
depend on it.
Expand Down
11 changes: 6 additions & 5 deletions nikola/post.py
Expand Up @@ -1012,9 +1012,9 @@ def get_meta(post, lang):
metadata_extractors_by = metadata_extractors.default_metadata_extractors_by()

# If meta file exists, use it
meta.update(get_metadata_from_meta_file(post.metadata_path, post, config, lang, metadata_extractors_by))
metafile_meta = get_metadata_from_meta_file(post.metadata_path, post, config, lang, metadata_extractors_by)

if not meta:
if not metafile_meta:
post.is_two_file = False

# Fetch compiler metadata.
Expand All @@ -1026,11 +1026,12 @@ def get_meta(post, lang):
used_extractor = post.compiler
meta.update(compiler_meta)

if not post.is_two_file and not compiler_meta:
# Meta file has precedence over file, which can contain garbage.
# Moreover, we should not read the file if we have compiler meta.
# Meta files and inter-file metadata override compiler metadata
if not post.is_two_file:
new_meta, used_extractor = get_metadata_from_file(post.source_path, post, config, lang, metadata_extractors_by)
meta.update(new_meta)
else:
meta.update(metafile_meta)

# Filename-based metadata extractors (fallback only)
if not meta:
Expand Down

0 comments on commit 53b3761

Please sign in to comment.