X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=71ce72406f6b94893516fcb03862964f48e1bdeb;hb=746aad914bdc194bf3905b56d2339250fb11772f;hp=aa6d332a449e2b9b3ce481e38c0862f820ce67af;hpb=a0e866e20240e1b4c862a16c1ce798628985b823;p=geekigeeki.git diff --git a/geekigeeki.py b/geekigeeki.py index aa6d332..71ce724 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -264,10 +264,10 @@ def send_footer(name, mod_string=None): # ---------------------------------------------------------- # Macros -def _macro_TitleSearch(): +def _macro_TitleSearch(*vargs): return _macro_search("titlesearch") -def _macro_FullSearch(): +def _macro_FullSearch(*vargs): return _macro_search("fullsearch") def _macro_search(type): @@ -275,9 +275,9 @@ def _macro_search(type): default = form["value"].value else: default = '' - return """
""" % (type, default) + return """""" % (type, default) -def _macro_WordIndex(): +def _macro_WordIndex(*vargs): s = make_index_key() pages = list(page_list()) map = {} @@ -310,7 +310,7 @@ def _macro_WordIndex(): return s -def _macro_TitleIndex(): +def _macro_TitleIndex(*vargs): s = make_index_key() pages = list(page_list()) pages.sort() @@ -373,26 +373,31 @@ class PageFormatter: return Page(word).link_to() def _img_repl(self, word): - return '' % (script_name(), word) + path = script_name() + '/' + word; + return '' % (path, path) def _url_repl(self, word): if img_re.match(word): - return '' % word + return '' % (word, word) else: return '%s' % (word, word) def _hurl_repl(self, word): - m = re.compile("\[\[(\S+)\ (.+)\]\]").match(word) - anchor = m.group(1) - descr = m.group(2) - if img_re.match(anchor): - return '' % (anchor, descr) - elif url_re.match(anchor): - return '%s' % (anchor, descr) - elif anchor.startswith('/'): - return '%s' % (anchor, descr) + m = re.compile("\[\[(\S+)([^\]]*)\]\]").match(word) + name = m.group(1) + descr = m.group(2).strip() or name + + macro = globals().get('_macro_' + name) + if macro: + return apply(macro, (name, descr)) + elif img_re.match(name): + return '' % (name, name, descr) + elif url_re.match(name): + return '%s' % (name, descr) + elif name.startswith('/'): + return '%s' % (name, descr) else: - return link_tag(anchor, descr) + return link_tag(name, descr) def _email_repl(self, word): return '%s' % (word, word) @@ -417,8 +422,14 @@ class PageFormatter: return '' return '' - def _hilight_repl(self, word): - return '' + word + '' + def _hi_repl(self, word): + if word == 'FIXME': + cl = 'error' + elif word == 'DONE': + cl = 'success' + elif word == 'TODO': + cl = 'notice' + return '' + word + '' def _var_repl(self, word): if word == '{{' and not self.in_var: @@ -448,11 +459,6 @@ class PageFormatter: return '