Skip to content

Commit

Permalink
Using nikola.utils.write_metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed May 2, 2018
1 parent 4e045cc commit 3881184
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions v8/upgrade_metadata_v8/upgrade_metadata_v8.py
Expand Up @@ -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)
Expand Down

0 comments on commit 3881184

Please sign in to comment.