summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-19 15:50:13 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-19 15:50:13 +0000
commit54ed3d6ce1c54797a006549c784cbebdff6a4024 (patch)
treea19508c5353fdcfb2d01b76e6ebabfbd76f0af7f
parent4d52ba710a622a5f561fbad0a47e08bfba28f33d (diff)
downloadrockbox-54ed3d6ce1c54797a006549c784cbebdff6a4024.zip
rockbox-54ed3d6ce1c54797a006549c784cbebdff6a4024.tar.gz
rockbox-54ed3d6ce1c54797a006549c784cbebdff6a4024.tar.bz2
rockbox-54ed3d6ce1c54797a006549c784cbebdff6a4024.tar.xz
fix links within A-sections too and improve the parser somewhat
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1808 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xwww/txt2plain.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/www/txt2plain.pl b/www/txt2plain.pl
index ec49adb..7264052 100755
--- a/www/txt2plain.pl
+++ b/www/txt2plain.pl
@@ -2,22 +2,28 @@
# this is really a faq2html and should only be used for this purpose
-while(<STDIN>) {
-
+sub fixline {
$_ =~ s/\</&lt;/g;
$_ =~ s/\>/&gt;/g;
- $_ =~ s/(http:\/\/([a-zA-Z0-9_.\/-]*)[^\).])/\<a href=\"$1\"\>$1\<\/a\>/g;
+ $_ =~ s/(http:\/\/([a-zA-Z0-9_.\/-]*)[^\) .\n])/\<a href=\"$1\"\>$1\<\/a\>/g;
$_ =~ s/^$/\&nbsp;/g; # empty lines are nbsp
$_ =~ s/(\\|\/)$/$1&nbsp;/g; # clobber backslash on end of line
+}
+while(<STDIN>) {
+
+ fixline($_);
# detect and mark Q-sections
if( $_ =~ /^Q(\d*)/) {
print "</pre>\n<a name=\"$1\"></a><p class=\"faqq\">$_";
my $line;
while(<STDIN>) {
+
+ fixline($_);
+
$line = $_;
if($_ !~ /^A/) {
print "$_";