summaryrefslogtreecommitdiff
path: root/www/txt2plain.pl
diff options
context:
space:
mode:
Diffstat (limited to 'www/txt2plain.pl')
-rwxr-xr-xwww/txt2plain.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/www/txt2plain.pl b/www/txt2plain.pl
index ec49adbcdb..72640522b6 100755
--- a/www/txt2plain.pl
+++ b/www/txt2plain.pl
@@ -2,22 +2,28 @@
2 2
3# this is really a faq2html and should only be used for this purpose 3# this is really a faq2html and should only be used for this purpose
4 4
5while(<STDIN>) { 5sub fixline {
6
7 $_ =~ s/\</&lt;/g; 6 $_ =~ s/\</&lt;/g;
8 $_ =~ s/\>/&gt;/g; 7 $_ =~ s/\>/&gt;/g;
9 8
10 $_ =~ s/(http:\/\/([a-zA-Z0-9_.\/-]*)[^\).])/\<a href=\"$1\"\>$1\<\/a\>/g; 9 $_ =~ s/(http:\/\/([a-zA-Z0-9_.\/-]*)[^\) .\n])/\<a href=\"$1\"\>$1\<\/a\>/g;
11 10
12 $_ =~ s/^$/\&nbsp;/g; # empty lines are nbsp 11 $_ =~ s/^$/\&nbsp;/g; # empty lines are nbsp
13 $_ =~ s/(\\|\/)$/$1&nbsp;/g; # clobber backslash on end of line 12 $_ =~ s/(\\|\/)$/$1&nbsp;/g; # clobber backslash on end of line
13}
14 14
15while(<STDIN>) {
16
17 fixline($_);
15 18
16 # detect and mark Q-sections 19 # detect and mark Q-sections
17 if( $_ =~ /^Q(\d*)/) { 20 if( $_ =~ /^Q(\d*)/) {
18 print "</pre>\n<a name=\"$1\"></a><p class=\"faqq\">$_"; 21 print "</pre>\n<a name=\"$1\"></a><p class=\"faqq\">$_";
19 my $line; 22 my $line;
20 while(<STDIN>) { 23 while(<STDIN>) {
24
25 fixline($_);
26
21 $line = $_; 27 $line = $_;
22 if($_ !~ /^A/) { 28 if($_ !~ /^A/) {
23 print "$_"; 29 print "$_";