X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=f3ce1dcb3268d452e29c997c5a698040a15b58cf;hb=b36435d29f2dcaf6d3a2d19d21ca8b3c2c62c44d;hp=38870c8539c1bb39fc29b61be63878cefe0f635d;hpb=7bda2ec9a7e1a4869a00b0935ef89afa739b8f44;p=geekigeeki.git diff --git a/geekigeeki.py b/geekigeeki.py index 38870c8..f3ce1dc 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -3,7 +3,7 @@ # # Copyright 1999, 2000 Martin Pool # Copyright 2002 Gerardo Poggiali -# Copyright 2007, 2008 Bernie Innocenti +# Copyright 2007, 2008, 2009 Bernie Innocenti # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -151,11 +151,11 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal # Navbar print '' @@ -206,6 +206,13 @@ def link_tag(params, text=None, link_class=None, privileged=False): return '%s' % (classattr, relative_url(params, privileged=privileged), text) +def link_inline(name, descr=None, args=''): + if not descr: descr = name + if video_re.match(name): + return '' % name + else: + return '%s' % (name, name + args, descr) + # Search --------------------------------------------------- def handle_fullsearch(needle): @@ -326,9 +333,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 +386,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)) @@ -398,18 +399,11 @@ class WikiFormatter: args = '?' + '&'.join(argv) # The "extthumb" nonsense works around a limitation of the HTML block model - return '
%s
%s
' \ - % (name, name + args, descr, descr) - elif video_re.match(name): - return '' % name + return '
' \ + + link_inline(name, descr, args) \ + + '
' + descr + '
' else: - return '' % (name, name) - - def _img_repl(self, word): - return self._inl_repl('{{' + word + '}}') - - def _email_repl(self, word): - return '%s' % (word, word) + return link_inline(name, name) def _html_repl(self, word): self.in_html += 1 @@ -426,6 +420,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 '
  • '