From: Bernie Innocenti Date: Tue, 24 Nov 2009 18:15:07 +0000 (-0500) Subject: Remove ugly ternary expression X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=46efe19f353d79e0be12da32980ef1457a97d749;p=geekigeeki.git Remove ugly ternary expression --- diff --git a/geekigeeki.py b/geekigeeki.py index 8c9fe64..79dda63 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -612,8 +612,8 @@ class WikiFormatter: print('

') else: indent = indent_re.match(self.line) - #3.0: print(self._indent_to(len(indent.group(0))), end=' ') print(self._indent_to(len(indent.group(1)), indent.group(2))) + # Stand back! Here we apply the monster regex that does all the parsing print(re.sub(scan_re, self.replace, self.line)) if self.in_pre: print('') @@ -666,7 +666,7 @@ class Page: out = '== ' pathname = '' for dirname in self.page_name.strip('/').split('/'): - pathname = (pathname + '/' + dirname) if pathname else dirname + pathname = (pathname and pathname + '/' ) + dirname out += '[[' + pathname + '|' + dirname + ']]/' out += ' ==\n'