autotoc deletes/re-creates only its own anchors so you can add your own
This commit is contained in:
parent
2cf382ca4e
commit
3559c1190e
|
@ -16,13 +16,14 @@ sub make_anchor {
|
|||
undef $/;
|
||||
my $doc = <>;
|
||||
|
||||
$doc =~ s/^<a name=".*"><\/a>\n\n//mg;
|
||||
$doc =~ s/^<a name="_.*"><\/a>\n\n//mg;
|
||||
$doc =~ s/^<a name="AUTO_.*"><\/a>\n\n//mg;
|
||||
|
||||
my @toc = $doc =~ /^###+ .*/mg;
|
||||
$doc =~ s/^(###+) (.*)/"<a name=\"" . &make_anchor($2) . "\"><\/a>\n\n$1 $2"/mge;
|
||||
$doc =~ s/^(###+) (.*)/"<a name=\"_" . &make_anchor($2) . "\"><\/a>\n\n$1 $2"/mge;
|
||||
|
||||
for (@toc) {
|
||||
s/^(###+) (.*)/' ' x (length($1)-3) . ' * <a href="#' . &make_anchor($2) . "\">$2<\/a>"/e;
|
||||
s/^(###+) (.*)/' ' x (length($1)-3) . ' * <a href="#_' . &make_anchor($2) . "\">$2<\/a>"/e;
|
||||
}
|
||||
|
||||
my $toc = "In this document:\n\n";
|
||||
|
|
Loading…
Reference in a new issue