"Fossies" - the Fresh Open Source Software Archive

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


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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