I use this all the time for my own hompage when I try to get help with programs I am writing. Let me know what you think.
#!/usr/bin/perl use Text::Tabs; $tabstop = 4; $target = shift @ARGV; open ( FILE, "<$target"); chomp ( @code = <FILE> ); close FILE; foreach $line (@code) { $line =~ s/\</</; $line =~ s/\>/>/; $line = expand ($line); } unshift @code, "<ol>"; unshift @code, "<code>"; while (@ARGV) { # add links to page # use filename description $linkname = shift; $linkdescrip = shift; $link_html = qq\ <a href="$linkname">$linkdescrip</a>< +br>\; print "Link = $link_html \n"; unshift @code, $link_html; } unshift @code,"<body>"; unshift @code,"<title> $target </title>"; unshift @code, "<html>"; push @code, "</ol>"; push @code, "<" . "/code>"; # split to fool PM formatting! push @code, "</body>"; push @code, "</html>"; open (FILE,">".$target.".html"); $body = 0; foreach $line (@code) { if ( ( $line =~ m/^#.*/) || ( $line =~ m/^\/\*/ ) || ( $line =~ m/^[a-zA-Z0-9_]/) ) { $body = 1; } if ($line =~ m/^\<\/ol\>/) { $body = 0; } if ($body) { print FILE "<LI>".$line."\n"; } else { print FILE $line."\n"; } } close FILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: webify
by talwyn (Monk) on Jul 02, 2002 at 01:02 UTC | |
by Aristotle (Chancellor) on Jul 02, 2002 at 01:55 UTC |