mansi75 commented on code in PR #56:
URL: https://github.com/apache/fineract-site/pull/56#discussion_r2963565530


##########
scripts/run_whimsy_checks.rb:
##########
@@ -0,0 +1,73 @@
+#!/usr/bin/env ruby
+# Extracted from 
https://github.com/apache/whimsy/blob/master/tools/site-scan.rb
+# Only includes site parsing logic - no ASF/LDAP/committee dependencies
+
+require 'net/http'
+require 'nokogiri'
+require 'uri'
+require 'json'
+
+# Copied directly from site-scan.rb
+def squash(text)
+  text.scrub.gsub(/[[:space:]]+/, ' ').strip
+end
+
+# Copied directly from site-scan.rb
+def get_link_text(anode)
+  bits = []
+  anode.traverse do |node|
+    if node.name == 'text'
+      bits << node.text unless node.parent.name == 'span' and
+        node.parent.attribute('class')&.value&.end_with?('sr-only')
+    end
+  end
+  squash(bits.join(' '))
+end
+
+# Copied from sitestandards.rb COMMON_CHECKS patterns
+CHECKS = {
+  'foundation'  => { url: /apache\.org/,                              text: 
nil },
+  'license'     => { url: /^https?:\/\/.*apache\.org\/licenses\/?$/,  text: 
/^license$/i },
+  'thanks'      => { url: nil, text: /^(thanks|sponsors|thanks to our 
sponsors)$/i },
+  'security'    => { url: nil, text: /^security$/i },
+  'sponsorship' => { url: nil, text: /^(sponsorship|sponsor|donate)$/i },
+  'privacy'     => { url: nil, text: /^privacy$/i },
+  'events'      => { url: /apache\.org\/events\/current-event/, text: nil },
+}

Review Comment:
   @meonkeys Thank you for the above valuable ideas
   
   I think License and Thanks are failing because of this
   
   <img width="1028" height="181" alt="Screenshot 2026-03-20 at 1 15 37 AM" 
src="https://github.com/user-attachments/assets/45beeb62-1f54-442a-9937-390342b191c2";
 />
   
   The root cause is in how whimsy's get_link_text() function in site-scan.rb 
reads link text. It collects all text nodes inside <a>, skipping only text 
whose parent is a `<span>` with a class ending in sr-only. The current 
index.html on asf-site was built from a template using `<i>` for the icon. 
   
   <img width="1184" height="94" alt="Screenshot 2026-03-20 at 1 32 17 AM" 
src="https://github.com/user-attachments/assets/598f9b73-e790-4e02-9723-0dc702d4cb8e";
 />
   
   "gavel"  parent is `<i>` so it is not skipped by whimsy and is collected. 
License's parent is plain `<span>`  (no class) it is also not skipped and is 
collected.  Result is combined text and down cased  "gavel license",  whimsy 
checks "gavel license" =~ /^license$/, no match so red. Same happens for thanks 
as it turns into "favorite thanks". 
   
   In this PR I have fixed the template in home-footer.html by changing the 
icon from `<i>` to `<span class="material-icons icon-sr-only">`
   
   I will update the checks on run_whimsy_checks.rb, I think it is not working 
like the actual whimsy sitestandards.rb
   I will also work on the ideas you have given for unit test, new workflow and 
script update. It makes more sense to have them to avoid checks failing on 
https://whimsy.apache.org/site/project/fineract.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to