From 8ed63d7c910673a3d4ca1ff20bf099125e85b78e Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Mon, 2 Jun 2008 12:07:14 +0200 Subject: [PATCH] Implement <> syntax. --- geekigeeki.css | 6 +++++- geekigeeki.py | 33 ++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/geekigeeki.css b/geekigeeki.css index f862a3f..8971f4b 100755 --- a/geekigeeki.css +++ b/geekigeeki.css @@ -139,6 +139,10 @@ strong.FIXME { background-color: #ee2222; } +strong.error { + color: red; +} + div { margin-left: 10px; margin-right: 10px; @@ -184,7 +188,7 @@ div.nav { .nav .login { font-size: small; - text-color: red; + color: red; } #footer div { diff --git a/geekigeeki.py b/geekigeeki.py index bee5e34..be262f9 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -385,8 +385,22 @@ class PageFormatter: else: return '%s' % (word, word) + def _macro_repl(self, word): + m = re.compile("<<([^\s\|]+)(?:\s*\|\s*([^\]]+)|)>>").match(word) + name = m.group(1) + param = m.group(2) or None + + macro = globals().get('_macro_' + name) + if macro: + return macro(name, param) + else: + param_str = '' + if param: + param_str = param + ' ' + return '' + name + param_str + '' + def _hurl_repl(self, word): - m = re.compile("\[\[([^ \t\n\r\f\v\|]+)(?:\s*\|\s*([^\]]+)|)\]\]").match(word) + m = re.compile("\[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\]").match(word) name = m.group(1) descr = m.group(2) or name @@ -499,21 +513,26 @@ class PageFormatter: + r"|(?P\={2,6})" + r"|(?P
\\\\)" + r"|(?P^-{3,})" + + # Links + + r"|(?P<<([^\s\|]+)(?:\s*\|\s*([^\]]+)|)>>)" + + r"|(?P\[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])" + + # Inline HTML + r"|(?P<(/|)(div|span|iframe)[^<>]*>)" + r"|(?P[<>&])" + r"|(?P\b(FIXME|TODO|DONE)\b)" # Links - + r"|(?P\b[a-zA-Z0-9_-]+\.(png|gif|jpg|jpeg|bmp))" - + r"|(?P\b(?:[A-Z][a-z]+){2,}\b)" - + r"|(?P\[\[([^ \s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])" - + r"|(?P(http|https|ftp|mailto)\:[^\s'\"]+\S)" - + r"|(?P[-\w._+]+\@[\w.-]+)" + + 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 # Lists, divs, spans + r"|(?P
  • ^\s+[\*#] +)" + r"|(?P
    \{\{\{|\s*\}\}\})"
    -            + r"|(?P\{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})"
    +            + r"|(?P\{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})" #TODO
     
                 # Tables
                 + r"|(?P^\s*\|\|(=|)\s*)"
    -- 
    2.25.1