#!/usr/bin/perl ############################################################################## ############################################################################## # Written by CTL (lansdoct@cs.alfred.edu) # Copyright (C) 2000 by Christopher Lansdown # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ############################################################################## # This program does a simple conversion of html to TeX. It mostly just # converts simple elements over then gets rid of the rest. ############################################################################## my $VERSION='0.1.0'; ######################## #First put in the macros my $line = <; $line .= join('', @body); ############################# #Map html stuff to TeX stuff #set comments properly $line =~ s|\"(.*?)\"|\`\`$1\'\'|gs; #set up line breaks $line =~ s|
|\\hfil\\break|gi; $line =~ s|

|\n\n|gi; #set up rules $line =~ s|


|\\vskip 4pt\\hrule\\vskip 4pt|gi; #set up bold and the like $line =~ s|(.*?)|{\\it $1}|gi; $line =~ s|(.*?)|{\\it $1}|gi; $line =~ s|(.*?)|{\\bf $1}|gi; $line =~ s|(.*?)|{\\bf $1}|gi; #set up headers $line =~ s|

(.*?)

|\\bigtitle{$1}|sgi; $line =~ s|

(.*?)

|\\title{$1}|sgi; $line =~ s|

(.*?)

|\\section{$1}|sgi; ########################### #Get rid of all other tags $line =~ s|<[^>]*>||g; ####################### #Add the trailing stuff $line .= "\n\\end"; ################# #And print it out print $line;