From a8cdeeed7e87a195c5e9e0b1e2b74e6b04da1109 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Fri, 8 Aug 2008 12:18:43 +0545 Subject: [PATCH] Add favicon support --- geekigeeki.conf.py | 25 +++++++++++++++++++------ geekigeeki.py | 25 ++++++++++++++++++------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/geekigeeki.conf.py b/geekigeeki.conf.py index eba3843..1080e49 100644 --- a/geekigeeki.conf.py +++ b/geekigeeki.conf.py @@ -7,14 +7,27 @@ privileged_url = 'https://www.develer.com/~bernie/wiki' data_dir = '/home/bernie/public_html/wiki/data' -css_url = ['../wikidata/geekigeeki.css'] # optional stylesheet links +# default page links +icon_url = 'hacker-favicon.ico' +css_url = ['../wikidata/geekigeeki.css'] + history_url = '../wikigit/wiki.git' post_edit_hook = './post_edit_hook.sh' datetime_fmt = '%a %d %b %Y %I:%M %p' -allow_edit = True # Is it possible to edit pages? -show_hosts = True # show hostnames? -nonexist_pfx = '' # prefix before nonexistent link (usually '?') -image_maxwidth = 800 # maximum image width in pixels -debug_cgi = False # Set to True for CGI var dump + +# Is it possible to edit pages? +allow_edit = True + +# show hostnames? +show_hosts = True + +# prefix before nonexistent link (usually '?') +nonexist_pfx = '' + +# maximum image width in pixels +image_maxwidth = 800 + +# Set to True for CGI var dump +debug_cgi = False diff --git a/geekigeeki.py b/geekigeeki.py index d7e1a5a..44be2a4 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -31,7 +31,7 @@ from os import path, environ word_re = re.compile(r"^\b((([A-Z][a-z0-9]+){2,}/)*([A-Z][a-z0-9]+){2,})\b$") # FIXME: we accept stuff like foo/../bar and we shouldn't file_re = re.compile(r"^\b([A-Za-z0-9_\-][A-Za-z0-9_\.\-/]*)\b$") -img_re = re.compile(r"^.*\.(png|gif|jpg|jpeg)$", re.IGNORECASE) +img_re = re.compile(r"^.*\.(png|gif|jpg|jpeg|bmp|ico)$", re.IGNORECASE) url_re = re.compile(r"^[a-z]{3,8}://[^\s'\"]+\S$") link_re = re.compile("(?:\[\[|{{)([^\s\|]+)(?:\s*\|\s*([^\]]+)|)(?:\]\]|}})") @@ -127,6 +127,17 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error'): print ' ' for css in css_url: print ' ' % relative_url(css) + if icon_url: + print ' ' % relative_url(icon_url) + + if privileged_url is not None: + print ' ' \ + % (privileged_path() + '?edit=' + name) + + if history_url is not None: + print ' ' \ + % (history_url + '?a=rss') + print '' # Body @@ -484,16 +495,16 @@ class WikiFormatter: + r"|(?P<(/|)(br|hr|div|form|iframe|input|span))" + r"|(?P[<>&])" - # Auto links - + r"|(?P\b[a-zA-Z0-9_/-]+\.(png|gif|jpg|jpeg|bmp))" # LEGACY - + r"|(?P\b(?:[A-Z][a-z]+){2,}\b)" # LEGACY - + r"|(?P(http|https|ftp|mailto)\:[^\s'\"]+\S)" # LEGACY - + r"|(?P[-\w._+]+\@[\w.-]+)" # LEGACY + # Auto links (LEGACY) + + r"|(?P\b[a-zA-Z0-9_/-]+\.(png|gif|jpg|jpeg|bmp|ico))" + + r"|(?P\b(?:[A-Z][a-z]+){2,}\b)" + + r"|(?P(http|https|ftp|mailto)\:[^\s'\"]+\S)" + + r"|(?P[-\w._+]+\@[\w.-]+)" # Lists, divs, spans + r"|(?P
  • ^\s+[\*#] +)" + r"|(?P
    \{\{\{|\s*\}\}\})"
    -            + r"|(?P\{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})" #TODO
    +            + r"|(?P\{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})"
     
                 # Tables
                 + r"|(?P^\s*\|\|(=|)\s*)"
    -- 
    2.25.1