def __init__(self, raw):
self.raw = raw
self.h_level = 0
- self.in_pre = self.in_table = False
+ self.in_pre = self.in_table = self.in_li = False
self.in_header = True
self.list_indents = []
self.tr_cnt = 0
def _tit_repl(self, word):
if self.h_level:
- result = '</h%d>' % self.h_level
+ result = '</h%d><p>\n' % self.h_level
self.h_level = 0
else:
self.h_level = len(word) - 1
abridged = re.sub('[^A-Za-z0-9_]', '', self.line).lower()
- result = '<h%d id="%s"><a class="heading" href="#%s">¶</a> ' % (self.h_level, abridged, abridged)
+ result = '\n</p><h%d id="%s"><a class="heading" href="#%s">¶</a> ' % (self.h_level, abridged, abridged)
return result
def _br_repl(self, word):
'>': '>'}[s]
def _li_repl(self, match):
- return '<li>'
+ if self.in_li:
+ return '</li><li>'
+ else:
+ self.in_li = True
+ return '<li>'
def _pre_repl(self, word):
if word == '{{{' and not self.in_pre:
s = '</p>'
while self._indent_level() > new_level:
del(self.list_indents[-1])
+ if self.in_li:
+ s += '</li>'
+ self.in_li = False # FIXME
s += '</ul>\n'
while self._indent_level() < new_level:
self.list_indents.append(new_level)
return self.get_attrs().get(name, default)
def can(self, action, default=True):
+ acl = None
try:
#acl SomeUser:read,write All:read
acl = self.get_attr("acl", None)