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 = "