Remove ugly ternary expression
authorBernie Innocenti <bernie@codewiz.org>
Tue, 24 Nov 2009 18:15:07 +0000 (13:15 -0500)
committerBernie Innocenti <bernie@codewiz.org>
Tue, 24 Nov 2009 18:15:07 +0000 (13:15 -0500)
geekigeeki.py

index 8c9fe64f7bf37cfd82261ac492957b5149e4ac13..79dda63e2c463df56b6e9790985b4005d727f2b4 100755 (executable)
@@ -612,8 +612,8 @@ class WikiFormatter:
                     print('</p><p>')
                 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('</pre>')
@@ -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'