File tree 1 file changed +16
-7
lines changed
1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 13
13
my @chapters = get_chapter_list();
14
14
my $anchors = get_anchors(@chapters );
15
15
16
+ # start position of a link in the scratchpad
17
+ my $link_pos ;
18
+
19
+ sub Pod ::PseudoPod::HTML::start_L
20
+ {
21
+ my $self = shift ;
22
+ $link_pos = length ($self -> {scratch });
23
+ }
24
+
16
25
sub Pod ::PseudoPod::HTML::end_L
17
26
{
18
27
my $self = shift ;
19
- if ($self -> {scratch } =~ s / \b ( \w +)$ // )
20
- {
21
- my $link = $1 ;
22
- die " Unknown link $link \n " unless exists $anchors -> { $link };
23
- $self -> {scratch } .= ' <a href=" ' . $anchors -> { $link }[0] . " # $link \" > "
24
- . $anchors -> {$link }[1 ] . ' </a> ' ;
25
- }
28
+ my $link = substr ($self -> {scratch }, $link_pos );
29
+
30
+ die " Unknown link $link \n " unless exists $anchors -> { $link } ;
31
+
32
+ substr ( $self -> {scratch }, $link_pos , length ( $link ),
33
+ ' <a href=" ' . $anchors -> {$link }[0 ] . " # $link \" > "
34
+ . $anchors -> { $link }[1] . ' </a> ' );
26
35
}
27
36
28
37
for my $chapter (@chapters )
You can’t perform that action at this time.
0 commit comments