title_done = False
-
# CGI stuff ---------------------------------------------------------
-
def script_name():
return os.environ.get('SCRIPT_NAME', '')
+def query_string():
+ path_info = os.environ.get('PATH_INFO', '')
+ if len(path_info) and path_info[0] == '/':
+ return path_info[1:] or 'FrontPage'
+ else:
+ return os.environ.get('QUERY_STRING', '') or 'FrontPage'
+
def privileged_path():
return privileged_url or script_name()
if macro:
return macro(argv)
else:
- return '<strong class="error"><<' + '|'.join(argv) + '>></strong>'
+ msg = '<<' + '|'.join(argv) + '>>'
+ if not self.in_html:
+ msg = '<strong class="error">' + msg + '</strong>'
+ return msg
def _hurl_repl(self, word):
m = link_re.match(word)
self.in_html += 1
return word; # Pass through
+ def _htmle_repl(self, word):
+ self.in_html -= 1
+ return word; # Pass through
+
def _ent_repl(self, s):
- if self.in_html and s == '>':
- self.in_html -= 1
- return '>'
+ if self.in_html:
+ return s; # Pass through
return {'&': '&',
'<': '<',
'>': '>'}[s]
| (?P<tit> \={2,6})
| (?P<br> \\\\)
| (?P<rule> ^-{3,})
- | (?P<hi> \b(FIXME|TODO|DONE)\b)
+ | (?P<hi> \b( FIXME | TODO | DONE )\b )
# Links
| (?P<macro> \<\<([^\s\|\>]+)(?:\s*\|\s*([^\>]+)|)\>\>)
| (?P<hurl> \[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])
# Inline HTML
- | (?P<html> <(/|)(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])[^>]*>)
- | (?P<ent> [<>&])
+ | (?P<html> <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b )
+ | (?P<htmle> ( /\s*> | </(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])> ) )
+ | (?P<ent> [<>&] )
# Auto links (LEGACY)
| (?P<img> \b[a-zA-Z0-9_/-]+\.(png|gif|jpg|jpeg|bmp|ico|ogm|ogg|mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt))
handler(form[cmd].value)
break
else:
- path_info = os.environ.get('PATH_INFO', '')
- if len(path_info) and path_info[0] == '/':
- query = path_info[1:] or 'FrontPage'
- else:
- query = os.environ.get('QUERY_STRING', '') or 'FrontPage'
-
+ query = query_string()
if file_re.match(query):
if word_re.match(query):
Page(query).format()