X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=a6158a3122b41b184930bf0255664a428851858d;hb=fef72da7c35a10fc92c098a9287683e9d71bea1d;hp=0c1423a97d7534e64d9e9da53cf64e3578e641a5;hpb=71ec383a3cf5f913055172eb966f3b95ea7fa8d3;p=geekigeeki.git
diff --git a/geekigeeki.py b/geekigeeki.py
index 0c1423a..a6158a3 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 ' + Page(page_name).link_to()
print ' . . . . ' + `count`
- print ['match', 'matches'][count <> 1]
+ print ['match', 'matches'][count != 1]
print ' %d hits out of %d pages searched.'
if msg_type == 'error':
print ' Software Failure. Press left mouse button to continue.\n'
- print msg
+ print msg_text
if msg_type == 'error':
print ' Guru Meditation #DEADBEEF.ABADC0DE'
print '
'
- # FIXME: This simple JS snippet is harder to pass than ACID 3.0
+ # FIXME: This little JS snippet is harder to pass than ACID 3.0
print """
"""
-def send_title(name, text="Limbo", msg=None, msg_type='error'):
+def send_title(name, text="Limbo", msg_text=None, msg_type='error'):
global title_done
if title_done: return
# Head
emit_header()
- print """
-
-"""
+ print ''
+ print ''
+
+ site_name = globals().get('site_name', 'Unconfigured Site')
print "
'
- elif self.in_var:
- self.in_var = False
- return '
'
- return ''
+ return '' + word + ''
def _tr_repl(self, word):
out = ''
@@ -440,16 +439,17 @@ class PageFormatter:
self.tr_cnt = 0
out = '' + out = out + ' | |
', ' | '][word.strip() == '||='] - def _tre_repl(self, word): + def _td_repl(self, word): if self.in_table: - return ' | ', ' | '][word.strip() == '||='] return '' - def _td_repl(self, word): + def _tre_repl(self, word): if self.in_table: - return ' | ' + return [' | ', ''][word.strip() == '||='] return '' def _indent_level(self): @@ -478,7 +478,7 @@ class PageFormatter: def replace(self, match): for type, hit in match.groupdict().items(): if hit: - return apply(getattr(self, '_' + type + '_repl'), (hit,)) + return getattr(self, '_' + type + '_repl')(hit) else: raise "Can't handle match " + `match` @@ -487,12 +487,13 @@ class PageFormatter: # For each line, we scan through looking for magic # strings, outputting verbatim any intervening text - # TODO: highlight search words (look at referer) + # TODO: highlight search words (look at referrer) scan_re = re.compile( r"(?:" # Formatting - + r"(?P
---|---|
\s*\|\|\s*)" + + r"|(?P | |
\s*\|\|(=|)\s*)"
+ r")")
pre_re = re.compile(
r"(?:"
+ r"(?P\s*\}\}\})" + + r"|(?P |