[devdocsgjs/main: 1670/1867] Add jq




commit 8fdca1d87cf1114553e2e856c7f08e2e62bb98c7
Author: Cimbali <me cimba li>
Date:   Sat Nov 30 23:54:35 2019 +0100

    Add jq

 lib/docs/filters/jq/clean_html.rb |   9 +++++++++
 lib/docs/filters/jq/entries.rb    |  20 ++++++++++++++++++++
 lib/docs/scrapers/jq.rb           |  23 +++++++++++++++++++++++
 public/icons/docs/jq/16.png       | Bin 0 -> 801 bytes
 public/icons/docs/jq/16 2x png    | Bin 0 -> 1085 bytes
 public/icons/docs/jq/SOURCE       |   1 +
 6 files changed, 53 insertions(+)
---
diff --git a/lib/docs/filters/jq/clean_html.rb b/lib/docs/filters/jq/clean_html.rb
new file mode 100644
index 00000000..e3c9f650
--- /dev/null
+++ b/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
diff --git a/lib/docs/filters/jq/entries.rb b/lib/docs/filters/jq/entries.rb
new file mode 100644
index 00000000..0f6e1ceb
--- /dev/null
+++ b/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
diff --git a/lib/docs/scrapers/jq.rb b/lib/docs/scrapers/jq.rb
new file mode 100644
index 00000000..3a64d59e
--- /dev/null
+++ b/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
diff --git a/public/icons/docs/jq/16.png b/public/icons/docs/jq/16.png
new file mode 100644
index 00000000..03ed0c0d
Binary files /dev/null and b/public/icons/docs/jq/16.png differ
diff --git a/public/icons/docs/jq/16 2x png b/public/icons/docs/jq/16 2x png
new file mode 100644
index 00000000..3cb816a5
Binary files /dev/null and b/public/icons/docs/jq/16 2x png differ
diff --git a/public/icons/docs/jq/SOURCE b/public/icons/docs/jq/SOURCE
new file mode 100644
index 00000000..fadafe6b
--- /dev/null
+++ b/public/icons/docs/jq/SOURCE
@@ -0,0 +1 @@
+https://stedolan.github.io/jq/jq.png


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]