From 6002848303f10b453acd930707ea436ec1183725 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Mon, 3 Aug 2009 16:20:07 +0200 Subject: [PATCH] Add strike through and glyph substitution --- geekigeeki.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/geekigeeki.py b/geekigeeki.py index 52010d6..a0dc72c 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -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 ['' + def _glyph_repl(self, word): + return '—' + def _tit_repl(self, word): if self.h_level: result = '

\n' % self.h_level @@ -535,8 +539,9 @@ 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 --) | (?P \={2,6}) | (?P
\\\\) | (?P ^-{3,}) @@ -547,7 +552,7 @@ class WikiFormatter: | (?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 [<>&] ) -- 2.25.1