From 2626a655eb1ad0631280674e9564dc6802b73e3b Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 27 Jun 2005 13:45:44 +0000 Subject: [PATCH] Store charset in the DB and the generated HTML. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@59 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- bkmk_parser.py | 2 ++ hotexplode.pl | 36 +++++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/bkmk_parser.py b/bkmk_parser.py index d436741..7ce99e8 100755 --- a/bkmk_parser.py +++ b/bkmk_parser.py @@ -80,6 +80,8 @@ class BkmkParser(HTMLParser): def start_title(self, attrs): + if DEFAULT_CHARSET: + self.accumulator += '\n' % DEFAULT_CHARSET self.accumulator += "" def end_title(self): diff --git a/hotexplode.pl b/hotexplode.pl index 4ada424..2273b2f 100755 --- a/hotexplode.pl +++ b/hotexplode.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# hotexplode -- a program for "exploding" a xmosaic hotlist or Netscape +# hotexplode -- a program for "exploding" a xmosaic hotlist or Netscape # bookmark file into a hierarchial multi-page structure. # acb 60 Chs 3162 @@ -11,18 +11,18 @@ $date = `date`; # customise below -# header: some arbitrary HTML text which is appended below the title and +# header: some arbitrary HTML text which is appended below the title and # above the hotlist data $header = <<FOO; <hr width="50%"> <blockquote> -This hotlist was generated with +This hotlist was generated with <a href="http://www.zikzak.net/~acb/hacks/hotexplode.html">hotexplode</a> on $date. <p> -<b>WARNING:</b> The inclusion of a link to a page on -this hotlist is not an indication of the maintainer's +<b>WARNING:</b> The inclusion of a link to a page on +this hotlist is not an indication of the maintainer's approval of or agreement with its content. </blockquote> <hr width="50%"> @@ -65,7 +65,7 @@ $title = $opt_t if $opt_t; while (<>) { - if(/<UL>/) { warn "Detected xmosaic hotlist format\n" if $opt_v; + if(/<UL>/) { warn "Detected xmosaic hotlist format\n" if $opt_v; &parse_mosaic_hotlist($outdir, $title); last; } if(/<DL>/) { warn "Detected Netscape bookmark format\n" if $opt_v; &parse_netscape_bookmarks($outdir, $title); last; } @@ -80,11 +80,14 @@ sub parse_mosaic_hotlist { # we write the file at the very end, because (I think) filehandles do # not have local scope, and this is recursive local($prefix, $title) = @_; - local($result) = "<HTML><HEAD><TITLE>$title \ -\n

$title

\n $header \n
\n