From 41d91513a74e4b228fca2c6270098674ed00745b Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Wed, 8 Apr 2009 21:56:51 +0200 Subject: [PATCH] Disallow legacy syntax inside HTML blocks --- geekigeeki.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/geekigeeki.py b/geekigeeki.py index 38870c8..c87429b 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -155,7 +155,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal print ' ' + link_tag('?fullsearch=' + name, text, 'navlink') + ' ' else: print ' ' + text + ' ' - print ' | ' + link_tag('FrontPage', 'Home', 'navlink') + print ' | ' + link_tag('FrontPage','Home', 'navlink') print ' | ' + link_tag('FindPage', 'Find Page', 'navlink') if 'history_url' in globals(): print ' | Recent Changes' @@ -326,9 +326,9 @@ class WikiFormatter: "__": ["u", False], "^^": ["sup", False], ",,": ["sub", False], - "''": ["em", False], # OBSOLETE - "'''": ["b", False], # OBSOLETE - "``": ["tt", False], # OBSOLETE + "''": ["em", False], # LEGACY + "'''": ["b", False], # LEGACY + "``": ["tt", False], # LEGACY } def _b_repl(self, word): @@ -379,12 +379,6 @@ class WikiFormatter: m = link_re.match(word) return link_tag(m.group(1), m.group(2)) - def _url_repl(self, word): - return link_tag(word) - - def _word_repl(self, word): - return link_tag(word) - def _inl_repl(self, word): m = link_re.match(word) name = relative_url(m.group(1)) @@ -405,12 +399,6 @@ class WikiFormatter: else: return '' % (name, name) - def _img_repl(self, word): - return self._inl_repl('{{' + word + '}}') - - def _email_repl(self, word): - return '%s' % (word, word) - def _html_repl(self, word): self.in_html += 1 return word; # Pass through @@ -426,6 +414,21 @@ class WikiFormatter: '<': '<', '>': '>'}[s] + def _img_repl(self, word): # LEGACY + return self._inl_repl('{{' + word + '}}') + + def _word_repl(self, word): # LEGACY + if self.in_html: return word # pass through + return link_tag(word) + + def _url_repl(self, word): # LEGACY + if self.in_html: return word # pass through + return link_tag(word) + + def _email_repl(self, word): # LEGACY + if self.in_html: return word # pass through + return '%s' % (word, word) + def _li_repl(self, match): if self.in_li: return '
  • ' -- 2.25.1