X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=inline;f=geekigeeki.py;h=79960d45422760c24f867238426ee76b8a905af4;hb=HEAD;hp=1891fdd8c5842cea4357d5339009ad40f90134d6;hpb=ba86d6242b2d2ff713f3db4725adcabbfb9f1cce;p=geekigeeki.git
diff --git a/geekigeeki.py b/geekigeeki.py
index 1891fdd..79960d4 100755
--- a/geekigeeki.py
+++ b/geekigeeki.py
@@ -3,7 +3,7 @@
#
# Copyright (C) 1999, 2000 Martin Pool \n' % self.h_level
+ result = '¶ \n' % (link, self.h_level)
self.h_level = 0
else:
self.h_level = len(word) - 1
- link = permalink(self.line)
- result = '\n
\s*\}\}\}) @@ -569,14 +571,12 @@ class Page: return True return False - def get_raw_body(self, default=None): + def get_raw_body(self): try: return open(self._filename(), 'rb').read() except IOError, err: if err.errno == errno.ENOENT: - if default is None: - default = '//[[?a=edit&q=%s|Describe %s]]//' % (self.page_name, self.page_name) - return default + return '' if err.errno == errno.EISDIR: return self.format_dir() raise err @@ -589,9 +589,9 @@ class Page: out += '[[' + pathname + '|' + dirname + ']]/' out += ' ==\n' images_out = '\n' - + for filename in page_list(self._filename(), file_re): - if image_re.match(filename): + if image_re.match(filename) or video_re.match(filename): maxwidth = config_get('image_maxwidth', '400') if maxwidth: maxwidth = ' | maxwidth=' + str(maxwidth) @@ -646,10 +646,11 @@ class Page: if title_done: return # HEAD - emit_header(self._mtime()) + emit_header(name and self._mtime()) print('\n') print("%s: %s " % (config_get('site_name', "Unconfigured Wiki"), text)) print(' ') + print(' ') if not name: print(' ') @@ -663,16 +664,17 @@ class Page: editable = name and self.can_write() and is_privileged() if editable: print(' ' \ - % relative_url('?a=edit&q=' + name, privileged=True)) + % relative_url(name + '?a=edit', privileged=True)) - print(' ' \ - % relative_url(name + '?a=atom')) + if name: + print(' ' \ + % relative_url(name + '?a=atom')) print('') # BODY if editable: - print('') + print('') else: print('') @@ -700,13 +702,13 @@ class Page: print(' | ' + link_tag(name + '?a=raw', 'Raw Text', cssclass='navlink')) if config_get('privileged_url') is not None: if self.can_write(): - print(' | ' + link_tag('?a=edit&q=' + name, 'Edit', cssclass='navlink', privileged=True)) + print(' | ' + link_tag(name + '?a=edit', 'Edit', cssclass='navlink', privileged=True)) else: - print(' | ' + link_tag(name, 'Login', cssclass='navlink', privileged=True)) + print(' | ' + link_tag(name, 'Login', cssclass='login', privileged=True)) user = remote_user() if user != 'AnonymousCoward': - print(' | ' + link_tag('User/' + user, user) + '') + print(' | ' + link_tag('user/' + user, user, cssclass='login')) print('
') @@ -720,13 +722,16 @@ class Page: link_inline(footer, kvargs = { 'LAST_MODIFIED': strftime(config_get('datetime_fmt', '%Y-%m-%dT%I:%M:%S%p'), localtime(self._mtime())) }) - print("") + print('') def send_naked(self, kvargs=None): if self.can_read(): - WikiFormatter(self.get_raw_body(), kvargs).print_html() + body = self.get_raw_body() + if not body: + body = "//[[%s?a=edit|Describe %s]]//" % (self.page_name, self.page_name) + WikiFormatter(body, kvargs).print_html() else: - send_guru("Read access denied by ACLs", "notice") + send_guru('Read access denied by ACLs', 'notice') def send(self): #css foo.css @@ -758,7 +763,7 @@ class Page: return if preview is None: - preview = self.get_raw_body(default='') + preview = self.get_raw_body() link_inline("sys/EditPage", kvargs = { 'EDIT_BODY': cgi.escape(preview),