Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Preparing work on plugin for #2761. Adds message and sets a flag for …
…old-style metadata.
  • Loading branch information
felixfontein committed May 2, 2018
1 parent af3c6a1 commit 172c0d6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nikola/post.py
Expand Up @@ -243,6 +243,7 @@ def __init__(
is_private = False
post_status = 'published'
self._tags = {}
self.has_oldstyle_metadata_tags = False
for lang in self.translated_to:
if isinstance(self.meta[lang]['tags'], (list, tuple, set)):
_tag_list = self.meta[lang]['tags']
Expand Down Expand Up @@ -282,20 +283,27 @@ def __init__(
show_warning = True
if show_warning:
LOGGER.warn('It is suggested that you convert special tags to metadata and set '
'USE_TAG_METADATA to False. Change the WARN_ABOUT_TAG_METADATA '
'USE_TAG_METADATA to False. You can use the upgrade_metadata_v8 '
'command plugin for conversion (install with: nikola plugin -i '
'upgrade_metadata_v8). Change the WARN_ABOUT_TAG_METADATA '
'configuration to disable this warning.')
if self.config['USE_TAG_METADATA']:
if 'draft' in [_.lower() for _ in self._tags[lang]]:
is_draft = True
LOGGER.debug('The post "{0}" is a draft.'.format(self.source_path))
self._tags[lang].remove('draft')
post_status = 'draft'
self.has_oldstyle_metadata_tags = True

if 'private' in self._tags[lang]:
is_private = True
LOGGER.debug('The post "{0}" is private.'.format(self.source_path))
self._tags[lang].remove('private')
post_status = 'private'
self.has_oldstyle_metadata_tags = True

if 'mathjax' in self._tags[lang]:
self.has_oldstyle_metadata_tags = True

# While draft comes from the tags, it's not really a tag
self.is_draft = is_draft
Expand Down

0 comments on commit 172c0d6

Please sign in to comment.