]> git.phdru.name Git - bookmarks_db.git/blobdiff - bkmk_objects.py
Fixed parsing in case of unknown entity.
[bookmarks_db.git] / bkmk_objects.py
index 584b87f56af1d01188ab7d0c6557c373e820ea48..e7d1d623b87d2c39d226b6968364bab176f62900 100644 (file)
@@ -1,9 +1,12 @@
 """
    Objects to represent bookmarks.html structure
 
-   Written by Oleg BroytMann. Copyright (C) 2000-2007 PhiloSoft Design.
+   Written by Oleg Broytman. Copyright (C) 2000-2007 PhiloSoft Design.
 """
 
+import os, cgi
+BKMK_FORMAT = os.environ.get("BKMK_FORMAT", "MOZILLA")
+
 
 class Folder(list):
    isFolder = 1
@@ -159,3 +162,21 @@ def make_tree(linear):
       object.parent.append(object)
 
    return root_folder
+
+def break_tree(linear):
+   del linear[0]
+
+   for object in linear:
+      del object.parent
+
+
+def quote_title(title):
+   if BKMK_FORMAT == "MOZILLA":
+      title = title.replace("'", "'")
+   return title
+
+def unquote_title(title):
+   if BKMK_FORMAT == "MOZILLA":
+      from HTMLParser import HTMLParser
+      title = HTMLParser().unescape(title.replace("&", '&'))
+   return title