Skip to content

Commit 8fdca1d

Browse files
committed
Add jq
1 parent cce7c49 commit 8fdca1d

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

lib/docs/filters/jq/clean_html.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Docs
2+
class Jq
3+
class CleanHtmlFilter < Filter
4+
def call
5+
at_css('div#manualcontent')
6+
end
7+
end
8+
end
9+
end

lib/docs/filters/jq/entries.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module Docs
2+
class Jq
3+
class EntriesFilter < Docs::EntriesFilter
4+
def include_default_entry?
5+
false
6+
end
7+
8+
def additional_entries
9+
entries = []
10+
css('#manualcontent > section').each do |node|
11+
type = node.at_css('h2').content
12+
node.css('> section').each do |n|
13+
entries << [n.at_css('h3').content, n['id'], type]
14+
end
15+
end
16+
return entries
17+
end
18+
end
19+
end
20+
end

lib/docs/scrapers/jq.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module Docs
2+
class Jq < UrlScraper
3+
self.name = 'jq'
4+
self.slug = 'jq'
5+
self.type = 'simple'
6+
self.release = '1.6'
7+
self.links = {
8+
home: 'https://stedolan.github.io/jq/'
9+
}
10+
11+
self.base_url = "https://stedolan.github.io/jq/manual/v#{self.release}/index.html"
12+
13+
html_filters.push 'jq/entries', 'jq/clean_html'
14+
15+
options[:skip_links] = true
16+
17+
options[:attribution] = <<-HTML
18+
&copy; 2012 Stephen Dolan<br>
19+
Licensed under the <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 license</a>
20+
HTML
21+
22+
end
23+
end

public/icons/docs/jq/16.png

801 Bytes
Loading
1.06 KB
Loading

public/icons/docs/jq/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://stedolan.github.io/jq/jq.png

0 commit comments

Comments
 (0)