Merge branch 'experimental' of git://github.com/Dieterbe/uzbl into experimental
authorMason Larobina <mason.larobina@gmail.com>
Thu, 16 Jul 2009 14:17:44 +0000 (22:17 +0800)
committerMason Larobina <mason.larobina@gmail.com>
Thu, 16 Jul 2009 14:17:44 +0000 (22:17 +0800)
examples/data/uzbl/scripts/uzbl_tabbed.py

index bf5ee97..d384fc6 100755 (executable)
@@ -34,6 +34,9 @@
 # Contributor(s):
 #   mxey <mxey@ghosthacking.net>
 #       uzbl_config path now honors XDG_CONFIG_HOME if it exists.
+#
+#   Romain Bignon <romain@peerfuse.org>
+#       Fix for session restoration code.
 
 
 # Configuration:
@@ -301,6 +304,14 @@ def counter():
         yield i
 
 
+def escape(s):
+    '''Replaces html markup in tab titles that screw around with pango.'''
+
+    for (split, glue) in [('&','&amp;'), ('<', '&lt;'), ('>', '&gt;')]:
+        s = s.replace(split, glue)
+    return s
+
+
 def gen_endmarker():
     '''Generates a random md5 for socket message-termination endmarkers.'''
 
@@ -984,7 +995,8 @@ class UzblTabbed:
                 (tabc, textc) = style
 
                 if tab_titles:
-                    pango += tab_format % (tabc, index, textc, tabtitle)
+                    pango += tab_format % (tabc, index, textc,\
+                      escape(tabtitle))
                 else:
                     pango += tab_format % (tabc, textc, index)
 
@@ -1064,7 +1076,7 @@ if __name__ == "__main__":
                 uzbl.new_tab(line, False)
 
         if not len(urls):
-            self.new_tab()
+            uzbl.new_tab()
 
     else:
         uzbl.new_tab()