From 186d47fe849e03766427557a14ea1cd44c2c5623 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 5 Nov 2011 02:23:26 +0100 Subject: Only check time if it exists --- pages/management/commands/parse_markdown.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'pages/management/commands/parse_markdown.py') diff --git a/pages/management/commands/parse_markdown.py b/pages/management/commands/parse_markdown.py index 105b004..500087a 100644 --- a/pages/management/commands/parse_markdown.py +++ b/pages/management/commands/parse_markdown.py @@ -18,9 +18,9 @@ class Command(BaseCommand): htmlpath = '%s/templates/html_pages/%s' % (DEPLOY_PATH, mdname) htmlfile = '%s/index.html' % htmlpath - 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 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): os.makedirs(htmlpath) @@ -28,8 +28,7 @@ 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", + markdown.markdownFromFile(input=mdfile, output=htmlfile, encoding="utf-8", extensions=[wikiExtension]) print ' ... succeeded' -- cgit v1.2.3-54-g00ecf