if ( /\@sect/ ) {
s!\@sect(\d)\{(.*)\}\s*$!<h$1>$2</h$1>!g;
$sect_name = $2;
- $sect_name =~ s/\s/_/g;
- $sect_name =~ s/[\'\`]/_/g;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $sect_name =~ s/[^a-zA-Z0-9_]//g;
+
$_ = "\n * <a name=\"$sect_name\"></a> \n * $_";
}
m!\@sect(\d)\{(.*)\}\s*$!;
$sect_name = $2;
- $sect_name =~ s/\s/_/g;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $sect_name =~ s/[^a-zA-Z0-9_]//g;
+
print "\@endcode\n";
print " <a name=\"plain-$sect_name\"></a>\n";
print "\@code\n";
-# Copyright (C) 1999, 2000, 2001, 2002, 2005 by Wolfgang Bangerth, University of Heidelberg
+# Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006 by Wolfgang Bangerth, University of Heidelberg
print "<a name=\"CommProg\"></a>\n";
print "<h1> The commented program</h1>\n";
if ( /\@sect/ ) {
s!\@sect(\d)\{(.*)\}\s*$!<h$1>$2</h$1>!g;
$sect_name = $2;
- $sect_name =~ s/\s/_/g;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $sect_name =~ s/[^a-zA-Z0-9_]//g;
+
$_ = "\n<a name=\"$sect_name\"></a>" . $_;
}
m!\@sect(\d)\{(.*)\}\s*$!;
$sect_name = $2;
- $sect_name =~ s/\s/_/g;
- $_ = "\n<a name=\"plain-$sect_name\"></a>";
- print;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $sect_name =~ s/[^a-zA-Z0-9_]//g;
+
+ print "\n<a name=\"plain-$sect_name\"></a>\n";
}
}
}
}
$reftext = $text;
- $reftext =~ s/\s/_/g;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $reftext =~ s/[^a-zA-Z0-9_]//g;
print " <li><a href=\"#$reftext\">$text</a>\n";
$level = $newlevel;