Explorar o código

Update Hammerspoon documentation (0.9.100)

Simon Legner hai 1 ano
pai
achega
f536910cb3

+ 2 - 0
lib/docs/filters/hammerspoon/clean_html.rb

@@ -3,6 +3,8 @@ module Docs
     class CleanHtmlFilter < Filter
       def call
 
+        at_css("#search").parent.remove if at_css("#search")
+
         # Remove script tags for functionality not needed in DevDocs
         css("script").remove
 

+ 3 - 5
lib/docs/filters/hammerspoon/entries.rb

@@ -6,17 +6,15 @@ module Docs
       end
 
       def get_type
-        subpath.split("/")[0]
+        slug.split("/").first
       end
 
       def additional_entries
         return [] if root_page?
         entries = []
 
-        base_name = at_css("h1").content
-
         # add a base entry
-        entries << [base_name, nil, base_name]
+        entries << [name, nil, name]
 
         css("section").each do |section|
           title_node = section.at_css("h5")
@@ -53,7 +51,7 @@ module Docs
 
           # Create a new entry for each method/function
           if fn_type != "Unknown"
-            entries << ["#{base_name}.#{entry_name}", entry_id, base_name]
+            entries << ["#{name}.#{entry_name}", entry_id, name]
           end
 
         end

+ 9 - 8
lib/docs/scrapers/hammerspoon.rb

@@ -6,26 +6,27 @@ module Docs
       home: 'https://www.hammerspoon.org',
       code: 'https://github.com/Hammerspoon/hammerspoon'
     }
+    self.base_url = 'https://www.hammerspoon.org/docs/'
+    self.release = '0.9.100'
 
     html_filters.push 'hammerspoon/clean_html', 'hammerspoon/entries'
 
     # links with no content will still render a page, this is an error in the docs
     # (see: https://github.com/Hammerspoon/hammerspoon/pull/3579)
     options[:skip] = ['module.lp/matrix.md']
-    # Replace '/module.lp/' with '' in URLs
-    options[:replace_paths] = { 'localhost:12345/module.lp/MATRIX.md' => 'localhost:12345/module.lp/hs.canvas.matrix' }
+    options[:skip_patterns] = [
+      /LuaSkin/,
+    ]
 
     # Hammerspoon docs don't have a license (MIT specified in the hammerspoon repo)
     # https://github.com/Hammerspoon/hammerspoon/blob/master/LICENSE
     options[:attribution] = <<-HTML
-      Hammerspoon
+      &copy; 2014–2017 Hammerspoon contributors<br>
+      Licensed under the MIT License.
     HTML
 
-
-    version '0.9.100' do
-      self.release = '0.9.100'
-      # add `hs.doc.hsdocs.start()` to your init.lua to enable the docs server
-      self.base_url = 'http://localhost:12345/'
+    def get_latest_version(opts)
+      get_latest_github_release('Hammerspoon', 'hammerspoon', opts)
     end
 
   end