Optionally use an icon for the home link
[geekigeeki.git] / geekigeeki.py
index 4450aead0d3617848117f6c7ad6098a758b8877d..081517a64853ee460f3346b59ff04b201d706c8a 100755 (executable)
@@ -151,11 +151,11 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal
 
     # Navbar
     print '<div class="nav">'
+    print link_tag('FrontPage', relative_url(site_icon or 'Home'), 'navlink')
     if name:
         print '  <b>' + link_tag('?fullsearch=' + name, text, 'navlink') + '</b> '
     else:
         print '  <b>' + text + '</b> '
-    print ' | ' + link_tag('FrontPage', 'Home', 'navlink')
     print ' | ' + link_tag('FindPage', 'Find Page', 'navlink')
     if 'history_url' in globals():
         print ' | <a href="' + relative_url(history_url) + '" class="navlink">Recent Changes</a>'
@@ -175,7 +175,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal
 
     user = remote_user()
     if user != 'AnonymousCoward':
-        print ' | <span class="login"><i>logged in as <b>' + cgi.escape(user) + '</b></i></span>'
+        print ' | <span class="login"><i><b>' + link_tag('User/' + user, user) + '</b></i></span>'
 
     print '<hr /></div>'
 
@@ -321,14 +321,14 @@ class WikiFormatter:
         self.styles = {
             #wiki   html   enabled?
             "//":  ["em",  False],
-            "''":  ["em",  False],
             "**":  ["b",   False],
-            "'''": ["b",   False],
             "##":  ["tt",  False],
-            "``":  ["tt",  False],
             "__":  ["u",   False],
             "^^":  ["sup", False],
-            ",,":  ["sub", False]
+            ",,":  ["sub", False],
+            "''":  ["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 '<a href="%s"><img border="0" src="%s" /></a>' % (name, name)
 
-    def _img_repl(self, word):
-        return self._inl_repl('{{' + word + '}}')
-
-    def _email_repl(self, word):
-        return '<a href="mailto:%s">%s</a>' % (word, word)
-
     def _html_repl(self, word):
         self.in_html += 1
         return word; # Pass through
@@ -426,6 +414,21 @@ class WikiFormatter:
                 '<': '&lt;',
                 '>': '&gt;'}[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 '<a href="mailto:%s">%s</a>' % (word, word)
+
     def _li_repl(self, match):
         if self.in_li:
             return '</li><li>'