Re: Is there a FAQ to HTML converter?

---------

Alan Hamilton (alan@osf.org)
Fri, 21 Jan 1994 15:11:20 -0500


Tim Mansfield <timbomb@cs.uq.oz.au> wrote:
> I'd like to provide my FAQ in HTML format, but I don't want to do it
> manually for obvious reasons. I guess I could keep it in HTML and then
> use a script to strip out the HTML for posting purposes.

The latter is what I do. I use the enclosed perl script to translate
from .html to .ascii formats.

-Alan Hamilton
"Bisexual Resource List" monthly posting

--------------------------------------------------------------------

#! /usr/local/bin/perl

# brl.pl - convert Bisexual Resource List from .html to .txt

# Build the list of component files from the Table Of Contents
open( TOC, "<brl-toc.html" );
while ( <TOC> ) {
next if ! m/^<li>/io;
m/"([^"]*)"/o;
push( @brlfiles, "$1" );
}
close( TOC );
#@brlfiles = reverse( @brlfiles );
printf(STDERR "\@brlfiles=@brlfiles\n");

$BRLTMP = ">brl.tmp";
if ( ! open(BRLTMP) ) { die("cannot open $brltmp"); }
printf(BRLTMP "Bisexual Resource List\n\n");
for $BRLFILE ( @brlfiles ) {
printf(STDERR "$BRLFILE\n");
if ( ! open( BRLFILE ) ) { die("cannot open $brltmp") }
@brlsrc = <BRLFILE>;
#printf(STDERR "@brlsrc");
$brlsrc = join('', @brlsrc);
$brlsrc =~ s,<title>[^<]+</title>,,gio;
$brlsrc =~ s/<dt>/\n/gio;
$brlsrc =~ s/<dd>/ /gio;
$brlsrc =~ s/<p>/ /gio;
$brlsrc =~ s/<[^>]+>//gio;
$brlsrc =~ s/ +\n/\n/og;
$brlsrc =~ s/\n\n\n/\n\n/og;
$brlsrc =~ s/\n\n\n/\n\n/og;
$brlsrc =~ s/\n\n\n/\n\n/og;
$brlsrc =~ s/&lt;/</og;
$brlsrc =~ s/&rt;/>/og;
printf(BRLTMP "%s", $brlsrc);
#printf(STDERR "%s", $brlsrc);
}
system("fmt brl.tmp > brl.txt; rm brl.tmp");



[ Usenet Hypertext FAQ Archive | Search Mail Archive | Authors | Usenet ]
[ 1993 | 1994 | 1995 | 1996 | 1997 ]

---------

faq-admin@landfield.com

© Copyright The Landfield Group, 1997
All rights reserved