Browse Source

Merge pull request #2526 from alexbepple/ramda

Ramda
Simon Legner 5 months ago
parent
commit
131007f5fa
2 changed files with 10 additions and 6 deletions
  1. 3 1
      lib/docs/filters/ramda/entries.rb
  2. 7 5
      lib/docs/scrapers/ramda.rb

+ 3 - 1
lib/docs/filters/ramda/entries.rb

@@ -3,7 +3,9 @@ module Docs
     class EntriesFilter < Docs::EntriesFilter
       def additional_entries
         css('ul.toc li').map do |node|
-          ["R.#{node['data-name']}", node['data-name'], node['data-category'].sub('Relaction', 'Relation')]
+          # As of 2025-06-20, `data-category` attribute is missing on https://ramdajs.com/ for Ramda versions < 0.29.0.
+          # This results in missing type for entries – and docs cannot be generated.
+          ["R.#{node['data-name']}", node['data-name'], node['data-category']]
         end
       end
     end

+ 7 - 5
lib/docs/scrapers/ramda.rb

@@ -1,8 +1,6 @@
 module Docs
   class Ramda < UrlScraper
     self.type = 'ramda'
-    self.release = '0.27.0'
-    self.base_url = "https://ramdajs.com/#{release}/docs/"
     self.links = {
       home: 'http://ramdajs.com/',
       code: 'https://github.com/ramda/ramda/'
@@ -12,13 +10,17 @@ module Docs
 
     options[:title] = 'Ramda'
     options[:attribution] = <<-HTML
-      &copy; 2013&ndash;2020 Scott Sauyet and Michael Hurley<br>
+      &copy; 2013&ndash;2025 Scott Sauyet and Michael Hurley<br>
       Licensed under the MIT License.
     HTML
 
+    version do
+      self.release = '0.31.3'
+      self.base_url = "https://ramdajs.com/#{release}/docs/"
+    end
+
     def get_latest_version(opts)
-      doc = fetch_doc('https://ramdajs.com/docs/', opts)
-      doc.at_css('.navbar-brand > .version').content[1..-1]
+      get_npm_version('ramda', opts)
     end
   end
 end