From: Bernardo Innocenti Date: Fri, 28 Mar 2008 08:26:28 +0000 (+0100) Subject: Fix a few XHTML validation errors X-Git-Tag: v3.0~27 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=dfa7879fd3551cd71fe2977ca3146833189b90cf;p=geekigeeki.git Fix a few XHTML validation errors --- diff --git a/geekigeeki.py b/geekigeeki.py index 7695228..7688860 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -332,7 +332,7 @@ class PageFormatter: 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 @@ -356,12 +356,12 @@ class PageFormatter: def _tit_repl(self, word): if self.h_level: - result = '' % self.h_level + result = '

\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 = '¶ ' % (self.h_level, abridged, abridged) + result = '\n

¶ ' % (self.h_level, abridged, abridged) return result def _br_repl(self, word): @@ -413,7 +413,11 @@ class PageFormatter: '>': '>'}[s] def _li_repl(self, match): - return '
  • ' + if self.in_li: + return '
  • ' + else: + self.in_li = True + return '
  • ' def _pre_repl(self, word): if word == '{{{' and not self.in_pre: @@ -456,6 +460,9 @@ class PageFormatter: s = '

    ' while self._indent_level() > new_level: del(self.list_indents[-1]) + if self.in_li: + s += '
  • ' + self.in_li = False # FIXME s += '\n' while self._indent_level() < new_level: self.list_indents.append(new_level) @@ -609,6 +616,7 @@ class Page: 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)