Преглед изворни кода

Merge pull request #2146 from ire4ever1190/chore/bump-nim

Bump Nim to 2.0.2
Simon Legner пре 1 година
родитељ
комит
ce6eca5d76
2 измењених фајлова са 16 додато и 6 уклоњено
  1. 7 4
      lib/docs/filters/nim/entries.rb
  2. 9 2
      lib/docs/scrapers/nim.rb

+ 7 - 4
lib/docs/filters/nim/entries.rb

@@ -16,8 +16,10 @@ module Docs
         name.remove! ' User Guide'
         name.remove! ' User\'s manual'
         name.remove! %r{ \-.*}
+        name.remove! %r{\Asrc/}
+        name.remove! %r{\Astd/}
         name.strip!
-        name
+        name.split("/").last
       end
 
       def get_type
@@ -54,10 +56,11 @@ module Docs
         else
 
           css('.simple-toc-section a, .nested-toc-section a').each do |node|
-            entry_name = node.content
-            entry_name.gsub!(/,.*/, '')
+            match = /^`(.*)`|^(\w+)/.match(node.content)
+            entry_name = match[1] || match[2]
+
             entry_id = slug + node['href']
-            entries << [entry_name, entry_id, name]
+            entries << ["#{entry_name} (#{name})", entry_id, name]
           end
 
         end

+ 9 - 2
lib/docs/scrapers/nim.rb

@@ -1,7 +1,6 @@
 module Docs
   class Nim < UrlScraper
     self.type = 'simple'
-    self.release = '1.4.8'
     self.base_url = 'https://nim-lang.org/docs/'
     self.root_path = 'overview.html'
     self.links = {
@@ -14,10 +13,18 @@ module Docs
     options[:skip] = %w(theindex.html docgen.html tut1.html tut2.html tut3.html tools.html)
 
     options[:attribution] = <<-HTML
-      &copy; 2006&ndash;2021 Andreas Rumpf<br>
+      &copy; 2006&ndash;2024 Andreas Rumpf<br>
       Licensed under the MIT License.
     HTML
 
+    version do
+      self.release = '2.0.2'
+    end
+
+    version '1' do
+      self.release = '1.4.8'
+    end
+
     def get_latest_version(opts)
       doc = fetch_doc('https://nim-lang.org/docs/overview.html', opts)
       doc.at_css('.container > .docinfo > tbody > tr:last-child > td').content.strip