X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Writers%2Fbkmk_whtml.py;h=88889178611a81bb6436fdfded50ee3c2fcbc422;hb=789d114c213bb9468c4711180d996c3a1b39ad6c;hp=54f5c93e3ba689c5acbca555fe4e603a5c6266a8;hpb=22393278e81f406ecf1fe2e4e11e564670c08200;p=bookmarks_db.git diff --git a/Writers/bkmk_whtml.py b/Writers/bkmk_whtml.py index 54f5c93..8888917 100644 --- a/Writers/bkmk_whtml.py +++ b/Writers/bkmk_whtml.py @@ -1,18 +1,21 @@ """ Convert a bkmk database back to bookmarks.html - Written by BroytMann. Copyright (C) 2000-2003 PhiloSoft Design + Written by BroytMann. Copyright (C) 2000-2007 PhiloSoft Design """ +from bkmk_objects import Writer, BKMK_FORMAT, quote_title + def dump_comment(comment): - return comment.replace("
", "
\n") + comment = comment.replace("
\n", "\n") + 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" @@ -21,22 +24,27 @@ class writer_html(Writer): self.outfile.write(ind_s*level + "

\n") def root_folder(self, f): - header = f.header.replace(".", ".\n") - header = header.replace("\n") - self.outfile.write(header + "\n") - self.outfile.write('

%s

\n\n' % f.name) + self.outfile.write(f.header + "\n") + 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): self.outfile.write(ind_s*level + "

\n") def bookmark(self, b, level): - self.outfile.write(ind_s*(level+1) + '

%s\n' % (b.href, b.add_date, b.last_visit, b.last_modified, b.name)) + self.outfile.write(ind_s*(level+1) + '
%s\n' % quote_title(b.name)) if b.comment: self.outfile.write('
%s\n' % dump_comment(b.comment)) def ruler(self, r, level):