Only parse mdwn files

This commit is contained in:
Tom Willemsen 2011-11-05 02:17:51 +01:00
parent cb59bfad71
commit f426a2f8ef

View file

@ -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'