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