Skip to content

Commit

Permalink
Also return extractor for two-file posts.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed May 4, 2018
1 parent 49aa484 commit 7580ed2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nikola/post.py
Expand Up @@ -1047,14 +1047,14 @@ def get_metadata_from_meta_file(path, post, config, lang, metadata_extractors_by
elif lang:
meta_path += '.' + lang
if os.path.isfile(meta_path):
return get_metadata_from_file(meta_path, post, config, lang, metadata_extractors_by)[0]
return get_metadata_from_file(meta_path, post, config, lang, metadata_extractors_by)
elif lang:
# Metadata file doesn't exist, but not default language,
# So, if default language metadata exists, return that.
# This makes the 2-file format detection more reliable (Issue #525)
return get_metadata_from_meta_file(meta_path, post, config, None, metadata_extractors_by)
else: # No 2-file metadata
return {}
return {}, None


def get_meta(post, lang):
Expand All @@ -1068,10 +1068,12 @@ def get_meta(post, lang):
metadata_extractors_by = metadata_extractors.default_metadata_extractors_by()

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

if not metafile_meta:
post.is_two_file = False
else:
used_extractor = metafile_extractor

# Fetch compiler metadata.
compiler_meta = {}
Expand Down

0 comments on commit 7580ed2

Please sign in to comment.