diff options
author | Lukas Larsson <lukas@erlang.org> | 2020-04-17 16:44:46 +0200 |
---|---|---|
committer | Lukas Larsson <lukas@erlang.org> | 2020-04-17 17:00:26 +0200 |
commit | 36071d7cbff6163d4d5d8ce0b8e9936146e76a38 (patch) | |
tree | 6302862649887b15fb61ea99722b45d59742eb82 /scripts/otp_html_check | |
parent | 2e3e5ffce77072f7a252e58507af91b08099765a (diff) | |
download | erlang-36071d7cbff6163d4d5d8ce0b8e9936146e76a38.tar.gz |
docs: In link check trim leading and trailing whitespace from anchors
Diffstat (limited to 'scripts/otp_html_check')
-rwxr-xr-x | scripts/otp_html_check | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/otp_html_check b/scripts/otp_html_check index dc0426fc41..23805b5789 100755 --- a/scripts/otp_html_check +++ b/scripts/otp_html_check @@ -284,24 +284,28 @@ sub normalize_link { if ($link eq "") { # The empty link is a reference to URL directory return $rpath; - } elsif ($link =~ /^#(.*)$/) { + } elsif ($link =~ /^#(.*)$/s) { # Lokal reference to anchor my $anchor = $1; $anchor =~ s/%([\da-fA-F]{2})/chr(hex($1))/eg; # Translate hex to char $anchor =~ s/</</g; # $anchor =~ s/>/>/g; # + $anchor =~ s&^\s+&&; # Remove leading any whitespaces + $anchor =~ s&\s+$&&; # Remove trailing any whitespaces push(@{$anchor_refs{"$page#$anchor"}}, $page); return $page; } my $anchor = ""; - if ($link =~ s&#(.*)$&&) { + if ($link =~ s&#(.*)$&&s) { # Removed page ref (anchor) $anchor = $1; $anchor =~ s/%([\da-fA-F]{2})/chr(hex($1))/eg; # Translate hex to char $anchor =~ s/</</g; # $anchor =~ s/>/>/g; # + $anchor =~ s&^\s+&&; # Remove leading any whitespaces + $anchor =~ s&\s+$&&; # Remove trailing any whitespaces } $link = "" if $link eq "/"; |