summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLukas Larsson <lukas@erlang.org>2020-04-17 16:44:46 +0200
committerLukas Larsson <lukas@erlang.org>2020-04-17 17:00:26 +0200
commit36071d7cbff6163d4d5d8ce0b8e9936146e76a38 (patch)
tree6302862649887b15fb61ea99722b45d59742eb82 /scripts
parent2e3e5ffce77072f7a252e58507af91b08099765a (diff)
downloaderlang-36071d7cbff6163d4d5d8ce0b8e9936146e76a38.tar.gz
docs: In link check trim leading and trailing whitespace from anchors
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/otp_html_check8
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/&lt;/</g; #
$anchor =~ s/&gt;/>/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/&lt;/</g; #
$anchor =~ s/&gt;/>/g; #
+ $anchor =~ s&^\s+&&; # Remove leading any whitespaces
+ $anchor =~ s&\s+$&&; # Remove trailing any whitespaces
}
$link = "" if $link eq "/";