X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=56d71f156f6b62984397e1b91d66ce73427b658e;hb=a2b12762880b05790a30c3996a0468ce69dd7f89;hp=71ce72406f6b94893516fcb03862964f48e1bdeb;hpb=746aad914bdc194bf3905b56d2339250fb11772f;p=geekigeeki.git
diff --git a/geekigeeki.py b/geekigeeki.py
index 71ce724..56d71f1 100755
--- a/geekigeeki.py
+++ b/geekigeeki.py
@@ -1,10 +1,9 @@
-#! /usr/bin/env python
-"""Quick-quick implementation of WikiWikiWeb in Python
-"""
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
#
-# Copyright (C) 1999, 2000 Martin Pool
-# This version includes additional changes by Gerardo Poggiali (2002)
-# This version includes additional changes by Bernardo Innocenti (2007)
+# Copyright 1999, 2000 Martin Pool
+# Copyright 2002 Gerardo Poggiali
+# Copyright 2007 Bernardo 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
@@ -19,9 +18,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-__version__ = '$Revision: 1.63+gerry+bernie $'[11:-2]
+__version__ = '$Id$'[4:12]
-import cgi, sys, string, os, re, errno, time, stat
+from time import clock
+start_time = clock()
+
+import cgi, sys, string, os, re, errno, stat
from os import path, environ
# Regular expression defining a WikiWord
@@ -102,16 +104,17 @@ def send_title(name, text="Limbo", msg=None, msg_type='error'):
# Head
emit_header()
- print """
-
-"""
+ print ''
+ print ''
+
+ site_name = globals().get('site_name', 'Unconfigured Site')
print "%s: %s" % (site_name, text)
print ' '
if not name:
print ' '
- if css_url:
- print ' ' % css_url
+ for css in css_url:
+ print ' ' % css
print ''
# Body
@@ -127,15 +130,17 @@ def send_title(name, text="Limbo", msg=None, msg_type='error'):
print '
'
print ' ' + site_name + ': ',
if name:
- print link_tag('?fullsearch=' + name, text) + ' '
+ print link_tag('?fullsearch=' + name, text, 'navlink') + ' '
else:
print text + ' '
print ' | ' + link_tag('FrontPage', 'Front Page', 'navlink')
print ' | ' + link_tag('FindPage', 'Find Page', 'navlink')
- print ' | Recent Changes'
+ if globals().has_key('history_url'):
+ print ' | Recent Changes'
+ if name:
+ print ' | Page History'
if name:
- print ' | Page History'
print ' | ' + link_tag('?raw=' + name, 'Raw Text', 'navlink')
if privileged_url is not None:
print ' | ' + link_tag('?edit=' + name, 'Edit Page', 'navlink', authentication=True)
@@ -154,8 +159,7 @@ def link_tag(params, text=None, ss_class=None, authentication=False):
classattr = ''
if ss_class:
classattr += 'class="%s" ' % ss_class
- # Prevent crawlers from following links to generated pages
- # and links added by potential spammers
+ # Prevent crawlers from following links potentially added by spammers or to generated pages
if ss_class == 'external' or ss_class == 'navlink':
classattr += 'rel="nofollow" '
if authentication:
@@ -187,13 +191,12 @@ def do_fullsearch(needle):
for (count, page_name) in hits:
print '
' % (letter, letter)
last_letter = letter
@@ -317,7 +317,7 @@ def _macro_TitleIndex(*vargs):
current_letter = None
for name in pages:
letter = string.lower(name[0])
- if letter <> current_letter:
+ if letter != current_letter:
s = s + '
'
-
def _pre_repl(self, word):
if word == '{{{' and not self.in_pre:
self.in_pre = True
@@ -447,16 +444,17 @@ class PageFormatter:
self.tr_cnt = 0
out = '