diff data/plugin/parser/text_x_arnica.py @ 94:68102c2191f9

text_x_arnica: small refactoring of html_* methods
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 22 Jun 2008 13:03:16 +0200
parents 64797a5fc3d9
children edb3aa8208b2
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Sun Jun 22 12:09:14 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Sun Jun 22 13:03:16 2008 +0200
@@ -221,38 +221,31 @@
 
     def html_show_tools(self, idx):
         """ shows toolbox """
+        text = ''
         if self.show_tools:
             text = "<tr><td align=""center""%(style)s>%(tools)s </td></tr>" % {
                 "style": self.td_style,
                 "tools": self.html_tools(idx)}
-        else:
-            text = ''
         return text
 
     def html_show_date(self, idx):
         """ shows date """
+        text = ''
         if self.show_date:
-            return '''
-<tr>
-<td%(style)s>%(this_exif_date)s</td>
-</tr>''' % {
-        "style": self.td_style,
-        "this_exif_date": self.exif_date[idx]}
-        else:
-            return ''
+            text = '<tr><td%(style)s>%(this_exif_date)s</td></tr>' % {
+                "style": self.td_style,
+                "this_exif_date": self.exif_date[idx]}
+        return text
 
     def html_show_alias(self, idx):
         """ view mode 1 alias text below image """
+        text = ''
         if self.show_text:
-            return '''
-<tr>
-<td width="%(thumbnail_width)s" %(style)s> %(this_alias)s</td>
-</tr>''' % {
-        "thumbnail_width": self.thumbnail_width,
-        "style": ' align="left" style="padding:0em; margin:2px 2px; border-style:none"',
-        "this_alias": self.to_wikitext(self.description[idx])}
-        else:
-            return ''
+            text = '<tr><td width="%(thumbnail_width)s" %(style)s> %(this_alias)s</td></tr>' % {
+                    "thumbnail_width": self.thumbnail_width,
+                    "style": ' align="left" style="padding:0em; margin:2px 2px; border-style:none"',
+                    "this_alias": self.to_wikitext(self.description[idx])}
+        return text
 
     def html_preview(self, idx):
         """ defines arrangement of thumbnail, text, date and tools """
@@ -300,8 +293,6 @@
      "date_html": self.html_show_date(idx),
      "alias_html": self.html_show_alias(idx)
      }
-        #self.request.write(data)
-
         return text
 
     def define_thumb_webnails(self, path, files, quotes):
@@ -560,7 +551,5 @@
     def format(self, formatter):
         """ parser output """
         # checks if initializing of all attributes in __init__ was done
-        if not self.init_settings:
-            return
-
-        self.request.write(self.render(formatter))
+        if self.init_settings:
+            self.request.write(self.render(formatter))