"Fossies" - the Fresh Open Source Software Archive

Member "html2sgml-0.3/mkbook" (26 Aug 1997, 1406 Bytes) of package /linux/misc/old/html2sgml-0.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 # Rude script to convert a html-file to a sgml-file in a format
    3 # suitabel for linuxdoc-sgml
    4 # (c) Peter Antman, 1997.
    5 #
    6 # This program is free software; you can redistribute it and/or modify
    7 # it under the terms of the GNU General Public License as published by
    8 # the Free Software Foundation; either version 2 of the License, or
    9 # (at your option) any later version.
   10 # 
   11 # This program is distributed in the hope that it will be useful,
   12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 # GNU General Public License for more details.
   15 # 
   16 # You should have received a copy of the GNU General Public License
   17 # along with this program; if not, write to the Free Software
   18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   19 #
   20 
   21 $THISPROG = "mkbook 0.1";
   22 
   23 
   24 $usage = "usage: mkbook fil.sgml";
   25 
   26 #print "hej";
   27 
   28 die $usage if @ARGV < 1;
   29 $sgmlfile = shift (@ARGV);
   30 
   31 $sgmlfile =~ /([\S]*?)\.sgml/;
   32 $filename = $1;
   33 $bookfile = "$filename-book.sgml";
   34 print "$bookfile";
   35 open (sgml, $sgmlfile);
   36 open (book, ">$bookfile");
   37 
   38 while (<sgml>) {
   39     s/<article>/<book>/gi;
   40     s/<\/article>/<\/book>/gi;
   41     
   42     s/<sect>/<chapt>/gi;
   43     s/<sect1>/<sect>/gi;
   44     s/<sect2>/<sect1>/gi;
   45     s/<sect3>/<sect2>/gi;
   46     s/<sect4>/<sect3>/gi;
   47     s/<sect5>/<sect4>/gi;
   48 
   49 #   s/<abstract>|<\/abstract>//gi;
   50 #   print;
   51     print book;
   52 }
   53 
   54 close book;