X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Writers%2Fbkmk_whtml.py;h=b4c4dab5c59ff3c0a28a7698376757e39efb542a;hb=53be3a265ef317cb5f5be1685931a6135345cdea;hp=f2986fd4577ffed773740ef2fe5092d287cdfc6d;hpb=5291c9e91503d288a4a50a30345d1d33ced56f32;p=bookmarks_db.git diff --git a/Writers/bkmk_whtml.py b/Writers/bkmk_whtml.py index f2986fd..b4c4dab 100644 --- a/Writers/bkmk_whtml.py +++ b/Writers/bkmk_whtml.py @@ -1,25 +1,21 @@ """ Convert a bkmk database back to bookmarks.html - Written by BroytMann. Copyright (C) 2000-2007 PhiloSoft Design + Written by Broytman. Copyright (C) 2000-2010 PhiloSoft Design """ - -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,13 +26,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.name) + if (BKMK_FORMAT == "MOZILLA") and f.last_modified: self.outfile.write(' LAST_MODIFIED="%s"' % f.last_modified) + self.outfile.write('>%s\n' % quote_title(f.name)) self._folder(f, level) def end_folder(self, f, level): @@ -44,10 +40,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):