#!/usr/bin/perl ############################################################################### # htmlizer for a text file in unicode UTF-8 # coder: tuan pham # developed: 07/31/01 (hard coded for "In the Jaws of History" # and "The Chinese Mosaic") # last updated: 12/28/02 (added -t -a) # 12/28/11 replaced tabs with spaces # 02/17/12 removed
tag to use css
# usage: htmlizer.pl *.txt
# the output will be *.html
# -t="Put the title here" (in double quotes)
# -a="Put the author's name here" (in double quotes)
# Note: these options are recommended to use by other scripts to match the titles
# and authors for each text file
#-------------------------oOo--------------------------
# global vars
# $input : content of the current input file
$input;
$TITLE=""; # text title
$NAME=""; # author
$CSS_FILE_1="http://ebooks.neofob.org/neofob.css";
$CSS_FILE="neofob.css";
local($/)=undef; # lousy and lazy way to parse text
main();
#-------------------------oOo--------------------------
sub main
{
my @A_PARA;
while ( $NextFile=shift(@ARGV) )
{
@A_PARA=split("=",$NextFile);
if ("-t" eq @A_PARA[0])
{
@A_PARA[1]=~s/\"//; # removes "
$TITLE=@A_PARA[1];
}
else
{
if ( open (TEMP,$NextFile) )
{
$input= tags
# and after .
sub make_paragraph
{
# add
# temporarily, this damned line doesn't work!
$input=~s/\r//g;
# add tags
$input=~s/\n+\s+/\n /;
$input=~s/\n+\s+/\n\n /g;
}
#-------------------------oOo--------------------------
# adding the html header
sub make_html
{
$header="\n".
" "."\n".
"
"."\n".
""."\n".
" "."\n".
"\n\n";
$tail= "