From 76224f11fdb6b4e9235d2cb424ba025ddb023c10 Mon Sep 17 00:00:00 2001 From: Sarvesh D Date: Sat, 24 Oct 2015 14:33:40 +0530 Subject: [PATCH] Fixed linking in build_html.pl Fixes #249 by supporting non-word characters in link names --- build/tools/build_html.pl | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/build/tools/build_html.pl b/build/tools/build_html.pl index 592c2e8a..80f22ddf 100755 --- a/build/tools/build_html.pl +++ b/build/tools/build_html.pl @@ -13,16 +13,25 @@ my @chapters = get_chapter_list(); my $anchors = get_anchors(@chapters); +# start position of a link in the scratchpad +my $link_pos; + +sub Pod::PseudoPod::HTML::start_L +{ + my $self = shift; + $link_pos = length($self->{scratch}); +} + sub Pod::PseudoPod::HTML::end_L { my $self = shift; - if ($self->{scratch} =~ s/\b(\w+)$//) - { - my $link = $1; - die "Unknown link $link\n" unless exists $anchors->{$link}; - $self->{scratch} .= '" - . $anchors->{$link}[1] . ''; - } + my $link = substr($self->{scratch}, $link_pos); + + die "Unknown link $link\n" unless exists $anchors->{$link}; + + substr($self->{scratch}, $link_pos, length($link), + '" + . $anchors->{$link}[1] . ''); } for my $chapter (@chapters)