File: htmlmunge.pl

package info (click to toggle)
pv 0.9.6-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 688 kB
  • ctags: 241
  • sloc: ansic: 2,003; sh: 471; makefile: 51; perl: 23
file content (34 lines) | stat: -rwxr-xr-x 591 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -w
#
# Change some of the crappier things about texi2html's formatting.
#

$body = 0;

while (<>) {

	$body = 1 if (/^<BODY>$/);

	if ($body > 0) {
		$body ++ if (/^<P><HR><P>$/);
		if ($body > 1) {
			print "<BODY>\n<!-- start -->\n";
			$body = 0;
		}
		next;
	}

	s@</P>@<P>@g;
	s@<H1>@<P><HR><P><H1 ALIGN="LEFT">@g;
	s@<PRE>@<P><PRE>@g;
	s@<UL>@<P><UL>@g;
	s@<DL@<P><DL@g;
	if (/^<\/BODY>$/) {
		print 'It was then munged by a Perl script to stop it ' .
		  'looking horrible in <A HREF="http://lynx.browser.org/">' .
		  "Lynx</a>.\n<!-- end -->\n";
	}
	print;
}

# EOF