Import latest gitweb
[geekigeeki.git] / geekigeeki.py
index 52010d6d33a1e0cd45e3c5033454be994b8dede6..5a401abde033bc06cd504fdb61c4e00fc41676e2 100755 (executable)
@@ -344,7 +344,7 @@ def send_footer(mod_string=None):
 <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img class="license" alt="Creative Commons License" src="%s" /></a>
 <span class="benchmark">generated in %0.3fs</span> by <a href="http://www.codewiz.org/wiki/GeekiGeeki">GeekiGeeki</a> version %s
 </p>
-''' % (relative_url('cc-by-sa.png'), clock() - start_time, __version__))
+''' % (relative_url('sys/cc-by-sa.png'), clock() - start_time, __version__))
     if mod_string:
         print('<p class="modified">last modified %s</p>' % mod_string)
     print('</div></body></html>')
@@ -368,6 +368,7 @@ class WikiFormatter:
             "**":  ["b",   False],
             "##":  ["tt",  False],
             "__":  ["u",   False],
+            "--":  ["del", False],
             "^^":  ["sup", False],
             ",,":  ["sub", False],
             "''":  ["em",  False], # LEGACY
@@ -380,6 +381,9 @@ class WikiFormatter:
         style[1] = not style[1]
         return ['</', '<'][style[1]] + style[0] + '>'
 
+    def _glyph_repl(self, word):
+        return '&mdash;'
+
     def _tit_repl(self, word):
         if self.h_level:
             result = '</h%d><p>\n' % self.h_level
@@ -535,19 +539,20 @@ class WikiFormatter:
         print('<div class="wiki"><p>')
 
         scan_re = re.compile(r"""(?:
-            # Styles and formatting
-              (?P<b>     \*\*|'''|//|''|\#\#|``|__|\^\^|,,)
+            # Styles and formatting ("--" must cling to a word to disambiguate it from the dash)
+              (?P<b>     \*\* | // | \#\# | __ | --\b | \b-- | \^\^ | ,, | ''' | '' | `` )
             | (?P<tit>   \={2,6})
             | (?P<br>    \\\\)
             | (?P<rule>  ^-{3,})
             | (?P<hi>    \b( FIXME | TODO | DONE )\b )
+            | (?P<glyph> --)
 
             # 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])\b )
+            | (?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>   [<>&] )