From 8fdca1d87cf1114553e2e856c7f08e2e62bb98c7 Mon Sep 17 00:00:00 2001 From: Cimbali Date: Sat, 30 Nov 2019 23:54:35 +0100 Subject: [PATCH] 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(+) create mode 100644 lib/docs/filters/jq/clean_html.rb create mode 100644 lib/docs/filters/jq/entries.rb create mode 100644 lib/docs/scrapers/jq.rb create mode 100644 public/icons/docs/jq/16.png create mode 100644 public/icons/docs/jq/16@2x.png create mode 100644 public/icons/docs/jq/SOURCE 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 + © 2012 Stephen Dolan
+ Licensed under the Creative Commons Attribution 3.0 license + HTML + + end +end diff --git a/public/icons/docs/jq/16.png b/public/icons/docs/jq/16.png new file mode 100644 index 0000000000000000000000000000000000000000..03ed0c0de47146c7b0cea33cec7c7a31d7473166 GIT binary patch literal 801 zcmV++1K#|JP)EX>4Tx04R}tkv&MmKpe$iQ%hAU4t9{@kfAz=MNtt)twIqhgj%6h2a`)bgeDD1 zi;JV+T5#}VvFhOBtgC~oAP9bdxVbqgx=4xtOA0MwJUH&hyL*qjcYshYG0o~212ny2 zrV?>6lU)&muLvN5E{tMWW|lE4NlAE)uY36TdKcqa-sk=tJ!;NkfKMczVTM^DUMHT~ ztQeg4iNmZYtHkHTBPLyt_>t?1%Ws?u4huXpY^GCl#9?Bw(8fv|v!baHPZCE}O{aVz zT(>l354hX``kxHhlpV=WQ^@Cm_cQvYEYNogbg#O-HTQA)0Hmp_y{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2jvAC2{I6Z4`+Y?000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0002^Nkl%>U48&*OjNfJ)iS@&-eX3&yT}D*a1GV)hpl; z4IK6gn8hxt-E1C=-^)j(z2ZE&g8igb#T6#d*944WDtb8J$pUtY)j)5tf`N9YI!X<8 zvR=yi8RLmKSCQvK_6t*srW zK-)!ZF&${+c`vjXTqM_#ViMO{z++g)MrPp~P>Xmg{_=#O4yPO_0n<3k1*+qu7^-&G fhkM-p`RaZF1FJRx<9Z}e00000NkvXXu0mjfigaO- literal 0 HcmV?d00001 diff --git a/public/icons/docs/jq/16@2x.png b/public/icons/docs/jq/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3cb816a5b6fe8da3f1ae0dc7af536fcbb2c1f6b9 GIT binary patch literal 1085 zcmV-D1j74?P)EX>4Tx04R}tkv&MmKpe$iQ%hAU4t9{@kfAz=MNtt)twIqhgj%6h2a`)bgeDD1 zi;JV+T5#}VvFhOBtgC~oAP9bdxVbqgx=4xtOA0MwJUH&hyL*qjcYshYG0o~212ny2 zrV?>6lU)&muLvN5E{tMWW|lE4NlAE)uY36TdKcqa-sk=tJ!;NkfKMczVTM^DUMHT~ ztQeg4iNmZYtHkHTBPLyt_>t?1%Ws?u4huXpY^GCl#9?Bw(8fv|v!baHPZCE}O{aVz zT(>l354hX``kxHhlpV=WQ^@Cm_cQvYEYNogbg#O-HTQA)0Hmp_y{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2jvAC2{Hn4wid_$000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0006MNklEGVm#Dx%o4-(gV6%dP_7zPd>GBwC-t(uCjs zy86I@M3=jaB{`pc;UX(+#q$BsgBOY9k8uUVfhSpA0ANSKKkTSwI1u|3p?-!_nCg&g zrc?4(^v?3vbbRcJ#NndA&0#pWnRs?5D%<^%cM%m%}Y{^|V(JO=ISx1