Skip to content

Commit f536910

Browse files
committed
Update Hammerspoon documentation (0.9.100)
1 parent 018d09c commit f536910

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

lib/docs/filters/hammerspoon/clean_html.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ class Hammerspoon
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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ def get_name
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 @@ def additional_entries
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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@ class Hammerspoon < UrlScraper
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

0 commit comments

Comments
 (0)