History

Add jq

Cimbali committed 6 years ago

Commit 8fdca1d1 parent cce7c496 files · +51 −-2Browse files

Unified · Split

6 files
  1. lib/docs/filters/jq/clean_html.rb +9 −0
  2. lib/docs/filters/jq/entries.rb +20 −0
  3. lib/docs/scrapers/jq.rb +23 −0
  4. public/icons/docs/jq/16.png +0 −0
  5. public/icons/docs/jq/16@2x.png +0 −0
  6. public/icons/docs/jq/SOURCE +1 −0
lib/docs/filters/jq/clean_html.rb+9−0
@@ -0,0 +1,9 @@
1module Docs
2 class Jq
3 class CleanHtmlFilter < Filter
4 def call
5 at_css('div#manualcontent')
6 end
7 end
8 end
9end
lib/docs/filters/jq/entries.rb+20−0
@@ -0,0 +1,20 @@
1module 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
20end
lib/docs/scrapers/jq.rb+23−0
@@ -0,0 +1,23 @@
1module 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
23end
public/icons/docs/jq/16.png+0−0

Binary file not shown.

public/icons/docs/jq/16@2x.png+0−0

Binary file not shown.

public/icons/docs/jq/SOURCE+1−0
@@ -0,0 +1 @@
1https://stedolan.github.io/jq/jq.png