diff --git a/pages/management/commands/parse_markdown.py b/pages/management/commands/parse_markdown.py index 8c193df..105b004 100644 --- a/pages/management/commands/parse_markdown.py +++ b/pages/management/commands/parse_markdown.py @@ -13,11 +13,13 @@ class Command(BaseCommand): for file in files: subdir = root.replace(MARKDOWN_PATH, "") mdfile = '%s/%s' % (root, file) - mdname = '%s/%s' % (subdir, os.path.splitext(file)[0]) + mdtuple = os.path.splitext(file) + mdname = '%s/%s' % (subdir, mdtuple[0]) htmlpath = '%s/templates/html_pages/%s' % (DEPLOY_PATH, mdname) htmlfile = '%s/index.html' % htmlpath - if os.path.exists(mdfile) and not os.path.exists(htmlfile) \ + if mdtuple[1] == '.mdwn' \ + and os.path.exists(mdfile) and not os.path.exists(htmlfile) \ or os.path.getmtime(mdfile) > os.path.getmtime(htmlfile): if not os.path.exists(htmlpath): @@ -26,6 +28,8 @@ class Command(BaseCommand): md = markdown.Markdown() print 'Converting ', mdname, '-->', htmlfile, wikiExtension = 'wikilinks(base_url=%s/)' % subdir - markdown.markdownFromFile(input=mdfile, output=htmlfile, encoding="utf-8", extensions=[wikiExtension]) + markdown.markdownFromFile(input=mdfile, output=htmlfile, + encoding="utf-8", + extensions=[wikiExtension]) print ' ... succeeded'