#!/usr/bin/perl -Wall #Open file called "novel", do some formatting, output result into #"formattednovel, clobbering any existing formattednovel files. Create #a chapter index called index.html. #################################################################### #formatting rules for the raw text: #title: title must be given as "Title:
Last modified: $datestring
"); #Now go through the text and inset break and paragraph tags as well as #paragraph indentation. If we have one empty line, indent for a quote #if we have two empty lines in a row, it's a paragraph. $newlines = 0; #Start of paragraph is true if it's the first line after an empty #line. $startofparagraph = 0; #use automatic chapter numbering $chapternumber = 0; while(\n/;
}
if ($startofparagraph == 1)
{
if (!/Chapter/ && !/Title/)
{
$_ = " \n".$_;
$startofparagraph = 0;
}
elsif (/^\s*Chapter:/)
{
$chapternumber++;
$_ =~ s/Chapter:\s*(.*)/ ");
}
elsif (/^\s*Title:/)
{
$_ =~ s/Title:\s*(.*)/ ");
}
}
#write each line from the input file, edited or not, to the output file
print (OUTFILE "$_");
}
close (FILE);
print(OUTFILE "\n\n");
close (OUTFILE);
print(INDEXFILE "\n\n");
close (INDEXFILE);
print ("Done. $chapternumber chapters found.");