Skip to content

Commit

Permalink
advertise upgrade_metadata (cc @ralsina)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 9, 2015
1 parent 5e832c2 commit 6360997
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nikola/post.py
Expand Up @@ -69,6 +69,7 @@
__all__ = ['Post']

TEASER_REGEXP = re.compile('<!--\s*TEASER_END(:(.+))?\s*-->', re.IGNORECASE)
_UPGRADE_METADATA_ADVERTISED = False


class Post(object):
Expand Down Expand Up @@ -875,6 +876,7 @@ def _get_metadata_from_file(meta_data):

def get_metadata_from_meta_file(path, config=None, lang=None):
"""Takes a post path, and gets data from a matching .meta file."""
global _UPGRADE_METADATA_ADVERTISED
meta_path = os.path.splitext(path)[0] + '.meta'
if lang and config:
meta_path = get_translation_candidate(config, meta_path, lang)
Expand All @@ -897,6 +899,10 @@ def get_metadata_from_meta_file(path, config=None, lang=None):
# a 1-file post.
return get_metadata_from_file(path, config, lang), newstylemeta
else:
if not _UPGRADE_METADATA_ADVERTISED:
LOGGER.warn("Some posts on your site have old-style metadata. You should upgrade them to the new format, with support for extra fields.")
LOGGER.warn("Install the 'upgrade_metadata' plugin (with 'nikola plugin -i upgrade_metadata') and run 'nikola upgrade_metadata'.")
_UPGRADE_METADATA_ADVERTISED = True
while len(meta_data) < 7:
meta_data.append("")
(title, slug, date, tags, link, description, _type) = [
Expand Down

0 comments on commit 6360997

Please sign in to comment.