projects
/
geekigeeki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3666a00
)
Add strike through and glyph substitution
author
Bernie Innocenti
<bernie@codewiz.org>
Mon, 3 Aug 2009 14:20:07 +0000
(16:20 +0200)
committer
Bernie Innocenti
<bernie@codewiz.org>
Mon, 3 Aug 2009 14:20:07 +0000
(16:20 +0200)
geekigeeki.py
patch
|
blob
|
history
diff --git
a/geekigeeki.py
b/geekigeeki.py
index 52010d6d33a1e0cd45e3c5033454be994b8dede6..a0dc72ca0629280be7792e5c57d3dee60c5b2525 100755
(executable)
--- a/
geekigeeki.py
+++ b/
geekigeeki.py
@@
-368,6
+368,7
@@
class WikiFormatter:
"**": ["b", False],
"##": ["tt", False],
"__": ["u", False],
"**": ["b", False],
"##": ["tt", False],
"__": ["u", False],
+ "--": ["del", False],
"^^": ["sup", False],
",,": ["sub", False],
"''": ["em", False], # LEGACY
"^^": ["sup", False],
",,": ["sub", False],
"''": ["em", False], # LEGACY
@@
-380,6
+381,9
@@
class WikiFormatter:
style[1] = not style[1]
return ['</', '<'][style[1]] + style[0] + '>'
style[1] = not style[1]
return ['</', '<'][style[1]] + style[0] + '>'
+ def _glyph_repl(self, word):
+ return '—'
+
def _tit_repl(self, word):
if self.h_level:
result = '</h%d><p>\n' % self.h_level
def _tit_repl(self, word):
if self.h_level:
result = '</h%d><p>\n' % self.h_level
@@
-535,8
+539,9
@@
class WikiFormatter:
print('<div class="wiki"><p>')
scan_re = re.compile(r"""(?:
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<glyph> --)
| (?P<tit> \={2,6})
| (?P<br> \\\\)
| (?P<rule> ^-{3,})
| (?P<tit> \={2,6})
| (?P<br> \\\\)
| (?P<rule> ^-{3,})
@@
-547,7
+552,7
@@
class WikiFormatter:
| (?P<hurl> \[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])
# Inline HTML
| (?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> [<>&] )
| (?P<htmle> ( /\s*> | </(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])> ) )
| (?P<ent> [<>&] )