diff options
author | Tom Willemsen | 2011-11-05 02:17:51 +0100 |
---|---|---|
committer | Tom Willemsen | 2011-11-05 02:17:51 +0100 |
commit | f426a2f8efd7b91219e28514976a11ec55e4bf28 (patch) | |
tree | 98ca68f0bbb75787df4c4efb321f97bcf9d0d521 /pages/management | |
parent | cb59bfad718fb4c434acd3280eba01dc734e74e4 (diff) | |
download | dotfiles-f426a2f8efd7b91219e28514976a11ec55e4bf28.tar.gz dotfiles-f426a2f8efd7b91219e28514976a11ec55e4bf28.zip |
Only parse mdwn files
Diffstat (limited to 'pages/management')
-rw-r--r-- | pages/management/commands/parse_markdown.py | 10 |
1 files 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' |