Various changes
[kiosk.git] / gkeep_renderer.py
index bad6830e09b85247e333846f8357e6d8f4593251..de1116d1ef04dd2e47a6eff1b96450c21ce8897d 100644 (file)
@@ -52,29 +52,28 @@ class gkeep_renderer(renderer.debuggable_abstaining_renderer):
             self.debug_print("Note title '%s'" % title)
             if contents != '' and not contents.isspace():
                 contents = strikethrough.sub('', contents)
-                contents = contents.replace(u'\u2610',
+                self.debug_print("Note contents:\n%s" % contents)
+                contents = contents.replace(u'\u2610 ',
                                             u'<LI><INPUT TYPE="checkbox">&nbsp;')
-
-                #self.debug_print("Note contents:\n%s" % contents)
                 contents = linkify.sub(r'<a href="\1">\1</a>', contents)
 
                 individual_lines = contents.split("\n")
                 num_lines = len(individual_lines)
                 max_length = 0
-                indent = 0
                 contents = ""
                 for x in individual_lines:
                     length = len(x)
                     if length > max_length:
                         max_length = length
-                    spaces = len(x) - len(x.lstrip(' '))
-                    spaces /= 2
+                    leading_spaces = len(x) - len(x.lstrip(' '))
+                    leading_spaces /= 2
+                    leading_spaces = int(leading_spaces)
                     x = x.lstrip(' ')
-                    if spaces > indent:
+                    # self.debug_print(" * (%d) '%s'" % (leading_spaces, x))
+                    for y in range(0, leading_spaces):
                         x = "<UL>" + x
-                    elif spaces < indent:
-                        x = "</UL>" + x
-                    indent = spaces
+                    for y in range(0, leading_spaces):
+                        x = x + "</UL>"
                     contents = contents + x + "\n"
 
                 individual_lines = contents.split("\n")
@@ -97,7 +96,7 @@ class gkeep_renderer(renderer.debuggable_abstaining_renderer):
                                      (num_lines, max_length))
                     f.write("<TABLE BORDER=0 WIDTH=100%%><TR valign=\"top\">")
                     f.write("<TD WIDTH=50%% style=\"color:#eeeeee; font-size:large\">\n")
-                    f.write("<FONT><UL>")
+                    f.write("<FONT><UL STYLE='list-style-type:none'>")
                     count = 0
                     for x in individual_lines:
                         f.write(x + "\n")
@@ -105,7 +104,7 @@ class gkeep_renderer(renderer.debuggable_abstaining_renderer):
                         if count == num_lines / 2:
                             f.write("</UL></FONT></TD>\n")
                             f.write("<TD WIDTH=50%% style=\"color:#eeeeee; font-size:large\">\n")
-                            f.write("<FONT><UL>")
+                            f.write("<FONT><UL STYLE='list-style-type:none'>")
                     f.write("</UL></FONT></TD></TR></TABLE></DIV>\n");
                 else:
                     self.debug_print("%d lines (max=%d chars): one column" %