From f426a2f8efd7b91219e28514976a11ec55e4bf28 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 5 Nov 2011 02:17:51 +0100 Subject: Only parse mdwn files --- pages/management/commands/parse_markdown.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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' -- cgit v1.2.3-54-g00ecf