Skip to content
Permalink
Browse files

Also return extractor for two-file posts.

  • Loading branch information
felixfontein committed May 4, 2018
1 parent 49aa484 commit 7580ed2a5cf9fc7352203c1d866753c4c1ce7a43
Showing with 5 additions and 3 deletions.
  1. +5 −3 nikola/post.py
@@ -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):
@@ -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 = {}

0 comments on commit 7580ed2

Please sign in to comment.