X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=5a401abde033bc06cd504fdb61c4e00fc41676e2;hb=62db44f1f908f7f3f0d9942f841b89115b8d6c67;hp=5b98397af612e174205412d723ed251dfa82ed39;hpb=60a48cbc0a948ba2a1149239f8a53c4e2c73f4fc;p=geekigeeki.git diff --git a/geekigeeki.py b/geekigeeki.py index 5b98397..5a401ab 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -__version__ = '$Id$'[4:12] +__version__ = '4.0-' + '$Id$'[4:11] from time import clock start_time = clock() @@ -337,13 +337,14 @@ def send_footer(mod_string=None): cgi.print_arguments() cgi.print_form(form) cgi.print_environ() + #FIXME link_inline("sys/footer") print(''' ') @@ -367,6 +368,7 @@ class WikiFormatter: "**": ["b", False], "##": ["tt", False], "__": ["u", False], + "--": ["del", False], "^^": ["sup", False], ",,": ["sub", False], "''": ["em", False], # LEGACY @@ -379,6 +381,9 @@ class WikiFormatter: style[1] = not style[1] return ['' + def _glyph_repl(self, word): + return '—' + def _tit_repl(self, word): if self.h_level: result = '

\n' % self.h_level @@ -534,19 +539,20 @@ class WikiFormatter: print('

') scan_re = re.compile(r"""(?: - # Styles and formatting - (?P \*\*|'''|//|''|\#\#|``|__|\^\^|,,) + # Styles and formatting ("--" must cling to a word to disambiguate it from the dash) + (?P \*\* | // | \#\# | __ | --\b | \b-- | \^\^ | ,, | ''' | '' | `` ) | (?P \={2,6}) | (?P
\\\\) | (?P ^-{3,}) | (?P \b( FIXME | TODO | DONE )\b ) + | (?P --) # Links | (?P \<\<([^\s\|\>]+)(?:\s*\|\s*([^\>]+)|)\>\>) | (?P \[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\]) # Inline HTML - | (?P <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b ) + | (?P <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b ) | (?P ( /\s*> | ) ) | (?P [<>&] ) @@ -556,7 +562,7 @@ class WikiFormatter: | (?P (http|https|ftp|mailto)\:[^\s'\"]+\S) | (?P [-\w._+]+\@[\w.-]+) - # Lists, divs, spans + # Lists, divs, spans and inline objects | (?P

  • ^\s+[\*\#]\s+) | (?P
       \{\{\{|\s*\}\}\})
                 | (?P   \{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})
    @@ -645,7 +651,7 @@ class Page:
         def format_dir(self):
             out = '== '
             pathname = ''
    -        for dirname in self.page_name.split('/'):
    +        for dirname in self.page_name.strip('/').split('/'):
                 pathname = (pathname + '/' + dirname) if pathname else dirname
                 out += '[[' + pathname + '|' + dirname + ']]/'
             out += ' ==\n'
    @@ -795,6 +801,9 @@ class Page:
                     os.remove(name)
                 except OSError, err:
                     if err.errno != errno.ENOENT: raise err
    +        path = os.path.split(name)[0]
    +        if not os.path.exists(path):
    +            os.makedirs(path)
             os.rename(tmp_filename, name)
     
         def save(self, newdata, changelog):