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
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 5
6 at_css("#search").parent.remove if at_css("#search")
7
6 # Remove script tags for functionality not needed in DevDocs8 # Remove script tags for functionality not needed in DevDocs
7 css("script").remove9 css("script").remove
8 10
lib/docs/filters/hammerspoon/entries.rb+3−5
@@ -6,17 +6,15 @@ module Docs · 5 unmodified lines
6 end6 end
7 7
8 def get_type8 def get_type
9 subpath.split("/")[0]9 slug.split("/").first
10 end10 end
11 11
12 def additional_entries12 def additional_entries
13 return [] if root_page?13 return [] if root_page?
14 entries = []14 entries = []
15 15
16 base_name = at_css("h1").content
17
18 # add a base entry16 # add a base entry
19 entries << [base_name, nil, base_name]17 entries << [name, nil, name]
20 18
21 css("section").each do |section|19 css("section").each do |section|
22 title_node = section.at_css("h5")20 title_node = section.at_css("h5")
@@ -53,7 +51,7 @@ module Docs · 30 unmodified lines
53 51
54 # Create a new entry for each method/function52 # Create a new entry for each method/function
55 if fn_type != "Unknown"53 if fn_type != "Unknown"
56 entries << ["#{base_name}.#{entry_name}", entry_id, base_name]54 entries << ["#{name}.#{entry_name}", entry_id, name]
57 end55 end
58 56
59 end57 end
lib/docs/scrapers/hammerspoon.rb+9−8
@@ -6,26 +6,27 @@ module Docs · 5 unmodified lines
6 home: 'https://www.hammerspoon.org',6 home: 'https://www.hammerspoon.org',
7 code: 'https://github.com/Hammerspoon/hammerspoon'7 code: 'https://github.com/Hammerspoon/hammerspoon'
8 }8 }
9 self.base_url = 'https://www.hammerspoon.org/docs/'
10 self.release = '0.9.100'
9 11
10 html_filters.push 'hammerspoon/clean_html', 'hammerspoon/entries'12 html_filters.push 'hammerspoon/clean_html', 'hammerspoon/entries'
11 13
12 # links with no content will still render a page, this is an error in the docs14 # links with no content will still render a page, this is an error in the docs
13 # (see: https://github.com/Hammerspoon/hammerspoon/pull/3579)15 # (see: https://github.com/Hammerspoon/hammerspoon/pull/3579)
14 options[:skip] = ['module.lp/matrix.md']16 options[:skip] = ['module.lp/matrix.md']
15 # Replace '/module.lp/' with '' in URLs17 options[:skip_patterns] = [
16 options[:replace_paths] = { 'localhost:12345/module.lp/MATRIX.md' => 'localhost:12345/module.lp/hs.canvas.matrix' }18 /LuaSkin/,
19 ]
17 20
18 # Hammerspoon docs don't have a license (MIT specified in the hammerspoon repo)21 # Hammerspoon docs don't have a license (MIT specified in the hammerspoon repo)
19 # https://github.com/Hammerspoon/hammerspoon/blob/master/LICENSE22 # https://github.com/Hammerspoon/hammerspoon/blob/master/LICENSE
20 options[:attribution] = <<-HTML23 options[:attribution] = <<-HTML
21 Hammerspoon24 &copy; 2014–2017 Hammerspoon contributors<br>
25 Licensed under the MIT License.
22 HTML26 HTML
23 27
24 28 def get_latest_version(opts)
25 version '0.9.100' do29 get_latest_github_release('Hammerspoon', 'hammerspoon', opts)
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/'
29 end30 end
30 31
31 end32 end