X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Writers%2Fbkmk_whtml.py;h=97a17e42cd4f500bce32c4dded37867bd5be3e4a;hb=1e2f258f40c74803df6746e7b6041776ba715f4b;hp=8b172fc372f39a029a1ad15ea2ff5b85e7276b14;hpb=5a3a639d28368406ca2e02584ee7924cb0ae8089;p=bookmarks_db.git diff --git a/Writers/bkmk_whtml.py b/Writers/bkmk_whtml.py index 8b172fc..97a17e4 100644 --- a/Writers/bkmk_whtml.py +++ b/Writers/bkmk_whtml.py @@ -1,25 +1,30 @@ -""" - Convert a bkmk database back to bookmarks.html +"""Convert a bkmk database back to bookmarks.html - Written by BroytMann. Copyright (C) 2000-2004 PhiloSoft Design +This file is a part of Bookmarks database and Internet robot. """ +__version__ = "$Revision$"[11:-2] +__revision__ = "$Id$"[5:-2] +__date__ = "$Date$"[7:-2] +__author__ = "Oleg Broytman " +__copyright__ = "Copyright (C) 2000-2011 PhiloSoft Design" +__license__ = "GNU GPL" + +__all__ = ['writer_html'] -import os -NSFORMAT = os.environ.has_key("BKMK_NSFORMAT") + +from bkmk_objects import Writer, BKMK_FORMAT, quote_title def dump_comment(comment): comment = comment.replace("
\n", "\n") - if NSFORMAT: + if BKMK_FORMAT == "NETSCAPE": comment = comment.replace("\n", "
\n") return comment ind_s = " "*4 -from bkmk_objects import Writer - class writer_html(Writer): filename = "bookmarks.html" @@ -30,11 +35,13 @@ class writer_html(Writer): def root_folder(self, f): self.outfile.write("\n") self.outfile.write(f.header + "\n") - self.outfile.write('

%s

\n\n' % f.name) + self.outfile.write('

%s

\n\n' % quote_title(f.name)) self._folder(f, 0) def start_folder(self, f, level): - self.outfile.write(ind_s*level + '

%s

\n' % (f.add_date, f.name)) + self.outfile.write(ind_s*level + '

%s

\n' % quote_title(f.name)) self._folder(f, level) def end_folder(self, f, level): @@ -42,8 +49,12 @@ class writer_html(Writer): def bookmark(self, b, level): self.outfile.write(ind_s*(level+1) + '
%s\n' % b.name) + if BKMK_FORMAT == "MOZILLA": + if b.keyword: self.outfile.write(' SHORTCUTURL="%s"' % b.keyword) + if b.icon_href: self.outfile.write(' ICON_URI="%s"' % b.icon_href) + if b.icon: self.outfile.write(' ICON="%s"' % b.icon) + if b.charset: self.outfile.write(' LAST_CHARSET="%s"' % b.charset) + self.outfile.write('>%s\n' % quote_title(b.name)) if b.comment: self.outfile.write('
%s\n' % dump_comment(b.comment)) def ruler(self, r, level):