Cimbali 6 년 전
부모
커밋
8fdca1d87c
6개의 변경된 파일53개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      lib/docs/filters/jq/clean_html.rb
  2. 20 0
      lib/docs/filters/jq/entries.rb
  3. 23 0
      lib/docs/scrapers/jq.rb
  4. BIN
      public/icons/docs/jq/16.png
  5. BIN
      public/icons/docs/jq/16@2x.png
  6. 1 0
      public/icons/docs/jq/SOURCE

+ 9 - 0
lib/docs/filters/jq/clean_html.rb

@@ -0,0 +1,9 @@
+module Docs
+  class Jq
+    class CleanHtmlFilter < Filter
+      def call
+        at_css('div#manualcontent')
+      end
+    end
+  end
+end

+ 20 - 0
lib/docs/filters/jq/entries.rb

@@ -0,0 +1,20 @@
+module Docs
+  class Jq
+    class EntriesFilter < Docs::EntriesFilter
+      def include_default_entry?
+        false
+      end
+
+      def additional_entries
+        entries = []
+        css('#manualcontent > section').each do |node|
+          type = node.at_css('h2').content
+          node.css('> section').each do |n|
+            entries << [n.at_css('h3').content, n['id'], type]
+          end
+        end
+        return entries
+      end
+    end
+  end
+end

+ 23 - 0
lib/docs/scrapers/jq.rb

@@ -0,0 +1,23 @@
+module Docs
+  class Jq < UrlScraper
+    self.name = 'jq'
+    self.slug = 'jq'
+    self.type = 'simple'
+    self.release = '1.6'
+    self.links = {
+      home: 'https://stedolan.github.io/jq/'
+    }
+
+    self.base_url = "https://stedolan.github.io/jq/manual/v#{self.release}/index.html"
+
+    html_filters.push 'jq/entries', 'jq/clean_html'
+
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; 2012 Stephen Dolan<br>
+      Licensed under the <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 license</a>
+    HTML
+
+  end
+end

BIN
public/icons/docs/jq/16.png


BIN
public/icons/docs/jq/16@2x.png


+ 1 - 0
public/icons/docs/jq/SOURCE

@@ -0,0 +1 @@
+https://stedolan.github.io/jq/jq.png