Skip to content
Permalink
Browse files
Using nikola.utils.write_metadata.
  • Loading branch information
felixfontein committed May 2, 2018
1 parent 4e045cc commit 3881184b59721f74b1111960b796e178f50b460f
Showing with 3 additions and 15 deletions.
  1. +3 −15 v8/upgrade_metadata_v8/upgrade_metadata_v8.py
@@ -147,21 +147,9 @@ def _execute(self, options, args):
continue

# Recombine metadata with post text if necessary, and write back to file
meta_str = extractor.write_metadata(meta)
print(meta_str)
if not is_two_file:
if extractor.name == 'nikola':
final_str = meta_str + '\n\n' + content_str
elif extractor.name == 'yaml':
final_str = meta_str + '\n---\n' + content_str
elif extractor.name == 'toml':
final_str = meta_str + '\n+++\n' + content_str
else:
L.error("Cannot convert {0} (language {1}): don't know how to recombine metadata with text for the {2} extractor!".format(fname, lang, extractor.name))
fully_converted = False
continue
else:
final_str = meta_str
meta_str = utils.write_metadata(meta, metadata_format=extractor.name, compiler=post.compiler,
comment_wrap=True, site=self.site)
final_str = meta_str if is_two_file else (meta_str + content_str)

with io.open(fname, "w", encoding="utf-8-sig") as meta_file:
meta_file.write(final_str)

0 comments on commit 3881184

Please sign in to comment.