diff --git a/lib/docs/filters/hammerspoon/clean_html.rb b/lib/docs/filters/hammerspoon/clean_html.rb index a7bbca97..923ed678 100644 --- a/lib/docs/filters/hammerspoon/clean_html.rb +++ b/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 diff --git a/lib/docs/filters/hammerspoon/entries.rb b/lib/docs/filters/hammerspoon/entries.rb index b3a5083f..48e29387 100644 --- a/lib/docs/filters/hammerspoon/entries.rb +++ b/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 diff --git a/lib/docs/scrapers/hammerspoon.rb b/lib/docs/scrapers/hammerspoon.rb index e4ceae94..dc42b14d 100644 --- a/lib/docs/scrapers/hammerspoon.rb +++ b/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 + © 2014–2017 Hammerspoon contributors
+ 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