forked from len0rd/rockbox
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
This commit is contained in:
parent
4d52ba710a
commit
54ed3d6ce1
1 changed files with 9 additions and 3 deletions
|
|
@ -2,22 +2,28 @@
|
||||||
|
|
||||||
# this is really a faq2html and should only be used for this purpose
|
# this is really a faq2html and should only be used for this purpose
|
||||||
|
|
||||||
while(<STDIN>) {
|
sub fixline {
|
||||||
|
|
||||||
$_ =~ s/\</</g;
|
$_ =~ s/\</</g;
|
||||||
$_ =~ s/\>/>/g;
|
$_ =~ s/\>/>/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/^$/\ /g; # empty lines are nbsp
|
$_ =~ s/^$/\ /g; # empty lines are nbsp
|
||||||
$_ =~ s/(\\|\/)$/$1 /g; # clobber backslash on end of line
|
$_ =~ s/(\\|\/)$/$1 /g; # clobber backslash on end of line
|
||||||
|
}
|
||||||
|
|
||||||
|
while(<STDIN>) {
|
||||||
|
|
||||||
|
fixline($_);
|
||||||
|
|
||||||
# detect and mark Q-sections
|
# detect and mark Q-sections
|
||||||
if( $_ =~ /^Q(\d*)/) {
|
if( $_ =~ /^Q(\d*)/) {
|
||||||
print "</pre>\n<a name=\"$1\"></a><p class=\"faqq\">$_";
|
print "</pre>\n<a name=\"$1\"></a><p class=\"faqq\">$_";
|
||||||
my $line;
|
my $line;
|
||||||
while(<STDIN>) {
|
while(<STDIN>) {
|
||||||
|
|
||||||
|
fixline($_);
|
||||||
|
|
||||||
$line = $_;
|
$line = $_;
|
||||||
if($_ !~ /^A/) {
|
if($_ !~ /^A/) {
|
||||||
print "$_";
|
print "$_";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue