This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 4c96ba9 Allow for spurious spaces around hrefs
4c96ba9 is described below
commit 4c96ba905d0bc43f440678f02f54377b924654c4
Author: Sebb <[email protected]>
AuthorDate: Mon Mar 29 16:00:51 2021 +0100
Allow for spurious spaces around hrefs
---
tools/download_check.rb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/download_check.rb b/tools/download_check.rb
index 48016ca..b6348a3 100755
--- a/tools/download_check.rb
+++ b/tools/download_check.rb
@@ -252,8 +252,12 @@ def get_links(body)
doc = Nokogiri::HTML(body)
nodeset = doc.css('a[href]') # Get anchors w href attribute via css
nodeset.map { |node|
- href = node.attribute("href").to_s
- text = node.text.gsub(/[[:space:]]+/,' ')
+ tmp = node.attribute("href").to_s
+ href = tmp.strip
+ if tmp != href
+ W "Spurious space(s) in '#{tmp}'"
+ end
+ text = node.text.gsub(/[[:space:]]+/,' ').strip
[href,text]
}.select{|x, _y| x =~ %r{^(https?:)?//} }
end