summaryrefslogtreecommitdiffstats
path: root/pages/management/commands/parse_markdown.py
diff options
context:
space:
mode:
Diffstat (limited to 'pages/management/commands/parse_markdown.py')
-rw-r--r--pages/management/commands/parse_markdown.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/pages/management/commands/parse_markdown.py b/pages/management/commands/parse_markdown.py
deleted file mode 100644
index 23ad2ec..0000000
--- a/pages/management/commands/parse_markdown.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import os
-import markdown
-
-from django.core.management.base import BaseCommand, CommandError
-
-from settings import MARKDOWN_PATH, DEPLOY_PATH
-
-class Command(BaseCommand):
- help = 'Parse markdown files in %s' % MARKDOWN_PATH
-
- def handle(self, *args, **options):
- for root, dirs, files in os.walk(MARKDOWN_PATH):
- for file in files:
- subdir = root.replace(MARKDOWN_PATH, "")
- mdfile = '%s/%s' % (root, file)
- 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 options['verbosity'] == '3':
- print 'Subdir: ', subdir
- print 'Mdfile: ', mdfile
- print 'Mdtuple: ', mdtuple
- print 'Htmlpath: ', htmlpath
- print 'Htmlfile: ', 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)
-
- md = markdown.Markdown()
- print 'Converting ', mdname, '-->', htmlfile,
- wikilinks = 'wikilinks(base_url=%s/)' % subdir
- def_list = 'def_list'
- markdown.markdownFromFile(input=mdfile, output=htmlfile, encoding="utf-8",
- extensions=[wikilinks, def_list])
- print ' ... succeeded'
-