From: Bernardo Innocenti Date: Sun, 23 Sep 2007 00:50:18 +0000 (+0200) Subject: Add inline HTML. X-Git-Tag: v2.0~3 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=25befe4147c23d55b1ef3fc8af45c719e2e39f8c;p=geekigeeki.git Add inline HTML. --- diff --git a/geekigeeki.py b/geekigeeki.py index 71ce724..46c61c5 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -337,6 +337,7 @@ class PageFormatter: self.raw = raw self.is_em = self.is_b = 0 self.h_level = 0 + self.h_count = 0 self.list_indents = [] self.in_pre = False self.in_table = False @@ -354,20 +355,16 @@ class PageFormatter: def _tit_repl(self, word): if self.h_level: - result = "" % self.h_level + result = "" % self.h_level self.h_level = 0 else: self.h_level = len(word) - 1 - result = "" % self.h_level + self.h_count += 1 + result = '' % (self.h_count, self.h_level, self.h_count) return result def _rule_repl(self, word): - s = self._undent() - if len(word) <= 3: - s = s + "\n
\n" - else: - s = s + "\n
\n" % (len(word) - 2 ) - return s + return self._undent() + '\n
\n' % (len(word) - 2) def _word_repl(self, word): return Page(word).link_to() @@ -402,17 +399,17 @@ class PageFormatter: def _email_repl(self, word): return '
%s' % (word, word) + def _html_repl(self, word): + return word; # Pass through def _ent_repl(self, s): return {'&': '&', '<': '<', '>': '>'}[s] - def _li_repl(self, match): return '
  • ' - def _pre_repl(self, word): if word == '{{{' and not self.in_pre: self.in_pre = True @@ -501,6 +498,7 @@ class PageFormatter: + r"(?P'{2,3})" + r"|(?P\={2,6})" + r"|(?P^-{3,})" + + r"|(?P<(/|)(div|span|iframe)[^<>]*>)" + r"|(?P[<>&])" + r"|(?P\b(FIXME|TODO|DONE)\b)"