reorg coil gen posts + new theme
This commit is contained in:
parent
650f7ceb04
commit
ad3bcc971e
79 changed files with 14597 additions and 25 deletions
|
|
@ -7,6 +7,6 @@ MinVersion = 7.4.0
|
|||
|
||||
[Documentation]
|
||||
Author = Chris Warrick
|
||||
Version = 0.1.2
|
||||
Version = 0.1.3
|
||||
Website = http://plugins.getnikola.com/#upgrade_metadata
|
||||
Description = Upgrade old-style metadata
|
||||
|
|
|
|||
|
|
@ -70,22 +70,23 @@ class UpgradeMetadata(Command):
|
|||
yesno = utils.ask_yesno("Proceed with metadata upgrade?")
|
||||
if options['yes'] or yesno:
|
||||
for post in flagged:
|
||||
for lang in post.translated_to:
|
||||
for lang in self.site.config['TRANSLATIONS'].keys():
|
||||
if lang == post.default_lang:
|
||||
fname = post.metadata_path
|
||||
else:
|
||||
meta_path = os.path.splitext(post.source_path)[0] + '.meta'
|
||||
fname = utils.get_translation_candidate(post.config, meta_path, lang)
|
||||
|
||||
with io.open(fname, 'r', encoding='utf-8') as fh:
|
||||
meta = fh.readlines()
|
||||
if os.path.exists(fname):
|
||||
with io.open(fname, 'r', encoding='utf-8') as fh:
|
||||
meta = fh.readlines()
|
||||
|
||||
if not meta[1].startswith('.. '):
|
||||
# check if we’re dealing with old style metadata
|
||||
with io.open(fname, 'w', encoding='utf-8') as fh:
|
||||
for k, v in zip(self.fields, meta):
|
||||
fh.write('.. {0}: {1}'.format(k, v))
|
||||
L.debug(fname)
|
||||
if not meta[min(1, len(meta) - 1)].startswith('.. '):
|
||||
# check if we’re dealing with old style metadata
|
||||
with io.open(fname, 'w', encoding='utf-8') as fh:
|
||||
for k, v in zip(self.fields, meta):
|
||||
fh.write('.. {0}: {1}'.format(k, v))
|
||||
L.debug(fname)
|
||||
|
||||
L.info('{0} posts upgraded.'.format(len(flagged)))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue