]> git.phdru.name Git - bookmarks_db.git/blobdiff - hotexplode.pl
Fix(Robot): Stop splitting and un-splitting URLs
[bookmarks_db.git] / hotexplode.pl
index 4f3e8459479ff529f18420acfe685953a340ff3e..246c403033f003eb86d5d5c5164e61b8f3879117 100755 (executable)
@@ -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,25 +11,25 @@ $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%">
 <blockquote>
-Please <b>DO NOT</b> bookmark this page. Bookmark
-<a href="http://phd.pp.ru/Bookmarks/">main page</A> instead.
-Any other page in the hierarchy may disappear at any time.
+Please <b>DO NOT</b> bookmark this page. Bookmark the
+<a href="https://phdru.name/Bookmarks/">main page</A> instead.
+Any other page in the hierarchy can be renamed, moved or removed at any time.
 </blockquote>
 FOO
 
@@ -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 </TITLE></HEAD>\
-<BODY>\n<CENTER><H1>$title </H1></CENTER>\n $header \n<hr>\n<ul>";
+  local($result) = "<HTML><HEAD>\
+<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=koi8-r\">\
+<TITLE>$title</TITLE>\
+</HEAD>\
+<BODY>\n<CENTER><H1>$title</H1></CENTER>\n $header \n<hr>\n<ul>";
 
   warn "Creating $prefix...\n" if $opt_v;
-  
+
   # create the directory, if needed
   mkdir($prefix, 0755) unless -d $prefix;
 
@@ -111,7 +114,7 @@ sub parse_mosaic_hotlist {
       &parse_mosaic_hotlist("${prefix}/${filename}", "${title}:${subtitle}");
       next;
     }
-    
+
   }
 
   $result = $result . $footer . "</body></html>";
@@ -130,11 +133,14 @@ sub parse_netscape_bookmarks {
   # 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 </TITLE></HEAD>\
-<BODY>\n<CENTER><H1>$title </H1></CENTER>\n $header \n<hr>\n<dl>";
+  local($result) = "<HTML><HEAD>\
+<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=koi8-r\">\
+<TITLE>$title</TITLE>\
+</HEAD>\
+<BODY>\n<CENTER><H1>$title</H1></CENTER>\n $header \n<hr>\n<dl>";
 
   warn "Creating $prefix...\n" if $opt_v;
-  
+
   # create the directory, if needed
   mkdir($prefix, 0755) unless -d $prefix;
 
@@ -145,7 +151,7 @@ sub parse_netscape_bookmarks {
       #  a nested list
       #
       local($subtitle)=$1;
-      local($filename)=$1; 
+      local($filename)=$1;
       $filename =~ tr/0-9A-Za-z//cd;
       $filename =~ tr/A-Z/a-z/;
       # parse the description here
@@ -156,7 +162,7 @@ sub parse_netscape_bookmarks {
       }
       $result = $result . "<dt><b><a href=\"${filename}/index.html\">${subtitle}</a></b>\n";
       unless("$desc" eq "")  { $result = $result . $desc; }
-      &parse_netscape_bookmarks("${prefix}/${filename}", 
+      &parse_netscape_bookmarks("${prefix}/${filename}",
         "${title}:${subtitle}");
       next;
     }