From b35117b36895756571a23c71b3379a4c2efa06e4 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Sun, 5 Oct 2008 21:47:58 -0400 Subject: drop references to the wiki --- wiki/templatetags/wikitags.py | 60 ------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 wiki/templatetags/wikitags.py (limited to 'wiki/templatetags/wikitags.py') diff --git a/wiki/templatetags/wikitags.py b/wiki/templatetags/wikitags.py deleted file mode 100644 index da662e8..0000000 --- a/wiki/templatetags/wikitags.py +++ /dev/null @@ -1,60 +0,0 @@ -from django.template import Library -from django.conf import settings -from archweb_dev.main import markdown -import re - -register = Library() - -class WikiProcessor: - def run(self, lines): - in_table = False - for i in range(len(lines)): - # Linebreaks - lines[i] = re.sub("%%", "
", lines[i]) - # Internal Links - lines[i] = re.sub("\(\(([A-z0-9 :/-]+)\)\)", "\\1", lines[i]) - # Small Text - lines[i] = re.sub("----([^----]+)----", "\\1", lines[i]) - lines[i] = re.sub("--([^--]+)--", "\\1", lines[i]) - # TT text - lines[i] = re.sub("\{\{([^}\}]+)\}\}", "\\1", lines[i]) - # Tables - m = re.match("(\|\|)", lines[i]) - if m: - count = len(re.findall("(\|\|+)", lines[i])) - first = True - m2 = re.search("(\|\|+)", lines[i]) - while m2 and count: - count -= 1 - colspan = len(m2.group(1)) / 2 - if first: - repl = "" % (colspan) - first = False - elif count == 0: - repl = "" - else: - repl = "" % (colspan) - lines[i] = re.sub("(\|\|+)", repl, lines[i], 1) - # find the next chunk - m2 = re.search("(\|\|+)", lines[i]) - lines[i] = "" + lines[i] + "" - if not in_table: - lines[i] = "" + lines[i] - in_table = True - elif in_table: - lines[i] = "
" + lines[i] - in_table = False - # close leftover table, if open - if in_table: - lines[len(lines)] = lines[len(lines)] + "" - return lines - -@register.filter -def wikify(value): - md = markdown.Markdown(value) - md.preprocessors.insert(0, WikiProcessor()) - html = md.toString() - return html - -# vim: set ts=4 sw=4 et: - -- cgit v1.2.3-24-g4f1b