History

Update Hammerspoon documentation (0.9.100)

Simon Legner committed 2 years ago

Commit f5369101 parent 018d09c3 files · +14 −13Browse files

Unified · Split

3 files
  1. lib/docs/filters/hammerspoon/clean_html.rb +2 −0
  2. lib/docs/filters/hammerspoon/entries.rb +3 −5
  3. lib/docs/scrapers/hammerspoon.rb +9 −8
lib/docs/filters/hammerspoon/clean_html.rb+2−0
@@ -3,6 +3,8 @@ module Docs · 2 unmodified lines
33 class CleanHtmlFilter < Filter
44 def call
55
6+ at_css("#search").parent.remove if at_css("#search")
7+
68 # Remove script tags for functionality not needed in DevDocs
79 css("script").remove
810
lib/docs/filters/hammerspoon/entries.rb+3−5
@@ -6,17 +6,15 @@ module Docs · 5 unmodified lines
66 end
77
88 def get_type
9− subpath.split("/")[0]
9+ slug.split("/").first
1010 end
1111
1212 def additional_entries
1313 return [] if root_page?
1414 entries = []
1515
16− base_name = at_css("h1").content
17−
1816 # add a base entry
19− entries << [base_name, nil, base_name]
17+ entries << [name, nil, name]
2018
2119 css("section").each do |section|
2220 title_node = section.at_css("h5")
@@ -53,7 +51,7 @@ module Docs · 30 unmodified lines
5351
5452 # Create a new entry for each method/function
5553 if fn_type != "Unknown"
56− entries << ["#{base_name}.#{entry_name}", entry_id, base_name]
54+ entries << ["#{name}.#{entry_name}", entry_id, name]
5755 end
5856
5957 end
lib/docs/scrapers/hammerspoon.rb+9−8
@@ -6,26 +6,27 @@ module Docs · 5 unmodified lines
66 home: 'https://www.hammerspoon.org',
77 code: 'https://github.com/Hammerspoon/hammerspoon'
88 }
9+ self.base_url = 'https://www.hammerspoon.org/docs/'
10+ self.release = '0.9.100'
911
1012 html_filters.push 'hammerspoon/clean_html', 'hammerspoon/entries'
1113
1214 # links with no content will still render a page, this is an error in the docs
1315 # (see: https://github.com/Hammerspoon/hammerspoon/pull/3579)
1416 options[:skip] = ['module.lp/matrix.md']
15− # Replace '/module.lp/' with '' in URLs
16− options[:replace_paths] = { 'localhost:12345/module.lp/MATRIX.md' => 'localhost:12345/module.lp/hs.canvas.matrix' }
17+ options[:skip_patterns] = [
18+ /LuaSkin/,
19+ ]
1720
1821 # Hammerspoon docs don't have a license (MIT specified in the hammerspoon repo)
1922 # https://github.com/Hammerspoon/hammerspoon/blob/master/LICENSE
2023 options[:attribution] = <<-HTML
21− Hammerspoon
24+ &copy; 2014–2017 Hammerspoon contributors<br>
25+ Licensed under the MIT License.
2226 HTML
2327
24−
25− version '0.9.100' do
26− self.release = '0.9.100'
27− # add `hs.doc.hsdocs.start()` to your init.lua to enable the docs server
28− self.base_url = 'http://localhost:12345/'
28+ def get_latest_version(opts)
29+ get_latest_github_release('Hammerspoon', 'hammerspoon', opts)
2930 end
3031
3132 end