From 57232ce130a64eceded02b89fb38e64523e4db3a Mon Sep 17 00:00:00 2001 From: Nicolas Ettlin Date: Wed, 17 Oct 2018 21:21:21 +0200 Subject: [PATCH 01/69] Add Vuex reference --- .../templates/pages/about_tmpl.coffee | 5 ++ lib/docs/filters/vuex/clean_html.rb | 14 ++++ lib/docs/filters/vuex/entries.rb | 68 ++++++++++++++++++ lib/docs/scrapers/vuex.rb | 26 +++++++ public/icons/docs/vuex/16.png | Bin 0 -> 534 bytes public/icons/docs/vuex/16@2x.png | Bin 0 -> 1244 bytes public/icons/docs/vuex/SOURCE | 1 + 7 files changed, 114 insertions(+) create mode 100644 lib/docs/filters/vuex/clean_html.rb create mode 100644 lib/docs/filters/vuex/entries.rb create mode 100644 lib/docs/scrapers/vuex.rb create mode 100644 public/icons/docs/vuex/16.png create mode 100644 public/icons/docs/vuex/16@2x.png create mode 100644 public/icons/docs/vuex/SOURCE diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index fef9a024..72fb74cd 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -680,6 +680,11 @@ credits = [ '2013-2018 Evan You, Vue.js contributors', 'MIT', 'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE' + ], [ + 'Vuex', + '2015-2018 Evan You, Vue.js contributors', + 'MIT', + 'https://raw.githubusercontent.com/vuejs/vuex/master/LICENSE' ], [ 'Vulkan', '2014-2017 Khronos Group Inc.
Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.', diff --git a/lib/docs/filters/vuex/clean_html.rb b/lib/docs/filters/vuex/clean_html.rb new file mode 100644 index 00000000..f62870cc --- /dev/null +++ b/lib/docs/filters/vuex/clean_html.rb @@ -0,0 +1,14 @@ +module Docs + class Vuex + class CleanHtmlFilter < Filter + def call + @doc = at_css('.content') + + # Remove unneeded elements + css('.header-anchor').remove + + doc + end + end + end +end \ No newline at end of file diff --git a/lib/docs/filters/vuex/entries.rb b/lib/docs/filters/vuex/entries.rb new file mode 100644 index 00000000..72c8486e --- /dev/null +++ b/lib/docs/filters/vuex/entries.rb @@ -0,0 +1,68 @@ +module Docs + class Vuex + class EntriesFilter < Docs::EntriesFilter + def get_name + name = at_css('h1').content + + name.remove! '# ' + + # Add index on guides + unless subpath.start_with?('api') + sidebarLink = at_css('.sidebar-link.active') + allLinks = css('.sidebar-link:not([href="/"]):not([href="../index"])') + + index = allLinks.index(sidebarLink) + + name.prepend "#{index + 1}. " if index + end + + name + end + + def get_type + 'Guide' + end + + def include_default_entry? + name != 'API Reference' + end + + def additional_entries + return [] unless subpath.start_with?('api') + + entries = [ + ['Component Binding Helpers', 'component-binding-helpers', 'API Reference'], + ['Store', 'vuex-store', 'API Reference'], + ] + + css('h3').each do |node| + entryName = node.content.strip + + # Get the previous h2 title + title = node + title = title.previous_element until title.name == 'h2' + title = title.content.strip + title.remove! '# ' + + entryName.remove! '# ' + + unless entryName.start_with?('router.') + if title == "Vuex.Store Constructor Options" + entryName = "StoreOptions.#{entryName}" + elsif title == "Vuex.Store Instance Properties" + entryName = "Vuex.Store.#{entryName}" + elsif title == "Vuex.Store Instance Methods" + entryName = "Vuex.Store.#{entryName}()" + elsif title == "Component Binding Helpers" + entryName = "#{entryName}()" + end + end + + entries << [entryName, node['id'], 'API Reference'] + end + + entries + end + end + end +end \ No newline at end of file diff --git a/lib/docs/scrapers/vuex.rb b/lib/docs/scrapers/vuex.rb new file mode 100644 index 00000000..774e989f --- /dev/null +++ b/lib/docs/scrapers/vuex.rb @@ -0,0 +1,26 @@ +module Docs + class Vuex < UrlScraper + self.name = 'Vuex' + self.type = 'simple' + + self.links = { + home: 'https://vuex.vuejs.org', + code: 'https://github.com/vuejs/vuex' + } + + html_filters.push 'vuex/entries', 'vuex/clean_html' + + self.release = '3.0.1' + self.base_url = 'https://vuex.vuejs.org/' + + options[:skip_patterns] = [ + # Other languages + /^(zh|ja|ru|kr|fr|ptbr)\//, + ] + + options[:attribution] = <<-HTML + © 2015–2018 Evan You, Vue.js contributors
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/vuex/16.png b/public/icons/docs/vuex/16.png new file mode 100644 index 0000000000000000000000000000000000000000..153c58cdefe476e6738e7123d9c35a56d482a1ef GIT binary patch literal 534 zcmV+x0_pvUP)*H1M-xUw)lk~@0;(RckjKZ%G3U_T6BNH-SSH(m0NOKtx~PF zGNB4U!y`kM4qc_=?qhEw_@YPQ`^wt2kCXPL4|aX&vpv^pQ3P-_JTheI&{Z>W;8b7r zrMlf09d+e&V_BxpUlw~IFVx#d88{jq8M1WfD&QsE2eaD)(Jy=7orl-QR=M$`e4#B< z^UaWfqv4SuOGg3V#Ni2Vqw`H~_AtiND_1hB(vYe8(wKpx;b}5)=PMlr@&`H0n%`%2 z_VqpSHp8E1p4`YRcQLc)n!>=*yiqSDL-tQsxWp+M!i${F;o3K6z^HE!@$w-Oty%>kClJv&bc>h{39s?M>Cn-;ER8d zwHEouy`=Lgzqc@OG?Ovd>lAUY%&RkSP!N>M_w{Ifz&K=Wd>0{;Yv*xpw2ZdX@IH6y{x445yCHs4yy>o2 zn*(2*Y+Bi3Gd*5vS|d|8t!FXz_x8az;8U3+zD!^O^;58*#0710VmvO zpoJ#dJ#ORFNdDS6J$(6NJ$&g*_%Q`gK zg4h}f{0;)?u~N-!8!pBeIclf{0~QXr;Dj3uw9qu0=Pr4VOY$#wrNSh(CDsDa&Z@8b z=HJq(Y*AZ>OUinFS_%1fW_(tsCuX0E@WhOfqlQ{AVBvrZPPjz_@juZF_wQ0U*gx5m z_j8-)Bn{6+;VWmu3DkF1VZ~SWlBY5=b1G#|Dr+pnDV$KTYcgULz6#U)3L0vihBAs3u(z4DCF zYGWoLpwIF@oCowz*u6Uq`OOE)%1v<^qK3qY86!tcPzxr&3I|+p?kbKIYT>0abg}ZN z0Dg1VssQgsr-G*H_udX0GCYSaj-|P#v+ult z6PpW%8fw9SHC+3(hNgWg}uiL&k)IF>(@LO<+5;Lzu*mnE6TK%8mY6Ye@!GCTV6fpoCPII>tE_~77nhhx z{7$Y*6G(1_-SFn4&o`Wyu`Voq`}YKYDCEh19$G)Gabm_yP4~>a(fE9Ok*>#yW4W$d z^w*7sye^l{_1Kf+-8a*aOAAlqoituY*L1u1f1gCB;{O6E4`2-|#LHj+0000 Date: Tue, 11 Dec 2018 19:41:52 +0100 Subject: [PATCH 02/69] Add Pony filters/scraper --- lib/docs/filters/pony/clean_html.rb | 10 ++++++++++ lib/docs/filters/pony/container.rb | 9 +++++++++ lib/docs/filters/pony/entries.rb | 14 ++++++++++++++ lib/docs/scrapers/pony.rb | 12 ++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 lib/docs/filters/pony/clean_html.rb create mode 100644 lib/docs/filters/pony/container.rb create mode 100644 lib/docs/filters/pony/entries.rb create mode 100644 lib/docs/scrapers/pony.rb diff --git a/lib/docs/filters/pony/clean_html.rb b/lib/docs/filters/pony/clean_html.rb new file mode 100644 index 00000000..0aac0f7a --- /dev/null +++ b/lib/docs/filters/pony/clean_html.rb @@ -0,0 +1,10 @@ +module Docs + class Pony + class CleanHtmlFilter < Filter + def call + css('.headerlink').remove + doc + end + end + end +end diff --git a/lib/docs/filters/pony/container.rb b/lib/docs/filters/pony/container.rb new file mode 100644 index 00000000..f29db7d4 --- /dev/null +++ b/lib/docs/filters/pony/container.rb @@ -0,0 +1,9 @@ +module Docs + class Pony + class ContainerFilter < Filter + def call + css('article') + end + end + end +end diff --git a/lib/docs/filters/pony/entries.rb b/lib/docs/filters/pony/entries.rb new file mode 100644 index 00000000..09ffe595 --- /dev/null +++ b/lib/docs/filters/pony/entries.rb @@ -0,0 +1,14 @@ +module Docs + class Pony + class EntriesFilter < Docs::EntriesFilter + def get_name + binding.pry + context[:html_title].sub(/ - .*/, '') + end + + def get_type + subpath.split('-')[0][1..-1] + end + end + end +end diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb new file mode 100644 index 00000000..9863ed76 --- /dev/null +++ b/lib/docs/scrapers/pony.rb @@ -0,0 +1,12 @@ +module Docs + class Pony < UrlScraper + self.type = 'pony' + self.release = '0.25.0' + self.base_url = 'http://localhost:2015' + #self.base_url = 'https://stdlib.ponylang.io/' + + html_filters.push 'pony/container', 'pony/entries', 'pony/clean_html' + options[:attribution] = "Me" + options[:follow_links] = ->(filter) { filter.subpath !~ /src/ } + end +end From 04ccf963961ede13401bf888d73fb6900ceecc56 Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Thu, 13 Dec 2018 22:24:03 +0100 Subject: [PATCH 03/69] Remove header handling This is already taken care of in the container filter. --- lib/docs/filters/pony/clean_html.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/docs/filters/pony/clean_html.rb b/lib/docs/filters/pony/clean_html.rb index 0aac0f7a..248c3de7 100644 --- a/lib/docs/filters/pony/clean_html.rb +++ b/lib/docs/filters/pony/clean_html.rb @@ -2,7 +2,6 @@ module Docs class Pony class CleanHtmlFilter < Filter def call - css('.headerlink').remove doc end end From dea577a1a3e36b4052cb4c82ec0cbbd7e7398f80 Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Thu, 13 Dec 2018 22:24:34 +0100 Subject: [PATCH 04/69] Fix type naming and remove debug statement --- lib/docs/filters/pony/entries.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/docs/filters/pony/entries.rb b/lib/docs/filters/pony/entries.rb index 09ffe595..0dbc81c8 100644 --- a/lib/docs/filters/pony/entries.rb +++ b/lib/docs/filters/pony/entries.rb @@ -2,12 +2,11 @@ module Docs class Pony class EntriesFilter < Docs::EntriesFilter def get_name - binding.pry context[:html_title].sub(/ - .*/, '') end def get_type - subpath.split('-')[0][1..-1] + subpath.split('-')[0][0..-1] end end end From 56c6fe95afe686dc78a70b16c684cefef7aec156 Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Thu, 13 Dec 2018 22:25:07 +0100 Subject: [PATCH 05/69] Use live URL --- lib/docs/scrapers/pony.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index 9863ed76..6fb1dd56 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -2,8 +2,7 @@ module Docs class Pony < UrlScraper self.type = 'pony' self.release = '0.25.0' - self.base_url = 'http://localhost:2015' - #self.base_url = 'https://stdlib.ponylang.io/' + self.base_url = 'https://stdlib.ponylang.io/' html_filters.push 'pony/container', 'pony/entries', 'pony/clean_html' options[:attribution] = "Me" From 6a8a80d190f4791009fde522ea37c00abfdb7c6e Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Thu, 13 Dec 2018 22:25:23 +0100 Subject: [PATCH 06/69] Fix ordering of filters --- lib/docs/scrapers/pony.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index 6fb1dd56..a9cbd6c3 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -4,7 +4,7 @@ module Docs self.release = '0.25.0' self.base_url = 'https://stdlib.ponylang.io/' - html_filters.push 'pony/container', 'pony/entries', 'pony/clean_html' + html_filters.push 'pony/container', 'pony/clean_html', 'pony/entries' options[:attribution] = "Me" options[:follow_links] = ->(filter) { filter.subpath !~ /src/ } end From 21aca67a5330088eff9768c962bee5b3344b20de Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Thu, 13 Dec 2018 22:25:36 +0100 Subject: [PATCH 07/69] Deal with trailing slash and 'src' URLs --- lib/docs/scrapers/pony.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index a9cbd6c3..0201ed18 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -6,6 +6,7 @@ module Docs html_filters.push 'pony/container', 'pony/clean_html', 'pony/entries' options[:attribution] = "Me" - options[:follow_links] = ->(filter) { filter.subpath !~ /src/ } + options[:trailing_slash] = false + options[:skip_patterns] = [/src/] end end From 81efc885ec2256fd6688da1c247346591d143c63 Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Thu, 13 Dec 2018 22:33:17 +0100 Subject: [PATCH 08/69] Add logos --- public/icons/docs/pony/16.png | Bin 0 -> 1979 bytes public/icons/docs/pony/16@2x.png | Bin 0 -> 1979 bytes public/icons/docs/pony/SOURCE | 1 + 3 files changed, 1 insertion(+) create mode 100644 public/icons/docs/pony/16.png create mode 100644 public/icons/docs/pony/16@2x.png create mode 100644 public/icons/docs/pony/SOURCE diff --git a/public/icons/docs/pony/16.png b/public/icons/docs/pony/16.png new file mode 100644 index 0000000000000000000000000000000000000000..daed6509fb0efbcee6aceaa42047dd39ed731f03 GIT binary patch literal 1979 zcmV;s2SoUZP)hr}s;W?PY#LfiKT`mKOgiA& znx)_ge$DZ|LOC!@aS8&($kCy&?^t1u1;7B3^0+uw`US$2&$QUl6&j`mh8af4IH=Yv zZ&oaOozh=(ya-hPCjcXyXkdb8Xv~FN+!%0a!ejEs-(yF=Q))n9guoLT02zqbRH(Ab zItmGo8HXb7;0TU*M-uminF`5V$YoQ~+?({6=OC(CdSj(%l~UEQuVU#0G*%8NI05ku zO=ChzQD0)IJR<<9r18JYj1@f7IMQNX9Mo3m2`y)%AgEC;8GFY*EWQ4##D&cWb z?C4K=ObHBQlRhUJAvjRw$wGxy4yv)E9dJi=AT-Pm46_2mq-?;&4&uHlYburqsV5l1w(s-kv_LUUAXJ zH#>HJTXG>ctlzNlzUIltfjTa^;5_zq??tt~Yfhfp%-#3>iiaQkHLD-{1F^NtK5Y&^ zx&1C~xbAE0*}aQIGRZURUgDlRZ)0ayCylurMht~Q57Va4VC$Q2@a{Wrv!G=m_x$n! z5JSiA9+oa?yV0+gKtb!x8AY{Waey7$J9y-w2YB?6hlj`B-uf1QUi~-?=>`C*l?t!F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kv_LUUAXJ zH#>HJTXG>ctlzNlzUIltfjTa^;5_zq??tt~Yfhfp%-#3>iiaQkHLD-{1F^NtK5Y&^ zx&1C~xbAE0*}aQIGRZURUgDlRZ)0ayCylurMht~Q57Va4VC$Q2@a{Wrv!G=m_x$n! z5JSiA9+oa?yV0+gKtb!x8AY{Waey7$J9y-w2YB?6hlj`B-uf1QUi~-?=>`C*l?t!F zwwVnttYu$!H*@Bl&Vjx@cJ1ty6nc7Cdd|53jGr)(S6+OPMN8`6mMuS@36mxbuQPkjT*5Hqa~EE8Sa}Wu zxayi~0a(z|%JR>D0e~P30J!!W*Yl&5KO0KI(b~2YfY!DpYuaU&*=WUr=`< z2#BJn4geTapML7hSv2MIY*^Pm1W-TUmMuS@WGcmimR6eb`B4E5+dpo|fv;bGBiDcH zCICKse;WX6pL>R#T{{@EU>Kk@ILN|9ZLDj59uXNH7ZKt(CYef&Dn6T}(Ua1YA^M@zS#y92g+g(7?3mGXO{=68z#f53%8ex+ABbIiLAwwXnYZ zc?OC_X3w3=m@!Q}{r7cbvf1IqXU;l}Og2k4+sOFw6aJNTkYv}+E&#*`W5y=U_aFV^ z<3DU|Ya5mF(~g%nZsdx~E?wDMakqYaA27$KxLd$Wd9)fK9~#Cvs5&JQU?8I1!2uu{ z2q&uGs}dO@69{>Q!N^enO0lv>psB%Up@YFdIId!OqvqHRR21y~GT)(off*6r*aUY5 zhN)JG1H)KPNEahsv&z1Th{}s*n~T zoAR0M6p3|cK_LT-S8$nt3ypv;UDfv>vRndLZV>LX~Gn6FsT}!?l1xtL(Fm z11gj~ArUJbMo2dXoEtm#M#}y`80!gRl0Fj)6>h6ow$~gVlw$s7>do2DQ64Er1Q?2< zgFS&^a$uMd*MWM Date: Fri, 14 Dec 2018 10:13:51 +0100 Subject: [PATCH 09/69] Remove unnecessary clean html filter --- lib/docs/filters/pony/clean_html.rb | 9 --------- lib/docs/scrapers/pony.rb | 3 ++- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 lib/docs/filters/pony/clean_html.rb diff --git a/lib/docs/filters/pony/clean_html.rb b/lib/docs/filters/pony/clean_html.rb deleted file mode 100644 index 248c3de7..00000000 --- a/lib/docs/filters/pony/clean_html.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Docs - class Pony - class CleanHtmlFilter < Filter - def call - doc - end - end - end -end diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index 0201ed18..091c22fe 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -4,8 +4,9 @@ module Docs self.release = '0.25.0' self.base_url = 'https://stdlib.ponylang.io/' - html_filters.push 'pony/container', 'pony/clean_html', 'pony/entries' + html_filters.push 'pony/container', 'pony/entries' options[:attribution] = "Me" + options[:trailing_slash] = false options[:skip_patterns] = [/src/] end From d27c1c47a256099814310bed5672796928dc5d67 Mon Sep 17 00:00:00 2001 From: Harm Aarts Date: Fri, 14 Dec 2018 10:14:10 +0100 Subject: [PATCH 10/69] Fix attribution --- lib/docs/scrapers/pony.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index 091c22fe..702bc1ef 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -5,7 +5,10 @@ module Docs self.base_url = 'https://stdlib.ponylang.io/' html_filters.push 'pony/container', 'pony/entries' - options[:attribution] = "Me" + + options[:attribution] = <<-HTML + © 2018 Pony Developers + HTML options[:trailing_slash] = false options[:skip_patterns] = [/src/] From 5da021471720c5c02fe30762a178d6148acb84e7 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 15 Dec 2018 17:41:49 +0000 Subject: [PATCH 11/69] Add RxJS The current RxJS documentation site is https://rxjs.dev/. It is very similar to Angular documentation site (https://angular.io/) so I reused most code. Images on the documentation site seem to be broken and so the scrapper cannot download them. You can see an example of a broken image at https://rxjs.dev/api/operators/buffer. Related to https://github.com/freeCodeCamp/devdocs/issues/939 --- assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_rxjs.scss | 24 ++++++ lib/docs/filters/rxjs/clean_html.rb | 101 ++++++++++++++++++++++++ lib/docs/filters/rxjs/entries.rb | 23 ++++++ lib/docs/scrapers/rxjs.rb | 94 ++++++++++++++++++++++ public/icons/docs/rxjs/16.png | Bin 0 -> 5356 bytes public/icons/docs/rxjs/16@2x.png | Bin 0 -> 5084 bytes public/icons/docs/rxjs/SOURCE | 1 + 8 files changed, 244 insertions(+) create mode 100644 assets/stylesheets/pages/_rxjs.scss create mode 100644 lib/docs/filters/rxjs/clean_html.rb create mode 100644 lib/docs/filters/rxjs/entries.rb create mode 100644 lib/docs/scrapers/rxjs.rb create mode 100644 public/icons/docs/rxjs/16.png create mode 100644 public/icons/docs/rxjs/16@2x.png create mode 100644 public/icons/docs/rxjs/SOURCE diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index fd6ffffd..bcd8a7f2 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -94,6 +94,7 @@ 'pages/rfc', 'pages/rubydoc', 'pages/rust', + 'pages/rxjs', 'pages/sinon', 'pages/socketio', 'pages/sphinx', diff --git a/assets/stylesheets/pages/_rxjs.scss b/assets/stylesheets/pages/_rxjs.scss new file mode 100644 index 00000000..15e1252b --- /dev/null +++ b/assets/stylesheets/pages/_rxjs.scss @@ -0,0 +1,24 @@ +._rxjs { + @extend %simple; + + .pre-title { @extend %pre-heading; } + + .breadcrumbs { @extend %note; } + .banner { @extend %note-green; } + code.stable { @extend %label-green; } + code.experimental { @extend %label-orange; } + code.deprecated { @extend %label-red; } + .alert.is-important { @extend %note-red; } + .alert.is-helpful, .breadcrumbs { @extend %note-blue; } + + .breadcrumbs { padding-left: 2em; } + + img { margin: 1em 0; } + + .location-badge { + font-style: italic; + text-align: right; + } + + td h3 { margin: 0 !important; } +} diff --git a/lib/docs/filters/rxjs/clean_html.rb b/lib/docs/filters/rxjs/clean_html.rb new file mode 100644 index 00000000..1056b1a6 --- /dev/null +++ b/lib/docs/filters/rxjs/clean_html.rb @@ -0,0 +1,101 @@ +module Docs + class Rxjs + class CleanHtmlFilter < Filter + def call + if root_page? + css('.card-container').remove + at_css('h1').content = 'RxJS Documentation' + end + + css('br', 'hr', '.material-icons', '.header-link', '.breadcrumb').remove + + css('.content', 'article', '.api-header', 'section', '.instance-member').each do |node| + node.before(node.children).remove + end + + css('label', 'h2 > em', 'h3 > em').each do |node| + node.name = 'code' + end + + css('h1 + code').each do |node| + node.before('

') + while node.next_element.name == 'code' + node.previous_element << ' ' + node.previous_element << node.next_element + end + node.previous_element.prepend_child(node) + end + + css('td h3', '.l-sub-section > h3', '.alert h3', '.row-margin > h3', '.api-heading ~ h3', '.api-heading + h2', '.metadata-member h3').each do |node| + node.name = 'h4' + end + + css('.l-sub-section', '.alert', '.banner').each do |node| + node.name = 'blockquote' + end + + css('.file').each do |node| + node.content = node.content.strip + end + + css('.filetree .children').each do |node| + node.css('.file').each do |n| + n.content = " #{n.content}" + end + end + + css('.filetree').each do |node| + node.content = node.css('.file').map(&:inner_html).join("\n") + node.name = 'pre' + node.remove_attribute('class') + end + + css('pre').each do |node| + node.content = node.content.strip + + node['data-language'] = 'typescript' if node['path'].try(:ends_with?, '.ts') + node['data-language'] = 'html' if node['path'].try(:ends_with?, '.html') + node['data-language'] = 'css' if node['path'].try(:ends_with?, '.css') + node['data-language'] = 'js' if node['path'].try(:ends_with?, '.js') + node['data-language'] = 'json' if node['path'].try(:ends_with?, '.json') + node['data-language'] = node['language'].sub(/\Ats/, 'typescript').strip if node['language'] + node['data-language'] ||= 'typescript' if node.content.start_with?('@') + + node.before(%(
#{node['title']}
)) if node['title'] + + if node['class'] && node['class'].include?('api-heading') + node.name = 'h3' + node.inner_html = "#{node.inner_html}" + end + + node.remove_attribute('path') + node.remove_attribute('region') + node.remove_attribute('linenums') + node.remove_attribute('title') + node.remove_attribute('language') + node.remove_attribute('hidecopy') + node.remove_attribute('class') + end + + css('h1[class]').remove_attr('class') + css('table[class]').remove_attr('class') + css('table[width]').remove_attr('width') + css('tr[style]').remove_attr('style') + + if at_css('.api-type-label.module') + at_css('h1').content = subpath.remove('api/') + end + + css('th h3').each do |node| + node.name = 'span' + end + + css('code code').each do |node| + node.before(node.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/rxjs/entries.rb b/lib/docs/filters/rxjs/entries.rb new file mode 100644 index 00000000..020ce1eb --- /dev/null +++ b/lib/docs/filters/rxjs/entries.rb @@ -0,0 +1,23 @@ +module Docs + class Rxjs + class EntriesFilter < Docs::EntriesFilter + def get_name + name = at_css('h1').content + name.prepend "#{$1}. " if subpath =~ /\-pt(\d+)/ + name + end + + def get_type + if slug.start_with?('guide') + 'Guide' + elsif at_css('.api-type-label.module') + name.split('/').first + elsif slug.start_with?('api/') + slug.split('/').second + else + 'Miscellaneous' + end + end + end + end +end diff --git a/lib/docs/scrapers/rxjs.rb b/lib/docs/scrapers/rxjs.rb new file mode 100644 index 00000000..1825fc80 --- /dev/null +++ b/lib/docs/scrapers/rxjs.rb @@ -0,0 +1,94 @@ +require 'yajl/json_gem' + +module Docs + class Rxjs < UrlScraper + self.name = 'RxJS' + self.type = 'rxjs' + self.links = { + home: 'https://rxjs.dev/', + code: 'https://github.com/ReactiveX/rxjs' + } + + options[:max_image_size] = 256_000 + + options[:attribution] = <<-HTML + © 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
+ Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0. + HTML + + module Common + private + + def initial_urls + initial_urls = [] + + Request.run "#{self.class.base_url}generated/navigation.json" do |response| + data = JSON.parse(response.body) + dig = ->(entry) do + initial_urls << url_for("generated/docs/#{entry['url']}.json") if entry['url'] && entry['url'] != 'api' + entry['children'].each(&dig) if entry['children'] + end + data['SideNav'].each(&dig) + end + + Request.run "#{self.class.base_url}generated/docs/api/api-list.json" do |response| + data = JSON.parse(response.body) + dig = ->(entry) do + initial_urls << url_for("generated/docs/#{entry['path']}.json") if entry['path'] + initial_urls << url_for("generated/docs/api/#{entry['name']}.json") if entry['name'] && !entry['path'] + entry['items'].each(&dig) if entry['items'] + end + data.each(&dig) + end + + initial_urls + end + + def handle_response(response) + if response.mime_type.include?('json') + begin + response.options[:response_body] = JSON.parse(response.body)['contents'] + rescue JSON::ParserError + response.options[:response_body] = '' + end + response.headers['Content-Type'] = 'text/html' + response.url.path = response.url.path.sub('/generated/docs/', '/').remove('.json') + response.effective_url.path = response.effective_url.path.sub('/generated/docs/', '/').remove('.json') + end + super + end + end + + version do + self.release = '6.3.3' + self.base_url = 'https://rxjs.dev/' + self.root_path = 'guide/overview' + + html_filters.push 'rxjs/clean_html', 'rxjs/entries' + + options[:follow_links] = false + options[:only_patterns] = [/\Aguide/, /\Aapi/] + options[:fix_urls_before_parse] = ->(url) do + url.sub! %r{\Aguide/}, '/guide/' + url.sub! %r{\Aapi/}, '/api/' + url.sub! %r{\Agenerated/}, '/generated/' + url + end + + include Docs::Rxjs::Common + end + + private + + def parse(response) + response.body.gsub! '', 'live example' + response.body.gsub! ' zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvk}M|-{O1%t0w5OYIII!AfsgM5MAb~cd5*Bd zT{Be_%_3z=DcX#`{+#9yd_4JJLd={bC5umxAiki%_I%FM*|6{WVsGPHzj?m!=psDn zyr!Y!3;N?bAqVZR-}_B&x(@3?cV%6W*3KRc9ml#5`P1+8-H6UB;fp)^-^O0TI$iYh zJ!F8^4FltlgczeKCj4_Uq>hc5`-~a~$tVNI)tXb?UmZTNqdYCGBYmSH^!tJMT+y zF#n%z#(p-}U}EsYXFR=co^~Ho_Tt+nC9KO$pGl}2Fyg6! zHSj_HvBm9uW$)J>se^d6}rw@ez1aFegz=RSj??EMu8AF z71Ox!-Iw_iH}(s$1P0@Vnc-lu^(;}Ndt-|>&xCQ&24hcZxZHICK!m*`jBx}8Y(jXu zQ(!ZykP3JDX3^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literal 0 HcmV?d00001 diff --git a/public/icons/docs/rxjs/16@2x.png b/public/icons/docs/rxjs/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a45cd5cb84184a412b136a825e6303f6d4fbcd0b GIT binary patch literal 5084 zcmV<26C>=2P)X+uL$Nkc;*P;zf(X>4Tx07wm;mUmQB*%pV-y*Itk5+Wca^cs2zAksTX z6$DXM^`x7XQc?|s+008spb1j2M!0f022SQPH-!CVp(%f$Br7!UytSOLJ{W@ZFO z_(THK{JlMynW#v{v-a*TfMmPdEWc1DbJqWVks>!kBnAKqMb$PuekK>?0+ds;#ThdH z1j_W4DKdsJG8Ul;qO2n0#IJ1jr{*iW$(WZWsE0n`c;fQ!l&-AnmjxZO1uWyz`0VP>&nP`#i ztsL#`S=Q!g`M=rU9)45(J;-|dRq-b5&z?byo>|{)?5r=n76A4nTALlSzLiw~v~31J z<>9PP?;rs31pu_(obw)rY+jPY;tVGXi|p)da{-@gE-UCa`=5eu%D;v=_nFJ?`&K)q z7e9d`Nfk3?MdhZarb|T3%nS~f&t(1g5dY)AIcd$w!z`Siz!&j_=v7hZlnI21XuE|x zfmo0(WD10T)!}~_HYW!eew}L+XmwuzeT6wtxJd`dZ#@7*BLgIEKY9Xv>st^p3dp{^ zXswa2bB{85{^$B13tWnB;Y>jyQ|9&zk7RNsqAVGs--K+z0uqo1bf5|}fi5rtEMN^B zfHQCd-XH*kfJhJnmIE$G0%<@5vOzxB0181d*a3EfYH$G5fqKvcPJ%XY23!PJzzuK< z41h;K3WmW;Fah3yX$XSw5EY_9s*o0>51B&N5F1(uc|$=^I1~fLLy3?Ol0f;;Ca4%H zgQ}rJP(Ab`bQ-z{U4#0d2hboi2K@njgb|nm(_szR0JebHusa+GN5aeCM0gdP2N%HG z;Yzp`J`T6S7vUT504#-H!jlL<$Or?`Mpy_N@kBz9SR?@vA#0H$qyni$nvf2p8@Y{0 zk#Xb$28W?xm>3qu8RLgpjNxKdVb)?wFx8l2m{v>|<~C*!GlBVnrD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c@4hxqDcD((ZA76)LeLo5Tz1_~ux6{Md zc=#NAUDnQ}QWx<34SCqB7|J+3r`94)2IW5P_1OpP!*6MgI2XWKAd0evg~II?ByOtq zN6YgC*emo*>SK_SWKpQNJom*|uK4SSz6M7*f0&4m6HuItUB|FZD8P7ZYTh791C0CU z?zc-{55q>?oev-cv5Uf*MTfdH8CKExC8U)0xGj4-Jy2TNsNgU*8W+QNtgv*53@NlM zlZyt!d!GOqjz8rg_qE!^Z`X{6rbaC9HBE%8)=#5Gzd;0ZStDtPX1O&zW0t^h@bp7u z92BdvDLulE)c*h&&kU)? Date: Tue, 18 Dec 2018 16:37:30 -0500 Subject: [PATCH 12/69] Add license info --- lib/docs/scrapers/pony.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index 702bc1ef..5f1bbc04 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -7,7 +7,9 @@ module Docs html_filters.push 'pony/container', 'pony/entries' options[:attribution] = <<-HTML - © 2018 Pony Developers + © 2016-2018, The Pony Developers
+ © 2014-2015, Causality Ltd.
+ Licensed under the BSD 2-Clause License HTML options[:trailing_slash] = false From cda737ceec8992a1af0307b7f80278a1d6af7125 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Fri, 26 Apr 2019 20:04:13 +1000 Subject: [PATCH 13/69] basic scrapping working --- .gitignore | 1 + lib/docs/filters/trio/clean_html.rb | 21 +++++++++ lib/docs/filters/trio/entries.rb | 21 +++++++++ lib/docs/scrapers/trio.rb | 24 ++++++++++ public/docs/docs.json | 70 ++++++++++++++++++++++++++++- 5 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 lib/docs/filters/trio/clean_html.rb create mode 100644 lib/docs/filters/trio/entries.rb create mode 100644 lib/docs/scrapers/trio.rb diff --git a/.gitignore b/.gitignore index 1060fcf0..27f04dd4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ public/fonts public/docs/**/* docs/**/* !docs/*.md +vendor diff --git a/lib/docs/filters/trio/clean_html.rb b/lib/docs/filters/trio/clean_html.rb new file mode 100644 index 00000000..5c2ef228 --- /dev/null +++ b/lib/docs/filters/trio/clean_html.rb @@ -0,0 +1,21 @@ +module Docs + class Trio + class CleanHtmlFilter < Filter + def call + @doc = at_css('div[role="main"]') + css('.section, [itemprop=articleBody]').each do |node| + node.replace node.children + end + + css('.headerlink').remove + + css('dt').each do |node| + new_node = doc.document.create_element "h3" + new_node.content = node.inner_text[0...-1] + node.replace new_node + end + doc + end + end + end +end diff --git a/lib/docs/filters/trio/entries.rb b/lib/docs/filters/trio/entries.rb new file mode 100644 index 00000000..64387d6e --- /dev/null +++ b/lib/docs/filters/trio/entries.rb @@ -0,0 +1,21 @@ +module Docs + class Trio + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').text[0...-1] + end + + def get_type + at_css('h1').text[0...-1] + end + + def additional_entries + css('.descname').each_with_object [] do |node, entries| + name = node.previous.text + node.text + id = node.parent['id'] + entries << [name, id] + end + end + end + end +end diff --git a/lib/docs/scrapers/trio.rb b/lib/docs/scrapers/trio.rb new file mode 100644 index 00000000..cf90f77d --- /dev/null +++ b/lib/docs/scrapers/trio.rb @@ -0,0 +1,24 @@ +module Docs + class Trio < UrlScraper + self.type = 'simple' + self.release = '0.11' + self.base_url = 'https://trio.readthedocs.io/en/latest/' + self.root_path = 'index.html' + self.links = { + home: 'https://trio.readthedocs.io/', + code: 'https://github.com/python-trio/trio' + } + + html_filters.push 'trio/entries', 'trio/clean_html' + + options[:attribution] = <<-HTML + HTML + options[:only_patterns] = [ + /reference-core/, + /reference-io/, + /reference-testing/, + /reference-hazmat/, + ] + + end +end diff --git a/public/docs/docs.json b/public/docs/docs.json index 0637a088..eff8727c 100644 --- a/public/docs/docs.json +++ b/public/docs/docs.json @@ -1 +1,69 @@ -[] \ No newline at end of file +[ + { + "name": "Chef", + "slug": "chef~12", + "type": "sphinx_simple", + "links": { + "home": "https://www.chef.io/", + "code": "https://github.com/chef/chef" + }, + "version": "12", + "release": "12.13", + "mtime": 1556264506, + "db_size": 7170006 + }, + { + "name": "CSS", + "slug": "css", + "type": "mdn", + "mtime": 1543099045, + "db_size": 12415944 + }, + { + "name": "DOM", + "slug": "dom", + "type": "mdn", + "mtime": 1543157862, + "db_size": 33998524 + }, + { + "name": "DOM Events", + "slug": "dom_events", + "type": "mdn", + "mtime": 1543099589, + "db_size": 1752500 + }, + { + "name": "HTML", + "slug": "html", + "type": "mdn", + "mtime": 1543097764, + "db_size": 4141596 + }, + { + "name": "HTTP", + "slug": "http", + "type": "mdn", + "mtime": 1543099392, + "db_size": 4731727 + }, + { + "name": "JavaScript", + "slug": "javascript", + "type": "mdn", + "mtime": 1543098529, + "db_size": 6462141 + }, + { + "name": "Trio", + "slug": "trio", + "type": "simple", + "links": { + "home": "https://trio.readthedocs.io/", + "code": "https://github.com/python-trio/trio" + }, + "release": "0.11", + "mtime": 1556272773, + "db_size": 736670 + } +] \ No newline at end of file From 09e47c49f1c9c3b67d2a93c90a8c7ef28208e319 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Fri, 26 Apr 2019 20:43:31 +1000 Subject: [PATCH 14/69] improve titles and pre --- Gemfile | 2 +- lib/docs/filters/trio/clean_html.rb | 18 ++++++++++++++++-- lib/docs/filters/trio/entries.rb | 23 ++++++++++++++++++++++- public/docs/docs.json | 4 ++-- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 31b57064..da6e8ba0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '2.6.0' +ruby '2.6.2' gem 'rake' gem 'thor' diff --git a/lib/docs/filters/trio/clean_html.rb b/lib/docs/filters/trio/clean_html.rb index 5c2ef228..3d3517c2 100644 --- a/lib/docs/filters/trio/clean_html.rb +++ b/lib/docs/filters/trio/clean_html.rb @@ -10,10 +10,24 @@ module Docs css('.headerlink').remove css('dt').each do |node| - new_node = doc.document.create_element "h3" - new_node.content = node.inner_text[0...-1] + if node.parent.classes.include? 'class' + new_node = doc.document.create_element 'h2' + else + new_node = doc.document.create_element "h3" + end + new_node['id'] = node['id'] + new_node.content = node.inner_text node.replace new_node end + + css('pre').each do |node| + classes = node.parent.parent.classes + if classes.include? 'highlight-python3' + node['class'] = 'language-python' + node['data-language'] = 'python' + end + node.parent.parent.replace(node) + end doc end end diff --git a/lib/docs/filters/trio/entries.rb b/lib/docs/filters/trio/entries.rb index 64387d6e..7bd7e124 100644 --- a/lib/docs/filters/trio/entries.rb +++ b/lib/docs/filters/trio/entries.rb @@ -11,7 +11,28 @@ module Docs def additional_entries css('.descname').each_with_object [] do |node, entries| - name = node.previous.text + node.text + + name = node.text + if node.previous.classes.include? 'descclassname' + name = node.previous.text + name + end + name.strip! + + dl = node.parent.parent + + if dl.classes.include?('attribute') or dl.classes.include?('method') + parent = dl.parent.previous_element + cls = '' + if n = parent.at_css('.descname') + if n.text == "The nursery interface" + cls += "Nursery." + else + cls += n.text + '.' + end + end + name = cls + name + end + id = node.parent['id'] entries << [name, id] end diff --git a/public/docs/docs.json b/public/docs/docs.json index eff8727c..ce43dbf3 100644 --- a/public/docs/docs.json +++ b/public/docs/docs.json @@ -63,7 +63,7 @@ "code": "https://github.com/python-trio/trio" }, "release": "0.11", - "mtime": 1556272773, - "db_size": 736670 + "mtime": 1556275385, + "db_size": 746040 } ] \ No newline at end of file From 94b50f3cc303c2c3d1da72bd4c13e875f1347783 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Fri, 26 Apr 2019 21:56:05 +1000 Subject: [PATCH 15/69] improve entries and display of parameters --- lib/docs/filters/trio/clean_html.rb | 31 +++++++++++++++++++++++------ lib/docs/filters/trio/entries.rb | 7 ++++++- public/docs/docs.json | 4 ++-- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lib/docs/filters/trio/clean_html.rb b/lib/docs/filters/trio/clean_html.rb index 3d3517c2..17542601 100644 --- a/lib/docs/filters/trio/clean_html.rb +++ b/lib/docs/filters/trio/clean_html.rb @@ -10,14 +10,24 @@ module Docs css('.headerlink').remove css('dt').each do |node| - if node.parent.classes.include? 'class' - new_node = doc.document.create_element 'h2' + node.name = 'h3' + if node.parent.classes.include? 'field-list' + node.name = 'h4' + node['style'] = 'margin: 0' + if node.text == 'Parameters' or node.text == 'Raises' + node.next_element.css('strong').each do |n| + n.name = 'code' + end + end else - new_node = doc.document.create_element "h3" + code = doc.document.create_element 'code' + if em = node.at_css('.property') + code.inner_html = "#{em.text.strip} " + em.remove + end + code.inner_html += node.inner_text.strip + node.inner_html = code end - new_node['id'] = node['id'] - new_node.content = node.inner_text - node.replace new_node end css('pre').each do |node| @@ -28,6 +38,15 @@ module Docs end node.parent.parent.replace(node) end + + css('.admonition').each do |node| + node.name = 'blockquote' + node.at_css('.admonition-title').name = 'h4' + # new_node = node.document.create_element 'blockquote' + # new_node.inner_html = node.inner_html + # node.replace new_node + end + doc end end diff --git a/lib/docs/filters/trio/entries.rb b/lib/docs/filters/trio/entries.rb index 7bd7e124..bb5207f0 100644 --- a/lib/docs/filters/trio/entries.rb +++ b/lib/docs/filters/trio/entries.rb @@ -20,9 +20,14 @@ module Docs dl = node.parent.parent - if dl.classes.include?('attribute') or dl.classes.include?('method') + if dl.classes.include?('attribute') \ + or dl.classes.include?('method') \ + or dl.classes.include?('data') parent = dl.parent.previous_element cls = '' + if n = parent.at_css('.descclassname') + cls += n.text + end if n = parent.at_css('.descname') if n.text == "The nursery interface" cls += "Nursery." diff --git a/public/docs/docs.json b/public/docs/docs.json index ce43dbf3..df09fc48 100644 --- a/public/docs/docs.json +++ b/public/docs/docs.json @@ -63,7 +63,7 @@ "code": "https://github.com/python-trio/trio" }, "release": "0.11", - "mtime": 1556275385, - "db_size": 746040 + "mtime": 1556279513, + "db_size": 757201 } ] \ No newline at end of file From 65c222011551e4fb0e35d8b966934c80e48255c8 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sat, 27 Apr 2019 10:56:43 +1000 Subject: [PATCH 16/69] clean up entries.rb --- lib/docs/filters/trio/entries.rb | 3 +-- public/docs/docs.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/docs/filters/trio/entries.rb b/lib/docs/filters/trio/entries.rb index bb5207f0..4ee6aab1 100644 --- a/lib/docs/filters/trio/entries.rb +++ b/lib/docs/filters/trio/entries.rb @@ -38,8 +38,7 @@ module Docs name = cls + name end - id = node.parent['id'] - entries << [name, id] + entries << [name, node.parent['id']] end end end diff --git a/public/docs/docs.json b/public/docs/docs.json index df09fc48..e27f82ee 100644 --- a/public/docs/docs.json +++ b/public/docs/docs.json @@ -63,7 +63,7 @@ "code": "https://github.com/python-trio/trio" }, "release": "0.11", - "mtime": 1556279513, + "mtime": 1556326478, "db_size": 757201 } ] \ No newline at end of file From 409f2c2332d73647ad7bb5f8ca6b19ea080267eb Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sun, 28 Apr 2019 08:05:52 +1000 Subject: [PATCH 17/69] add attributions for trio --- lib/docs/scrapers/trio.rb | 7 +++++-- public/docs/docs.json | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/docs/scrapers/trio.rb b/lib/docs/scrapers/trio.rb index cf90f77d..041d6564 100644 --- a/lib/docs/scrapers/trio.rb +++ b/lib/docs/scrapers/trio.rb @@ -11,8 +11,6 @@ module Docs html_filters.push 'trio/entries', 'trio/clean_html' - options[:attribution] = <<-HTML - HTML options[:only_patterns] = [ /reference-core/, /reference-io/, @@ -20,5 +18,10 @@ module Docs /reference-hazmat/, ] + options[:attribution] = <<-HTML + © 2017-2019 Nathaniel Smith
+ Licensed under MIT and Apache2. + HTML + end end diff --git a/public/docs/docs.json b/public/docs/docs.json index e27f82ee..039aa7c2 100644 --- a/public/docs/docs.json +++ b/public/docs/docs.json @@ -63,7 +63,7 @@ "code": "https://github.com/python-trio/trio" }, "release": "0.11", - "mtime": 1556326478, - "db_size": 757201 + "mtime": 1556402796, + "db_size": 757536 } ] \ No newline at end of file From 383459c8b4519fcb67a9cbaaf613e38436cfc418 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sun, 28 Apr 2019 09:10:01 +1000 Subject: [PATCH 18/69] add trio icons --- public/icons/docs/trio/16.png | Bin 0 -> 794 bytes public/icons/docs/trio/16@2.png | Bin 0 -> 1805 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/icons/docs/trio/16.png create mode 100644 public/icons/docs/trio/16@2.png diff --git a/public/icons/docs/trio/16.png b/public/icons/docs/trio/16.png new file mode 100644 index 0000000000000000000000000000000000000000..f1fbc1faa4bc52af5a5d8070453a3bc2a4422224 GIT binary patch literal 794 zcmV+#1LgdQP)Alu;1J|1;H~LE*5k%ilVn(qV0xJW=e^H5u^}CNJY@aLhG&2hrsUHrt5w)(}Qk>XajSe ze*Zah=FFe)pIBB|yN1{mv2%TnTubZ84NU;qzYL8gj_kS;ah~^>**RhcGs7`G2xQF0 zw$p`Q(;SahfS~hL)u{?pB~Voyk2NhBpV9kd#j)EH)0{V4xOmUCGb*wz5V=4m?_oBJ z3`ruiA9=WXwt{>KSt!lBf5p*#*Eg8i88h|GG^&A|19J|592lmn(0$Wj-J??_JtIGX zPz*De0Yk@*vFtB5l~z@Onid-PW%NMZ(vb@o<`0h8ej1?yz?Yw?M6UG*t3<3?MIa(! z3xbx#`)=d|0IxXKm=`;Et9#l0`b}oY9_pa(#o2A=VOFY&na?hkrJhge+Nvs@rUF$R zN2XN(;AQczHEVNU|ETZG-PtER%>aPxDFCEc+cSaCg7SEY_8_c~Fl=ZO)FuG{_h~4v z`Q5zi0dbSf%!e6Ns3X5TzS38B<=MII4~)2%lp<#KNmbseNUcID0DzMz)}F+Ksj3tn z9D|u!e}9;{uE8qV^DlXxpKzX6%`+6wN)XpTAQC`CI(1;6 zA5060sG1zVA<$|N6%a8K5&kBh^@3k|l|$HXu-St@DYw}3sxSy`A^rn{h(3czh$x$g z0dRrOY@n42@y$w$fX@eGy`j literal 0 HcmV?d00001 diff --git a/public/icons/docs/trio/16@2.png b/public/icons/docs/trio/16@2.png new file mode 100644 index 0000000000000000000000000000000000000000..afc8808184c47bde5366ae395d4e5a56bcff8056 GIT binary patch literal 1805 zcmV+o2lDudP)RFRt&*-pi=$xNRLuOt7M-{VSdg_Y{DUqT0R|Il z`DlC3`|OYV(O*mHfU%Q%?=SZ~=e*DJex2WYi2q@fMLQyX;OOnL;3h|&jyQI|S6}hP zrRd=0g3np;%DtppPjWIykOb-A$o+J9`KzNRn)WtV5B^^W6hF1OlyIFS1CmG)a7iKr zoI6P1hdb*kc8{gYT@C^B_6x}Z$sidZK@w!4ueX~e`^&u5uRnCf2>_U)B&dWWk+AFs zQ}_J4`R=y#j9_3x*_v%nTu}modPV|D>XXcpWTsqw2LQPM{s!<%K&5NmU!=@PZ1Aj4&m{%H z-3*{}r2b$m@Umz}M15!f4B-JuS&(u8TVO&SfIk47pIn>B=6nD-fEpnFYrukA0h|S} zF36bpo6kF2?UFpu-*3x4I&R`WXLL1GmjSFvES#0xvbVYV__=Fx7s+f#%KGqO z1-sQ-X3Kd5N~7CvoVR*gPw6vTKPp|dr8uEDf5_PhPY{ir(P#_+_HA7D0-&7$ZwxE! zj#dt&r}chMvQI}#PRJ@so_clOFanVneqL?z!!U)tB;3)4!l@> z0KkTk1ZFO4N|SWYu$Pk!k%8=*+O2sW{-!PEzt1|=pN0F{mqNk>027cf91vjY z83|PQSVMU_BRw-7YkW??G(rNH<)NvN^5f?tLAbaR4FCZTew-rU)6>4;&1W_4E5*rk znUX+=lORhar~rWcEM#GU4{Vdbf>uD$nbv=!Mnx;SAd?#TGAy)`!ykzMF z4+-ud6?<#;@b95ASWh8}y(1K)V1;BJgI{#^vQB z!xA2M{B+YTW~d-|7m06z_&UKaMYQBj!0OKEkIzLcz%luhqm#}nNVzZW0`GGDe(Tkn z04Bx7+&&uU%wOdf8-# z&>`Wo*eRtE%sGZ-$^9oB0PI}* zz;3~!A?#2Ip~aDtL!09Le;6o5C=L*xqj%1|OS(_!m`{f19O!s7E&JL%sapSV?f2^l zs{-_ogy<}!hLh@h9CX>_`9N`xoG0@n+dx-GxLjkqYGlAUQCLgd}aLg zN77HXw^w=qxZ`InWdu5saZM#+@)?io0La(GV6CIoL9ED58$9C`qz_so5~>0K{L=^N z-S;CJwTr$P71gxX5UdA~$>B+L0N}P5BF(#>t2{ENc1wu^KMb7ucT~QVarE>!JpA^O z5V(8wM4DgP9jzPyE}|_@j*r(pw617XYikg5vmiG~(qW1{yPjV%>@pgmD-Z#ZY5R^% ziXA_bBRZD`@i4%Z@7Leo1~8Rimwh?C(3rbw>r{~YNk%{oWCYsPZ^27BC$qM{v;Lm` vk?XHG0RULA=Jn~4zX}oU>5NwPjkWeaRYIemAL3r700000NkvXXu0mjf?}1uy literal 0 HcmV?d00001 From 46f7a32522fc2d0c4ebf3a63fef106841abf453b Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sun, 28 Apr 2019 09:16:14 +1000 Subject: [PATCH 19/69] add trio SOURCE icon --- public/icons/docs/trio/SOURCE | 1 + 1 file changed, 1 insertion(+) create mode 100644 public/icons/docs/trio/SOURCE diff --git a/public/icons/docs/trio/SOURCE b/public/icons/docs/trio/SOURCE new file mode 100644 index 00000000..52a2abea --- /dev/null +++ b/public/icons/docs/trio/SOURCE @@ -0,0 +1 @@ +https://github.com/python-trio/trio/blob/37de153f858e29df3a19db9fffcd0fb3f2308951/logo/logo-transparent-no-text.svg From 32a83f3e447648cbe84cc9fb074ef39a9edb226b Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sun, 28 Apr 2019 09:26:23 +1000 Subject: [PATCH 20/69] fix attribution --- lib/docs/scrapers/trio.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/trio.rb b/lib/docs/scrapers/trio.rb index 041d6564..8eb7cd26 100644 --- a/lib/docs/scrapers/trio.rb +++ b/lib/docs/scrapers/trio.rb @@ -19,7 +19,7 @@ module Docs ] options[:attribution] = <<-HTML - © 2017-2019 Nathaniel Smith
+ © 2017-2019 Nathaniel J. Smith
Licensed under MIT and Apache2. HTML From 737369cf09592e94a850bfc13b44a4810f7a3d16 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sun, 28 Apr 2019 16:46:10 +1000 Subject: [PATCH 21/69] fix gemfile i changed it manually earlier because I have 2.6.2 install on my machine --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index da6e8ba0..31b57064 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '2.6.2' +ruby '2.6.0' gem 'rake' gem 'thor' From b45090f369bc8fa7681237eca0def4c730f5f5a2 Mon Sep 17 00:00:00 2001 From: Emil Maruszczak Date: Mon, 29 Apr 2019 00:57:50 +0200 Subject: [PATCH 22/69] Add Mkdocs abstract scraper --- assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_mkdocs.scss | 15 +++++++++++++++ lib/docs/filters/mkdocs/clean_html.rb | 18 ++++++++++++++++++ lib/docs/scrapers/mkdocs.rb | 5 +++++ 4 files changed, 39 insertions(+) create mode 100644 assets/stylesheets/pages/_mkdocs.scss create mode 100644 lib/docs/filters/mkdocs/clean_html.rb create mode 100644 lib/docs/scrapers/mkdocs.rb diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 2a64e5c9..d2005cb2 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -71,6 +71,7 @@ 'pages/lua', 'pages/mdn', 'pages/meteor', + 'pages/mkdocs', 'pages/modernizr', 'pages/moment', 'pages/nginx', diff --git a/assets/stylesheets/pages/_mkdocs.scss b/assets/stylesheets/pages/_mkdocs.scss new file mode 100644 index 00000000..e70ff66c --- /dev/null +++ b/assets/stylesheets/pages/_mkdocs.scss @@ -0,0 +1,15 @@ +%mkdocs { + h2 { @extend %block-heading; } + h3 { @extend %block-label, %label-blue; } + h4 { @extend %block-label; } + + blockquote { @extend %note; } + + strong { font-weight: var(--bolderFontWeight); } + + p > code, li > code { @extend %label; } +} + +._mkdocs { + @extend %mkdocs; +} diff --git a/lib/docs/filters/mkdocs/clean_html.rb b/lib/docs/filters/mkdocs/clean_html.rb new file mode 100644 index 00000000..c346d23e --- /dev/null +++ b/lib/docs/filters/mkdocs/clean_html.rb @@ -0,0 +1,18 @@ +module Docs + class Mkdocs + class CleanHtmlFilter < Docs::Filter + def call + css('.toclink').each do |node| + node.parent.content = node.content + node.remove + end + + css('pre').each do |node| + node.content = node.at_css('code').content + end + + at_css('#main-content') + end + end + end +end diff --git a/lib/docs/scrapers/mkdocs.rb b/lib/docs/scrapers/mkdocs.rb new file mode 100644 index 00000000..c0f5d5e5 --- /dev/null +++ b/lib/docs/scrapers/mkdocs.rb @@ -0,0 +1,5 @@ +module Docs + class Mkdocs < Scraper + self.abstract = true + end +end From 14623be6285120a78c9d4f33cd831e48600efa6f Mon Sep 17 00:00:00 2001 From: Emil Maruszczak Date: Mon, 29 Apr 2019 01:02:25 +0200 Subject: [PATCH 23/69] Add Django Rest Framework scrapper --- lib/docs/filters/rest_framework/clean_html.rb | 36 +++++++++++ lib/docs/filters/rest_framework/entries.rb | 60 ++++++++++++++++++ lib/docs/scrapers/rest_framework.rb | 37 +++++++++++ public/icons/docs/rest_framework/16.png | Bin 0 -> 1166 bytes public/icons/docs/rest_framework/16@2x.png | Bin 0 -> 4254 bytes public/icons/docs/rest_framework/SOURCE | 1 + 6 files changed, 134 insertions(+) create mode 100644 lib/docs/filters/rest_framework/clean_html.rb create mode 100644 lib/docs/filters/rest_framework/entries.rb create mode 100644 lib/docs/scrapers/rest_framework.rb create mode 100644 public/icons/docs/rest_framework/16.png create mode 100644 public/icons/docs/rest_framework/16@2x.png create mode 100644 public/icons/docs/rest_framework/SOURCE diff --git a/lib/docs/filters/rest_framework/clean_html.rb b/lib/docs/filters/rest_framework/clean_html.rb new file mode 100644 index 00000000..007b33b2 --- /dev/null +++ b/lib/docs/filters/rest_framework/clean_html.rb @@ -0,0 +1,36 @@ +module Docs + class RestFramework + class CleanHtmlFilter < Docs::Filter + def call + css('hr').remove + + css('.badges').each do |node| + node.remove + end + + css('pre').each do |node| + node['data-language'] = 'python' + end + + css('h1').each do |node| + node['style'] = nil + end + + # Translate source files links to DevDocs links + links = Nokogiri::XML::Node.new('p', doc) + links['class'] = '_links' + + css('a.github').each do |node| + span = node.at_css('span') + node.content = span.content + span.remove + node['class'] = '_links-link' + links.add_child(node) + end + doc.add_child(links) + + doc + end + end + end +end diff --git a/lib/docs/filters/rest_framework/entries.rb b/lib/docs/filters/rest_framework/entries.rb new file mode 100644 index 00000000..53b2fce0 --- /dev/null +++ b/lib/docs/filters/rest_framework/entries.rb @@ -0,0 +1,60 @@ +module Docs + class RestFramework + class EntriesFilter < Docs::EntriesFilter + + def get_name + name = css('h1').first.content + name.slice! 'Tutorial ' + name = '0: ' + name if name.include? 'Quickstart' + name + end + + def get_type + case subpath + when /\Atutorial/ + 'Tutorial' + when /\Aapi-guide/ + 'API Guide' + end + end + + def additional_entries + return [] if type == nil || type == 'Tutorial' + + # Framework classes are provided in two different ways: + # - as H2's after H1 category titled: + accepted_headers = ['API Reference', 'API Guide'] + # - as headers (1 or 2) with these endings: + endings = ['Validator', 'Field', 'View', 'Mixin', 'Default', 'Serializer'] + + # To avoid writing down all the endings + # and to ensure all entries in API categories are matched + # two different ways of finding them are used + + entries = [] + + local_type = 'Ref: ' + name + in_category = false + + css('h1, h2').each do |node| + # Third party category contains entries that could be matched (and shouldn't be) + break if node.content === 'Third party packages' + + if in_category + if node.name === 'h1' + in_category = false + next + end + entries << [node.content, node['id'], local_type] + elsif accepted_headers.include? node.content + in_category = true + elsif endings.any? { |word| node.content.ends_with?(word) } + entries << [node.content, node['id'], local_type] + end + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/rest_framework.rb b/lib/docs/scrapers/rest_framework.rb new file mode 100644 index 00000000..fa64b080 --- /dev/null +++ b/lib/docs/scrapers/rest_framework.rb @@ -0,0 +1,37 @@ +module Docs + class RestFramework < UrlScraper + self.name = 'Django REST Framework' + self.release = '3.9.2' + self.slug = 'rest_framework' + self.type = 'mkdocs' + self.base_url = 'https://www.django-rest-framework.org/' + self.root_path = 'index.html' + self.links = { + home: 'https://www.django-rest-framework.org/', + code: 'https://github.com/encode/django-rest-framework' + } + + html_filters.push 'mkdocs/clean_html', 'rest_framework/clean_html', 'rest_framework/entries' + + options[:skip_patterns] = [ + /\Atopics\//, + /\Acommunity\//, + ] + + options[:attribution] = <<-HTML + Copyright 2011–present Encode OSS Ltd
+ Licensed under the BSD License. + HTML + + private + + def handle_response(response) + # Some scrapped urls don't have ending slash + # which leads to page duplication + if !response.url.path.ends_with?('/') && !response.url.path.ends_with?('index.html') + response.url.path << '/' + end + super + end + end +end diff --git a/public/icons/docs/rest_framework/16.png b/public/icons/docs/rest_framework/16.png new file mode 100644 index 0000000000000000000000000000000000000000..e2e33539d613144de4e7e708cf760355cdc835e5 GIT binary patch literal 1166 zcmb7Du}T9$6nrN~Vj_W9s1OfC?8QpOCMXw@Q;Z^lhzQ0H5J3@ZJ6o;AfCM|i#zL@2 zYas~!fnsYRVj(2Xc(>>6?G`%W-R{o3H~Tir9xvCcg?uS5B88yluV5@PdNcTrymuQI zGTRGPU%LD??=DZly(#h$t>eKkh>FjVF^`}T!NMCvBW=<{H3jaRET&8&a?~`~ z4A{2XIhjmO9VzB*2A@znamMe295oF#gBCJgwXASKj+zFW0TXu+F9`0+;GCRcY}^8p z1UEtB5@LgE;HN9xfN?Zi2Vuz{zeWeq?n|gYL9h!#9qT&Xg{=b?vDiaUXKB literal 0 HcmV?d00001 diff --git a/public/icons/docs/rest_framework/16@2x.png b/public/icons/docs/rest_framework/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e4ea76baed6b8a7a5b5b2d4157d5294e4bf72b93 GIT binary patch literal 4254 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_nK45N51cYF`EvWH0gbb!C6dA|o!MdcMQDhk-#r+tbA{B!ZJsLE!#-po)P7jO19q zm;vZ*EFhMFfn@VY(tyiibhnV=5TYGGtmQDr5bFpgn1+F(i3$NyeGl^tF`+QvAu#HI z0S^J95+Nv2k(v;RNq``8hfWBP5(>on9%LrbQ2M6Q1&(!1 Date: Thu, 2 May 2019 17:23:56 +0200 Subject: [PATCH 24/69] Use Mkdocs as base for RestFramework --- lib/docs/scrapers/mkdocs.rb | 16 +++++++++++++++- lib/docs/scrapers/rest_framework.rb | 15 ++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/docs/scrapers/mkdocs.rb b/lib/docs/scrapers/mkdocs.rb index c0f5d5e5..20559863 100644 --- a/lib/docs/scrapers/mkdocs.rb +++ b/lib/docs/scrapers/mkdocs.rb @@ -1,5 +1,19 @@ module Docs - class Mkdocs < Scraper + class Mkdocs < UrlScraper self.abstract = true + self.type = 'mkdocs' + + html_filters.push 'mkdocs/clean_html' + + private + + def handle_response(response) + # Some scrapped urls don't have ending slash + # which leads to page duplication + if !response.url.path.ends_with?('/') && !response.url.path.ends_with?('index.html') + response.url.path << '/' + end + super + end end end diff --git a/lib/docs/scrapers/rest_framework.rb b/lib/docs/scrapers/rest_framework.rb index fa64b080..16e85449 100644 --- a/lib/docs/scrapers/rest_framework.rb +++ b/lib/docs/scrapers/rest_framework.rb @@ -1,5 +1,5 @@ module Docs - class RestFramework < UrlScraper + class RestFramework < Mkdocs self.name = 'Django REST Framework' self.release = '3.9.2' self.slug = 'rest_framework' @@ -11,7 +11,7 @@ module Docs code: 'https://github.com/encode/django-rest-framework' } - html_filters.push 'mkdocs/clean_html', 'rest_framework/clean_html', 'rest_framework/entries' + html_filters.push 'rest_framework/clean_html', 'rest_framework/entries' options[:skip_patterns] = [ /\Atopics\//, @@ -22,16 +22,5 @@ module Docs Copyright 2011–present Encode OSS Ltd
Licensed under the BSD License. HTML - - private - - def handle_response(response) - # Some scrapped urls don't have ending slash - # which leads to page duplication - if !response.url.path.ends_with?('/') && !response.url.path.ends_with?('index.html') - response.url.path << '/' - end - super - end end end From 6c12d53a465e47da1ab7e6325862eef4f7c666af Mon Sep 17 00:00:00 2001 From: Emil Maruszczak Date: Thu, 2 May 2019 17:25:34 +0200 Subject: [PATCH 25/69] Cleanup redundant bits --- assets/stylesheets/pages/_mkdocs.scss | 6 +----- lib/docs/filters/mkdocs/clean_html.rb | 1 - lib/docs/filters/rest_framework/clean_html.rb | 13 +++---------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/assets/stylesheets/pages/_mkdocs.scss b/assets/stylesheets/pages/_mkdocs.scss index e70ff66c..e374474c 100644 --- a/assets/stylesheets/pages/_mkdocs.scss +++ b/assets/stylesheets/pages/_mkdocs.scss @@ -1,4 +1,4 @@ -%mkdocs { +._mkdocs { h2 { @extend %block-heading; } h3 { @extend %block-label, %label-blue; } h4 { @extend %block-label; } @@ -9,7 +9,3 @@ p > code, li > code { @extend %label; } } - -._mkdocs { - @extend %mkdocs; -} diff --git a/lib/docs/filters/mkdocs/clean_html.rb b/lib/docs/filters/mkdocs/clean_html.rb index c346d23e..2eef9cdc 100644 --- a/lib/docs/filters/mkdocs/clean_html.rb +++ b/lib/docs/filters/mkdocs/clean_html.rb @@ -4,7 +4,6 @@ module Docs def call css('.toclink').each do |node| node.parent.content = node.content - node.remove end css('pre').each do |node| diff --git a/lib/docs/filters/rest_framework/clean_html.rb b/lib/docs/filters/rest_framework/clean_html.rb index 007b33b2..87d048b9 100644 --- a/lib/docs/filters/rest_framework/clean_html.rb +++ b/lib/docs/filters/rest_framework/clean_html.rb @@ -4,17 +4,11 @@ module Docs def call css('hr').remove - css('.badges').each do |node| - node.remove - end + css('.badges').remove - css('pre').each do |node| - node['data-language'] = 'python' - end + css('pre').attr('data-language', 'python') - css('h1').each do |node| - node['style'] = nil - end + css('h1').attr('style', nil) # Translate source files links to DevDocs links links = Nokogiri::XML::Node.new('p', doc) @@ -23,7 +17,6 @@ module Docs css('a.github').each do |node| span = node.at_css('span') node.content = span.content - span.remove node['class'] = '_links-link' links.add_child(node) end From cc87443c3d2738b8ec2d57784e4ec899a7473cc6 Mon Sep 17 00:00:00 2001 From: Emil Maruszczak Date: Tue, 14 May 2019 23:47:07 +0200 Subject: [PATCH 26/69] Remove duplicated type --- lib/docs/scrapers/rest_framework.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/docs/scrapers/rest_framework.rb b/lib/docs/scrapers/rest_framework.rb index 16e85449..d81c22ab 100644 --- a/lib/docs/scrapers/rest_framework.rb +++ b/lib/docs/scrapers/rest_framework.rb @@ -3,7 +3,6 @@ module Docs self.name = 'Django REST Framework' self.release = '3.9.2' self.slug = 'rest_framework' - self.type = 'mkdocs' self.base_url = 'https://www.django-rest-framework.org/' self.root_path = 'index.html' self.links = { From ad9e7a62692e07b43853e8c1d90a54230c171ca1 Mon Sep 17 00:00:00 2001 From: Phil Scherer Date: Thu, 8 Aug 2019 21:44:41 -0500 Subject: [PATCH 27/69] Add Octave Documentation --- assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_octave.scss | 9 +++++ lib/docs/filters/octave/clean_html.rb | 45 ++++++++++++++++++++++++ lib/docs/filters/octave/entries.rb | 20 +++++++++++ lib/docs/scrapers/octave.rb | 38 ++++++++++++++++++++ public/icons/docs/octave/16.png | Bin 0 -> 1310 bytes public/icons/docs/octave/16@2x.png | Bin 0 -> 1940 bytes public/icons/docs/octave/SOURCE | 1 + 8 files changed, 114 insertions(+) create mode 100644 assets/stylesheets/pages/_octave.scss create mode 100644 lib/docs/filters/octave/clean_html.rb create mode 100644 lib/docs/filters/octave/entries.rb create mode 100644 lib/docs/scrapers/octave.rb create mode 100644 public/icons/docs/octave/16.png create mode 100644 public/icons/docs/octave/16@2x.png create mode 100644 public/icons/docs/octave/SOURCE diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 85d1134f..7a09dd97 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -75,6 +75,7 @@ 'pages/nginx', 'pages/node', 'pages/npm', + 'pages/octave', 'pages/openjdk', 'pages/perl', 'pages/phalcon', diff --git a/assets/stylesheets/pages/_octave.scss b/assets/stylesheets/pages/_octave.scss new file mode 100644 index 00000000..1dfc3f8c --- /dev/null +++ b/assets/stylesheets/pages/_octave.scss @@ -0,0 +1,9 @@ +._octave { + @extend %simple; + + dl:not([compact]) > dt { @extend %block-label, %label-blue; } + + dl[compact] > dt { @extend %block-label; } + + .footnotes-heading { @extend %block-heading; } +} diff --git a/lib/docs/filters/octave/clean_html.rb b/lib/docs/filters/octave/clean_html.rb new file mode 100644 index 00000000..cae7ec1c --- /dev/null +++ b/lib/docs/filters/octave/clean_html.rb @@ -0,0 +1,45 @@ +module Docs + class Octave + class CleanHtmlFilter < Filter + def call + root_page? ? root : other + doc + end + + def root + @doc = at_css('.contents') + end + + def other + css('.header', 'hr').remove + + css('.footnote > h3').each do |node| + node.name = 'h5' + end + + at_css('h2, h3, h4').name = 'h1' + + css('.example').each do |node| + node.name = 'pre' + node['data-language'] = 'matlab' + node.content = node.content + end + + css('a[name] + dl').each do |node| + node['id'] = node.previous['name'] + end + + css('dt > a[name]', 'th > a[name]').each do |node| + node.parent['id'] = node['name'] + node.parent.content = node.parent.content.strip + end + + css('h5 > a').each do |node| + node.parent['id'] = node['name'] + node.parent.content = node.content + end + + end + end + end +end diff --git a/lib/docs/filters/octave/entries.rb b/lib/docs/filters/octave/entries.rb new file mode 100644 index 00000000..70b29df1 --- /dev/null +++ b/lib/docs/filters/octave/entries.rb @@ -0,0 +1,20 @@ +module Docs + class Octave + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + 'Manual' + end + + def additional_entries + css('dl:not([compact]) > dt').each_with_object [] do |node, entries| + name = node.content.gsub(/[A-z0-9\,… ]*\=/,'').strip + entries << [name, node['id'], 'Functions'] + end + end + end + end +end diff --git a/lib/docs/scrapers/octave.rb b/lib/docs/scrapers/octave.rb new file mode 100644 index 00000000..1b8e70c0 --- /dev/null +++ b/lib/docs/scrapers/octave.rb @@ -0,0 +1,38 @@ +module Docs + class Octave < UrlScraper + self.name = 'Octave' + self.type = 'octave' + self.release = '5.1.0' + self.base_url = 'https://octave.org/doc/interpreter/' + self.root_path = 'index.html' + self.links = { + home: 'http://www.octave.org/', + code: 'http://www.octave.org/hg/octave' + } + + html_filters.push 'octave/clean_html', 'octave/entries', 'title' + + options[:skip] = %w( + Copying.html + Preface.html + Acknowledgements.html + Citing-Octave-in-Publications.html + How-You-Can-Contribute-to-Octave.html + Distribution.html) + + options[:title] = false + options[:root_title] = 'GNU Octave' + + options[:attribution] = <<-HTML + © 1996–2018 John W. Eaton
+ Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
+Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
+Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
+ HTML + + def get_latest_version(opts) + doc = fetch_doc('https://octave.org/doc/interpreter/', opts) + doc.at_css('h1').content.scan(/([0-9.]+)/)[0][0] + end + end +end diff --git a/public/icons/docs/octave/16.png b/public/icons/docs/octave/16.png new file mode 100644 index 0000000000000000000000000000000000000000..bef5229f9dbf701d066cb7f642d7600307f8b190 GIT binary patch literal 1310 zcmb7CdsLEV7=MA#BD|yy)5@qVwF`!LTg;i39;AdJkVnc3re@BxQnJ*RWS4Wyl}=}A zsB^0vWjQ;wnKwj%@)8(c$WYO8c5J8V$}%yFJ)ZvBpZm`9J@4~=&*l65e(#&hVKXcU zjs%2|1v5C13#;|QyBG)Fm14z%Wl=%^D*&O}`Ag?x@USPx26I^mWjZ4yK8?^Ed=gI} zbcBk~UqXcFB?#FcDr*S!MF<Apf$yEZZFM?f=TnbcTA$x~IJ#NNbj=UXt}%fK%wZ1ual z0E5vm5Ynsf^BIq|017Tu>J3s2u=D@D9}vzS`}~b)wSG4qxVV)y zx?fTF{!~94wdC()dqbK_QEATe1e=FPeN>rS$C4Ze1z4b|WuW4`L(%Pq$d0G4Q&+t^ zy4Da)0M=kI4Fm!1V4q@uw@WcRb`E?04X@~L8zaIBT7U&lTM@wPUWo6zX{3& z%Z4#Uow!1!MX}QQq7oz>k6F^3;eYZ{E(ir?S*%!gNlChVA7IaT#&N5 zs00}u${sjXcGydwlzt}wU`SktyU=1@AYWS4W-qzFvZ9@QMa}!M{875ctHUcN679?i z5O9us464@w}gHCipOe_+zi65p+Mv9Qvxk zIR9qG^itbso6z=px_-xJR!Nq1=K(He?@mTw$G6Q15wI~AFmpHwC04GD}ywS z85qD{-Ww|v#`X02P(5kh?q0F`5SA2{mUrZ0n9lo;^cl+o{+M*euWvPOH7msx z3=za3KiP`;`3y0)33D=_^*C|O&npydM!XoCv+RdZ?KYzOZOOA|wx>^G*XA-i)?X(k zO6m@(bgbH>=@;16ykvP)o1R>|Ze&2zqMI*q*YhEAIyt!`vQZogAEb!aQ6 zTz5LR=t4*Z?TG%310!F(=tWqJ4}qPQ4QJUuow9u`ESx^JOSJt$O9K8;2Pqk2-PUUVuoi8O2epN8av naf$mf78;;}Mxpuesh)Hw_3-}GKyJEh2MvfB#15?4Cd~O4_VGD3 literal 0 HcmV?d00001 diff --git a/public/icons/docs/octave/16@2x.png b/public/icons/docs/octave/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3f6c9700b3254e8b5619ebc0a53db6ac5dfca41f GIT binary patch literal 1940 zcmV;F2W$9=P)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8x00(qQO+^Re0|f&X7$L~owg3PIm`OxIR9M5kmwSv=)fL8n z-`eNCW}E@aOCF^>jG`b=v86nU6i8aIRBdTQ!T!-ltg&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mode 100644 index 00000000..917586bc --- /dev/null +++ b/public/icons/docs/octave/SOURCE @@ -0,0 +1 @@ +https://www.gnu.org/software/octave/img/octave-logo.svg From 2490136110e8090b89a5f9ee638e0489447719b1 Mon Sep 17 00:00:00 2001 From: Jiawen Geng Date: Tue, 13 Aug 2019 14:24:58 +0800 Subject: [PATCH 28/69] bump jest to 24.8.0 --- lib/docs/scrapers/jest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/jest.rb b/lib/docs/scrapers/jest.rb index a495d939..3aff5b21 100644 --- a/lib/docs/scrapers/jest.rb +++ b/lib/docs/scrapers/jest.rb @@ -1,7 +1,7 @@ module Docs class Jest < UrlScraper self.type = 'simple' - self.release = '23.5.0' + self.release = '24.8.0' self.base_url = 'https://jestjs.io/docs/en/' self.root_path = 'getting-started' self.links = { From 710b1151ecf038c64c4c0b8504857f3f244bce13 Mon Sep 17 00:00:00 2001 From: Jiawen Geng Date: Tue, 13 Aug 2019 16:24:42 +0800 Subject: [PATCH 29/69] bump vue to 2.6.10 --- lib/docs/scrapers/vue.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/scrapers/vue.rb b/lib/docs/scrapers/vue.rb index 333ade1d..3555fa06 100644 --- a/lib/docs/scrapers/vue.rb +++ b/lib/docs/scrapers/vue.rb @@ -15,12 +15,12 @@ module Docs options[:replace_paths] = { 'guide/' => 'guide/index.html' } options[:attribution] = <<-HTML - © 2013–2018 Evan You, Vue.js contributors
+ © 2013–2019 Evan You, Vue.js contributors
Licensed under the MIT License. HTML version '2' do - self.release = '2.5.16' + self.release = '2.6.10' self.base_url = 'https://vuejs.org/v2/' self.root_path = 'guide/index.html' self.initial_paths = %w(api/) From 40defddb6cdea03f9b66579843da7ac70fa5449a Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Tue, 13 Aug 2019 23:52:21 +0200 Subject: [PATCH 30/69] vuex: finish scraper and filters --- .../templates/pages/about_tmpl.coffee | 14 ++++---- lib/docs/filters/vuex/clean_html.rb | 5 ++- lib/docs/filters/vuex/entries.rb | 35 ++++++++++--------- lib/docs/scrapers/vuex.rb | 13 +++---- public/icons/docs/vuex/SOURCE | 2 +- 5 files changed, 37 insertions(+), 32 deletions(-) diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 51d76c61..07c92ad8 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -729,6 +729,11 @@ credits = [ '2010-2018 Mitchell Hashimoto', 'MPL', 'https://raw.githubusercontent.com/mitchellh/vagrant/master/website/LICENSE.md' + ], [ + 'Vue Router', + '2013-present Evan You', + 'MIT', + 'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE' ], [ 'Vue.js', '2013-2018 Evan You, Vue.js contributors', @@ -736,14 +741,9 @@ credits = [ 'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE' ], [ 'Vuex', - '2015-2018 Evan You, Vue.js contributors', + '2015-present Evan You', 'MIT', - 'https://raw.githubusercontent.com/vuejs/vuex/master/LICENSE' - ], [ - 'Vue Router', - '2013-present Evan You', - 'MIT', - 'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE' + 'https://raw.githubusercontent.com/vuejs/vuex/dev/LICENSE' ], [ 'Vulkan', '2014-2017 Khronos Group Inc.
Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.', diff --git a/lib/docs/filters/vuex/clean_html.rb b/lib/docs/filters/vuex/clean_html.rb index f62870cc..4aad55a9 100644 --- a/lib/docs/filters/vuex/clean_html.rb +++ b/lib/docs/filters/vuex/clean_html.rb @@ -4,6 +4,9 @@ module Docs def call @doc = at_css('.content') + # Remove video from root page + css('a[href="#"]').remove if root_page? + # Remove unneeded elements css('.header-anchor').remove @@ -11,4 +14,4 @@ module Docs end end end -end \ No newline at end of file +end diff --git a/lib/docs/filters/vuex/entries.rb b/lib/docs/filters/vuex/entries.rb index 72c8486e..04846fd2 100644 --- a/lib/docs/filters/vuex/entries.rb +++ b/lib/docs/filters/vuex/entries.rb @@ -8,10 +8,10 @@ module Docs # Add index on guides unless subpath.start_with?('api') - sidebarLink = at_css('.sidebar-link.active') - allLinks = css('.sidebar-link:not([href="/"]):not([href="../index"])') + sidebar_link = at_css('.sidebar-link.active') + all_links = css('.sidebar-link:not([href="/"]):not([href="../index"])') - index = allLinks.index(sidebarLink) + index = all_links.index(sidebar_link) name.prepend "#{index + 1}. " if index end @@ -28,7 +28,7 @@ module Docs end def additional_entries - return [] unless subpath.start_with?('api') + return [] unless subpath.start_with?('api') entries = [ ['Component Binding Helpers', 'component-binding-helpers', 'API Reference'], @@ -36,7 +36,7 @@ module Docs ] css('h3').each do |node| - entryName = node.content.strip + entry_name = node.content.strip # Get the previous h2 title title = node @@ -44,25 +44,26 @@ module Docs title = title.content.strip title.remove! '# ' - entryName.remove! '# ' + entry_name.remove! '# ' - unless entryName.start_with?('router.') - if title == "Vuex.Store Constructor Options" - entryName = "StoreOptions.#{entryName}" - elsif title == "Vuex.Store Instance Properties" - entryName = "Vuex.Store.#{entryName}" - elsif title == "Vuex.Store Instance Methods" - entryName = "Vuex.Store.#{entryName}()" - elsif title == "Component Binding Helpers" - entryName = "#{entryName}()" + unless entry_name.start_with?('router.') + case title + when "Vuex.Store Constructor Options" + entry_name = "StoreOptions.#{entry_name}" + when "Vuex.Store Instance Properties" + entry_name = "Vuex.Store.#{entry_name}" + when "Vuex.Store Instance Methods" + entry_name = "Vuex.Store.#{entry_name}()" + when "Component Binding Helpers" + entry_name = "#{entry_name}()" end end - entries << [entryName, node['id'], 'API Reference'] + entries << [entry_name, node['id'], 'API Reference'] end entries end end end -end \ No newline at end of file +end diff --git a/lib/docs/scrapers/vuex.rb b/lib/docs/scrapers/vuex.rb index 774e989f..57e761ce 100644 --- a/lib/docs/scrapers/vuex.rb +++ b/lib/docs/scrapers/vuex.rb @@ -1,8 +1,8 @@ module Docs class Vuex < UrlScraper - self.name = 'Vuex' self.type = 'simple' - + self.release = '3.1.1' + self.base_url = 'https://vuex.vuejs.org/' self.links = { home: 'https://vuex.vuejs.org', code: 'https://github.com/vuejs/vuex' @@ -10,17 +10,18 @@ module Docs html_filters.push 'vuex/entries', 'vuex/clean_html' - self.release = '3.0.1' - self.base_url = 'https://vuex.vuejs.org/' - options[:skip_patterns] = [ # Other languages /^(zh|ja|ru|kr|fr|ptbr)\//, ] options[:attribution] = <<-HTML - © 2015–2018 Evan You, Vue.js contributors
+ © 2015–present Evan You
Licensed under the MIT License. HTML + + def get_latest_version(opts) + get_npm_version('vuex', opts) + end end end diff --git a/public/icons/docs/vuex/SOURCE b/public/icons/docs/vuex/SOURCE index 97bd9e03..6999e8c5 100644 --- a/public/icons/docs/vuex/SOURCE +++ b/public/icons/docs/vuex/SOURCE @@ -1 +1 @@ -http://vuejs.org/ +https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai From eb82f6024cf25e8c468b5198404b75f7015fe457 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Wed, 14 Aug 2019 02:28:43 +0200 Subject: [PATCH 31/69] pony: finish scraper and filters --- .../templates/pages/about_tmpl.coffee | 6 ++++ lib/docs/filters/pony/clean_html.rb | 15 ++++++++++ lib/docs/filters/pony/container.rb | 9 ------ lib/docs/filters/pony/entries.rb | 26 ++++++++++++++++-- lib/docs/scrapers/pony.rb | 19 +++++++++---- public/icons/docs/pony/16.png | Bin 1979 -> 1360 bytes 6 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 lib/docs/filters/pony/clean_html.rb delete mode 100644 lib/docs/filters/pony/container.rb diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 07c92ad8..ac86b701 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -568,6 +568,12 @@ credits = [ 'CC BY', 'https://creativecommons.org/licenses/by/3.0/' ], [ + 'Pony', + '2016-2018, The Pony Developers & 2014-2015, Causality Ltd.', + 'BSD', + 'https://raw.githubusercontent.com/ponylang/ponyc/master/LICENSE' + ], + [ 'PostgreSQL', '1996-2018 The PostgreSQL Global Development Group
© 1994 The Regents of the University of California', 'PostgreSQL', diff --git a/lib/docs/filters/pony/clean_html.rb b/lib/docs/filters/pony/clean_html.rb new file mode 100644 index 00000000..665d1048 --- /dev/null +++ b/lib/docs/filters/pony/clean_html.rb @@ -0,0 +1,15 @@ +module Docs + class Pony + class CleanHtmlFilter < Filter + def call + css('.headerlink').remove + + css('pre').each do |node| + node.content = node.content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/pony/container.rb b/lib/docs/filters/pony/container.rb deleted file mode 100644 index f29db7d4..00000000 --- a/lib/docs/filters/pony/container.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Docs - class Pony - class ContainerFilter < Filter - def call - css('article') - end - end - end -end diff --git a/lib/docs/filters/pony/entries.rb b/lib/docs/filters/pony/entries.rb index 0dbc81c8..296f2090 100644 --- a/lib/docs/filters/pony/entries.rb +++ b/lib/docs/filters/pony/entries.rb @@ -2,11 +2,33 @@ module Docs class Pony class EntriesFilter < Docs::EntriesFilter def get_name - context[:html_title].sub(/ - .*/, '') + title = context[:html_title].sub(/ - .*/, '').split(' ').last + title = "1. #{type}" if title == 'Package' + title end def get_type - subpath.split('-')[0][0..-1] + subpath.split(/-([^a-z])/)[0][0..-1].sub('-', '/') + end + + def additional_entries + return [] if root_page? || name.start_with?("1. ") + + entries = [] + + css('h3').each do |node| + member_name = node.content + + is_field = member_name.start_with?('let ') + member_name = member_name[4..-1] if is_field + + member_name = member_name.scan(/^([a-zA-Z0-9_]+)/)[0][0] + member_name += '()' unless is_field + + entries << ["#{name}.#{member_name}", node['id']] + end + + entries end end end diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb index 5f1bbc04..24df881d 100644 --- a/lib/docs/scrapers/pony.rb +++ b/lib/docs/scrapers/pony.rb @@ -1,18 +1,27 @@ module Docs class Pony < UrlScraper - self.type = 'pony' - self.release = '0.25.0' + self.type = 'simple' + self.release = '0.30.0' self.base_url = 'https://stdlib.ponylang.io/' + self.links = { + home: 'https://www.ponylang.io/', + code: 'https://github.com/ponylang/ponyc' + } - html_filters.push 'pony/container', 'pony/entries' + html_filters.push 'pony/clean_html', 'pony/entries' options[:attribution] = <<-HTML © 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
- Licensed under the BSD 2-Clause License + Licensed under the BSD 2-Clause License. HTML + options[:container] = 'article' options[:trailing_slash] = false - options[:skip_patterns] = [/src/] + options[:skip_patterns] = [/src/, /stdlib--index/] + + def get_latest_version(opts) + get_latest_github_release('ponylang', 'ponyc', opts) + end end end diff --git a/public/icons/docs/pony/16.png b/public/icons/docs/pony/16.png index daed6509fb0efbcee6aceaa42047dd39ed731f03..c5b30dade6843b0a39575e97a0fc6147f79346b6 100644 GIT binary patch literal 1360 zcmZ`(c~FyA5Z^Bc34uT;R|HYe8c`q(0cr>-3M7Oxgvb#RjsO9q%4q~dKm<#n%Akl4 zFnCnJQCq9U;DA!Fr53FqtyqyVT8mKeXvMoCrSHSBo&M3^?6>=N-@Z4y`+M_MNhM-B z&4va5^uPe23|R*LQHe-9x|ps-hLq+L>H~19#^`k-8Tt0f0kTklLKZ;jc7RtXRC*U+ z69?d)3V^Q#u+G+Xg$n=(4bqSZ5lWyCfkp%>0mua80SNh9rbZe(zXwk=`!C;c|ha# zyc113lY+c1w6{L~_4@SfYgHT7c?r_C+U>c@P$VVmVz#C$(1mqdb4L5mW<-m}f9OM* z6T=r(fu0rFi6a*}r98(#j{W)wp(=n^kSN<*>nJB0m=+z(BUHo?JuoGreaCT&T zsQuEV$?wJg~9$|J80d${XQZ_+$_N;j@%GIxfC3|w|`{`|9y z4G$mKEo^4$;;g#5I=2+CA3uIR9rxh3D~yxssV^s-qE0BfQy+Fcvwh!yOUf8MmvX=3 zp;zATquptLd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y92g+g(7?3mGXO{=68z#f53%8ex+ABbIiLAwwXnYZ zc?OC_X3w3=m@!Q}{r7cbvf1IqXU;l}Og2k4+sOFw6aJNTkYv}+E&#*`W5y=U_aFV^ z<3DU|Ya5mF(~g%nZsdx~E?wDMakqYaA27$KxLd$Wd9)fK9~#Cvs5&JQU?8I1!2uu{ z2q&uGs}dO@69{>Q!N^enO0lv>psB%Up@YFdIId!OqvqHRR21y~GT)(off*6r*aUY5 zhN)JG1H)KPNEahsv&z1Th{}s*n~T zoAR0M6p3|cK_LT-S8$nt3ypv;UDfv>vRndLZV>LX~Gn6FsT}!?l1xtL(Fm z11gj~ArUJbMo2dXoEtm#M#}y`80!gRl0Fj)6>h6ow$~gVlw$s7>do2DQ64Er1Q?2< zgFS&^a$uMd*MWM Date: Wed, 14 Aug 2019 02:40:51 +0200 Subject: [PATCH 32/69] pony: remove horizontal lines --- lib/docs/filters/pony/clean_html.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/filters/pony/clean_html.rb b/lib/docs/filters/pony/clean_html.rb index 665d1048..9260f226 100644 --- a/lib/docs/filters/pony/clean_html.rb +++ b/lib/docs/filters/pony/clean_html.rb @@ -3,6 +3,7 @@ module Docs class CleanHtmlFilter < Filter def call css('.headerlink').remove + css('hr').remove css('pre').each do |node| node.content = node.content From 0b1adb5291b4f0e54fe7c2520148b7ef1cabf170 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Wed, 14 Aug 2019 17:36:06 +0200 Subject: [PATCH 33/69] Fix #1054 --- views/service-worker.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/service-worker.js.erb b/views/service-worker.js.erb index aa234c19..722cd3fe 100644 --- a/views/service-worker.js.erb +++ b/views/service-worker.js.erb @@ -50,7 +50,7 @@ self.addEventListener('fetch', event => { <%# The index page will make sure the correct documentation or a proper offline page is shown %> const pathname = url.pathname; const filename = pathname.substr(1 + pathname.lastIndexOf('/')).split(/\#|\?/g)[0]; - if (url.origin === location.origin && !filename.includes('.')) { + if (url.origin === location.origin && !['.css', '.js', '.json', '.png', '.ico', '.svg', '.xml'].some(ext => filename.endsWith(ext))) { const cachedIndex = await caches.match('/'); if (cachedIndex) return cachedIndex; } From c8f30b213f46486a5c527de3cca8eddaa28cf01c Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 14 Aug 2019 18:53:21 +0200 Subject: [PATCH 34/69] Update the Godot icon This updates the Godot icon to the official icon used since Godot 3.0. --- public/icons/docs/godot/16.png | Bin 751 -> 642 bytes public/icons/docs/godot/16@2x.png | Bin 1585 -> 1415 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/icons/docs/godot/16.png b/public/icons/docs/godot/16.png index c574a60d1b295b5bd6ef27aa0102e02a9ef8112b..5497dfaf3d27d8450eaad27d2499f559e83c4aa8 100644 GIT binary patch literal 642 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Lb6AYF9SoB8UsT^3j@P1pisjL z28L1t28LG&3=CE?7#PG0=Ijcz0ZOo>JNh~@Fl_AS{*%bcz`!UK;1l8s6nF30@6xl+ zvum$g&jI(IeeT`+9Xs|;+;uZ~?n$T4z3x2+JV4_6NkwiwAaf?|z6nH0b58)-a0E2U zwR@ijHZy^`oICdcWj%WjH6w(MF+1A}2_oI%M$I~1SEf9)Ar t+?~Uy z&$g{XY;&~s?%B3)-<$Q}w{4Ua^GnZctm~@h?*6{lkp3=Dx)0ne8@7j&np-Y$^$YE|ck7Y>;9wB-T=doqWR-7y}V@~WUITlBy--M9% z&x&5d>GV}pmpzBq-h3B}5|?3~>%j545ljx`@o8WSo_~4l5ga^n3>){g*xxx$rZEPsAoqxR zx~+a@sDQQGu3_ztI!y3nKu$4@Vlp$BwPWA}c*WLQY}{3g8KnExp{Ax~@%*DwnVNd- z^Ru0Z@PBS3(>(~Ky0AE2#HO7!2-4nnu@mncX>y!}=^WuSNY|h01!eFPsqC|Jcg+lB z2j4%@j-`nr)^ES&C~V91VL1hG7BSe8=|%8T7v4VH=rH>5R0kHu@?%fw;vwf7B$KUmT0f#XR UU{RvMy8r+H07*qoM6N<$f)(L+P5=M^ diff --git a/public/icons/docs/godot/16@2x.png b/public/icons/docs/godot/16@2x.png index 8047384df823bd537ad58c6e84d48df527e1fbb9..64cdf210e5a600bfcf830f4f5fe653990ac95efb 100644 GIT binary patch literal 1415 zcmbtTeN>WH7=J-cYh|w1vC~=8dD6Z-m6@nnDu^O}a1dLDiXWBJtc0y}+D2O1Ohj~= zC9S0nh=u@1z$f<6PRd1AEHe@G>0ZSqTK8M`(tOj=XdXO?{lB?yZ5=z?-t>4 zm<{W;tpfmH12z;*fUNUsx3hvqG>ZnVE>49KA_3r%8vx`L0Du{C_ z3M&<1=z2vs*K}_{#9^rQsdvb`Pat@SBFgcxF!!O%PNBg+alqJpUG} zNBm!)>4IPg#e%2`F`+^{F|&B`mtF{HngGIoSyTO=cw!aY5k0Od5N#oA+PhVwJQHwGLbXLhkgAL;^JguFHThT zKsTwCyd=fN1r&C$rBm`}Lq6WVfdNQ_7lKvaKxWHvWt}?X5``^S3=cK-Pvy5N4SHP^ zKFaG5A_Numw6o^~vlsVMmwtY^U7=O0RIJ(>K^Iuis*Eh_)EburVo;@0g%k@Yjl+c; zRr1{dI%hPTAqu7m{0lq67@`;Y1;x~#pxV$j{3iXLG`d0@R|Upaf!!*Dd~!~$Tga#% z%zY>?;f^Zb7@PVg{D16-z9EJR{l}aMsyKr?me-;n*AE62@qO}nOrcshs)Iy=EfJ;F zN+)LC#WTURlEJ?iV1&2S;jJ2^`_$2iH`RZSWeQPqC_{oA8+ST*Pb$)T|<9c6ljBu+>|$;k+u_V-3_o^cWeu!F6f-y z;f337+gnLveTYujHIw+}P%105E{BQtSU=01Fx45bLO>X;X+R+s0RPyU?lEQH)Txn9{JjqoV={l2U24mh%|KO-q|Xr9#Pj&)r)wDlnVbwU58-MBu^#c87B z+MZam`2LgRz9V+x5r;Oq?}UKIcQWTNsCRv&%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Hzo5(IN47wklS7v@?<@`NDh!F zvWT=KZ&}8xeYvIxTo0J->id~LLbWzL_aH;aP|}mM<0kW3?1PWYcK?Tc f?b@G-QWQS{a#}6TTP5K=00000NkvXXu0mjf{3;WQ From 22f7bcf987f320f0076ca2c02196953b64a6b39d Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Thu, 15 Aug 2019 03:17:18 +0200 Subject: [PATCH 35/69] Fix fetch issues with browser extension resources --- views/service-worker.js.erb | 42 ++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/views/service-worker.js.erb b/views/service-worker.js.erb index 722cd3fe..4a0bd9d0 100644 --- a/views/service-worker.js.erb +++ b/views/service-worker.js.erb @@ -11,6 +11,34 @@ const urlsToCache = [ '<%= doc_index_urls.join "',\n '" %>', ]; +<%# Clone a request with the mode set to 'cors' %> +function corsify(request) { + const options = { + mode: 'cors', + }; + + const keys = [ + 'body', + 'cache', + 'credentials', + 'headers', + 'integrity', + 'keepalive', + 'method', + 'redirect', + 'referrer', + 'referrerPolicy', + 'signal', + 'window', + ]; + + for (const key of keys) { + options[key] = request[key]; + } + + return new Request(request.url, options); +} + <%# Set-up the cache %> self.addEventListener('install', event => { self.skipWaiting(); @@ -36,9 +64,11 @@ self.addEventListener('fetch', event => { if (cachedResponse) return cachedResponse; try { - const response = await fetch(event.request); + const response = await fetch(corsify(event.request)); - if (!response.ok) { + <%# If the status code is 0 it means the response is opaque %> + <%# If the response is opaque it's not possible to read whether it is successful or not, so we assume it is %> + if (!response.ok && response.status !== 0) { throw new Error(`The HTTP request failed with status code ${response.status}`); } @@ -46,11 +76,13 @@ self.addEventListener('fetch', event => { } catch (err) { const url = new URL(event.request.url); - <%# Attempt to return the index page from the cache if the user is visiting a url like devdocs.io/offline or devdocs.io/javascript/global_objects/array/find %> - <%# The index page will make sure the correct documentation or a proper offline page is shown %> const pathname = url.pathname; const filename = pathname.substr(1 + pathname.lastIndexOf('/')).split(/\#|\?/g)[0]; - if (url.origin === location.origin && !['.css', '.js', '.json', '.png', '.ico', '.svg', '.xml'].some(ext => filename.endsWith(ext))) { + const extensions = ['.html', '.css', '.js', '.json', '.png', '.ico', '.svg', '.xml']; + + <%# Attempt to return the index page from the cache if the user is visiting a url like devdocs.io/offline or devdocs.io/javascript/global_objects/array/find %> + <%# The index page will make sure the correct documentation or a proper offline page is shown %> + if (url.origin === location.origin && !extensions.some(ext => filename.endsWith(ext))) { const cachedIndex = await caches.match('/'); if (cachedIndex) return cachedIndex; } From 3bf5d978c7a978ef039a288e43112ec9d8d9be7f Mon Sep 17 00:00:00 2001 From: David Chen Date: Wed, 14 Aug 2019 19:34:01 -0700 Subject: [PATCH 36/69] Add ruby 2.6 docs --- lib/docs/scrapers/rdoc/ruby.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/docs/scrapers/rdoc/ruby.rb b/lib/docs/scrapers/rdoc/ruby.rb index bc064660..3a2b8b76 100644 --- a/lib/docs/scrapers/rdoc/ruby.rb +++ b/lib/docs/scrapers/rdoc/ruby.rb @@ -69,6 +69,10 @@ module Docs Licensed under their own licenses. HTML + version '2.6' do + self.release = '2.6.3' + end + version '2.5' do self.release = '2.5.3' end From 17528d984575fe6d7a586987a7936a06d695c588 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Fri, 16 Aug 2019 16:49:12 +0200 Subject: [PATCH 37/69] rxjs: finish scraper and filters --- .../templates/pages/about_tmpl.coffee | 20 ++-- lib/docs/filters/rxjs/clean_html.rb | 54 ++++++++-- lib/docs/filters/rxjs/entries.rb | 12 ++- lib/docs/scrapers/rxjs.rb | 102 +++++++++--------- public/icons/docs/rxjs/16.png | Bin 5356 -> 1521 bytes public/icons/docs/rxjs/SOURCE | 2 +- 6 files changed, 117 insertions(+), 73 deletions(-) diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index ac86b701..892c4284 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -211,8 +211,7 @@ credits = [ '2017 Cypress.io', 'MIT', 'https://raw.githubusercontent.com/cypress-io/cypress-documentation/develop/LICENSE.md' - ], - [ + ], [ 'D', '1999-2018 The D Language Foundation', 'Boost', @@ -572,8 +571,7 @@ credits = [ '2016-2018, The Pony Developers & 2014-2015, Causality Ltd.', 'BSD', 'https://raw.githubusercontent.com/ponylang/ponyc/master/LICENSE' - ], - [ + ], [ 'PostgreSQL', '1996-2018 The PostgreSQL Global Development Group
© 1994 The Regents of the University of California', 'PostgreSQL', @@ -648,13 +646,17 @@ credits = [ '2010 The Rust Project Developers', 'MIT', 'https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT' + ], [ + 'RxJS', + '2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors', + 'Apache', + 'https://raw.githubusercontent.com/ReactiveX/rxjs/master/LICENSE.txt' ], [ 'Salt Stack', '2019 SaltStack', 'Apache', 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE' - ], - [ + ], [ 'Sass', '2006-2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein', 'MIT', @@ -664,8 +666,7 @@ credits = [ '2002-2019 EPFL, with contributions from Lightbend', 'Apache', 'https://raw.githubusercontent.com/scala/scala-lang/master/license.md' - ], - [ + ], [ 'scikit-image', '2011 the scikit-image team', 'BSD', @@ -765,8 +766,7 @@ credits = [ '2003-2019 WordPress Foundation', 'GPLv2+', 'https://wordpress.org/about/license/' - ], - [ + ], [ 'Yarn', '2016-present Yarn Contributors', 'BSD', diff --git a/lib/docs/filters/rxjs/clean_html.rb b/lib/docs/filters/rxjs/clean_html.rb index 1056b1a6..864c201b 100644 --- a/lib/docs/filters/rxjs/clean_html.rb +++ b/lib/docs/filters/rxjs/clean_html.rb @@ -7,6 +7,11 @@ module Docs at_css('h1').content = 'RxJS Documentation' end + if at_css('h1').nil? + title = subpath.rpartition('/').last.titleize + doc.prepend_child("

#{title}

") + end + css('br', 'hr', '.material-icons', '.header-link', '.breadcrumb').remove css('.content', 'article', '.api-header', 'section', '.instance-member').each do |node| @@ -65,6 +70,16 @@ module Docs if node['class'] && node['class'].include?('api-heading') node.name = 'h3' + + unless node.ancestors('.instance-method').empty? + matches = node.inner_html.scan(/([^(& ]+)[(&]/) + + unless matches.empty? || matches[0][0] == 'constructor' + node['name'] = matches[0][0] + node['id'] = node['name'].downcase + '-' + end + end + node.inner_html = "#{node.inner_html}" end @@ -77,25 +92,48 @@ module Docs node.remove_attribute('class') end - css('h1[class]').remove_attr('class') - css('table[class]').remove_attr('class') - css('table[width]').remove_attr('width') - css('tr[style]').remove_attr('style') + css('td > .overloads').each do |node| + node.replace node.at_css('.detail-contents') + end + + css('td.short-description p').each do |node| + signature = node.parent.parent.next_element.at_css('h3[id]') + signature.after(node) unless signature.nil? + end - if at_css('.api-type-label.module') - at_css('h1').content = subpath.remove('api/') + css('.method-table').each do |node| + node.replace node.at_css('tbody') end - css('th h3').each do |node| - node.name = 'span' + css('.api-body > table > caption').each do |node| + node.name = 'center' + lift_out_of_table node end + css('.api-body > table > tbody > tr:not([class]) > td > *').each do |node| + lift_out_of_table node + end + + css('.api-body > table').each do |node| + node.remove if node.content.strip.blank? + end + + css('h1[class]').remove_attr('class') + css('table[class]').remove_attr('class') + css('table[width]').remove_attr('width') + css('tr[style]').remove_attr('style') + css('code code').each do |node| node.before(node.children).remove end doc end + + def lift_out_of_table(node) + table = node.ancestors('table').first + table.previous_element.after(node) + end end end end diff --git a/lib/docs/filters/rxjs/entries.rb b/lib/docs/filters/rxjs/entries.rb index 020ce1eb..c6e488fb 100644 --- a/lib/docs/filters/rxjs/entries.rb +++ b/lib/docs/filters/rxjs/entries.rb @@ -2,22 +2,28 @@ module Docs class Rxjs class EntriesFilter < Docs::EntriesFilter def get_name - name = at_css('h1').content + title = at_css('h1') + name = title.nil? ? subpath.rpartition('/').last.titleize : title.content name.prepend "#{$1}. " if subpath =~ /\-pt(\d+)/ + name += '()' unless at_css('.api-type-label.function').nil? name end def get_type if slug.start_with?('guide') 'Guide' - elsif at_css('.api-type-label.module') - name.split('/').first elsif slug.start_with?('api/') slug.split('/').second else 'Miscellaneous' end end + + def additional_entries + css('h3[id]').map do |node| + ["#{name}.#{node['name']}()", node['id']] + end + end end end end diff --git a/lib/docs/scrapers/rxjs.rb b/lib/docs/scrapers/rxjs.rb index 1825fc80..e5ea1051 100644 --- a/lib/docs/scrapers/rxjs.rb +++ b/lib/docs/scrapers/rxjs.rb @@ -4,11 +4,26 @@ module Docs class Rxjs < UrlScraper self.name = 'RxJS' self.type = 'rxjs' + self.release = '6.5.2' + self.base_url = 'https://rxjs.dev/' + self.root_path = 'guide/overview' self.links = { home: 'https://rxjs.dev/', code: 'https://github.com/ReactiveX/rxjs' } + html_filters.push 'rxjs/clean_html', 'rxjs/entries' + + options[:follow_links] = false + options[:only_patterns] = [/guide\//, /api\//] + options[:skip_patterns] = [/api\/([^\/]+)\.json/] + options[:fix_urls_before_parse] = ->(url) do + url.sub! %r{\Aguide/}, '/guide/' + url.sub! %r{\Aapi/}, '/api/' + url.sub! %r{\Agenerated/}, '/generated/' + url + end + options[:max_image_size] = 256_000 options[:attribution] = <<-HTML @@ -16,69 +31,54 @@ module Docs Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0. HTML - module Common - private + def get_latest_version(opts) + json = fetch_json('https://rxjs.dev/generated/navigation.json', opts) + json['__versionInfo']['raw'] + end - def initial_urls - initial_urls = [] + private - Request.run "#{self.class.base_url}generated/navigation.json" do |response| - data = JSON.parse(response.body) - dig = ->(entry) do - initial_urls << url_for("generated/docs/#{entry['url']}.json") if entry['url'] && entry['url'] != 'api' - entry['children'].each(&dig) if entry['children'] - end - data['SideNav'].each(&dig) - end + def initial_urls + initial_urls = [] - Request.run "#{self.class.base_url}generated/docs/api/api-list.json" do |response| - data = JSON.parse(response.body) - dig = ->(entry) do - initial_urls << url_for("generated/docs/#{entry['path']}.json") if entry['path'] - initial_urls << url_for("generated/docs/api/#{entry['name']}.json") if entry['name'] && !entry['path'] - entry['items'].each(&dig) if entry['items'] - end - data.each(&dig) + Request.run "#{self.class.base_url}generated/navigation.json" do |response| + data = JSON.parse(response.body) + dig = ->(entry) do + initial_urls << url_for("generated/docs/#{entry['url']}.json") if entry['url'] && entry['url'] != 'api' + entry['children'].each(&dig) if entry['children'] end - - initial_urls + data['SideNav'].each(&dig) end - def handle_response(response) - if response.mime_type.include?('json') - begin - response.options[:response_body] = JSON.parse(response.body)['contents'] - rescue JSON::ParserError - response.options[:response_body] = '' - end - response.headers['Content-Type'] = 'text/html' - response.url.path = response.url.path.sub('/generated/docs/', '/').remove('.json') - response.effective_url.path = response.effective_url.path.sub('/generated/docs/', '/').remove('.json') + Request.run "#{self.class.base_url}generated/docs/api/api-list.json" do |response| + data = JSON.parse(response.body) + dig = ->(entry) do + initial_urls << url_for("generated/docs/#{entry['path']}.json") if entry['path'] + initial_urls << url_for("generated/docs/api/#{entry['name']}.json") if entry['name'] && !entry['path'] + entry['items'].each(&dig) if entry['items'] end - super + data.each(&dig) end - end - version do - self.release = '6.3.3' - self.base_url = 'https://rxjs.dev/' - self.root_path = 'guide/overview' - - html_filters.push 'rxjs/clean_html', 'rxjs/entries' - - options[:follow_links] = false - options[:only_patterns] = [/\Aguide/, /\Aapi/] - options[:fix_urls_before_parse] = ->(url) do - url.sub! %r{\Aguide/}, '/guide/' - url.sub! %r{\Aapi/}, '/api/' - url.sub! %r{\Agenerated/}, '/generated/' - url + initial_urls.select do |url| + options[:only_patterns].any? { |pattern| url =~ pattern } && + options[:skip_patterns].none? { |pattern| url =~ pattern } end - - include Docs::Rxjs::Common end - private + def handle_response(response) + if response.mime_type.include?('json') + begin + response.options[:response_body] = JSON.parse(response.body)['contents'] + rescue JSON::ParserError + response.options[:response_body] = '' + end + response.headers['Content-Type'] = 'text/html' + response.url.path = response.url.path.sub('/generated/docs/', '/').remove('.json') + response.effective_url.path = response.effective_url.path.sub('/generated/doc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?ZB~D z^S$BUrl-3Ob%ukPCc1bUMtM8EC>7uRN}W#AZNiR4codF za4A{zI>YX7jRJwOsq4irG-cMP20M_9yokCKOsRcGTjf3pdos7mk<^ zM(z8T&T-(lto`^UR?Mw1DTyhlaf<8|>>*ExMAs-ROpB&xj|+ZxhMEL(ra*K)hwF8+ ziEC&Y;ofawcP)@@ULrrAQ|h@+YxkWmlqMu=_m-TRF9hA?37TQrIocI4iw*Q}9i6SC z&(;aUZJgY~zfiFCFXiqVOFs(9C4=wm1@n$VUk5MCXh;xAu+l=LfzI9}yj-$Nr$_Sr z;hq4XZ$h{|B>4Ffs!xO2q1bg9u!O(bAbgXE`8s#CWNZ4O0{jh$WL{&SUMK4S0000< KMNUMnLSTX!`8aC; diff --git a/public/icons/docs/rxjs/SOURCE b/public/icons/docs/rxjs/SOURCE index 536eb88a..2a3b3084 100644 --- a/public/icons/docs/rxjs/SOURCE +++ b/public/icons/docs/rxjs/SOURCE @@ -1 +1 @@ -http://reactivex.io/ +https://github.com/ReactiveX/reactivex.github.io/blob/develop/favicon.ico From d5f4a76fc2a9b78cf0e174076dc223d6e34c7762 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Fri, 16 Aug 2019 17:25:16 +0200 Subject: [PATCH 38/69] rxjs: fix Observable link on root page --- lib/docs/scrapers/rxjs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/rxjs.rb b/lib/docs/scrapers/rxjs.rb index e5ea1051..e6f57961 100644 --- a/lib/docs/scrapers/rxjs.rb +++ b/lib/docs/scrapers/rxjs.rb @@ -18,7 +18,7 @@ module Docs options[:only_patterns] = [/guide\//, /api\//] options[:skip_patterns] = [/api\/([^\/]+)\.json/] options[:fix_urls_before_parse] = ->(url) do - url.sub! %r{\Aguide/}, '/guide/' + url.sub! %r{\A(\.\/)?guide/}, '/guide/' url.sub! %r{\Aapi/}, '/api/' url.sub! %r{\Agenerated/}, '/generated/' url From 4da5ae7e732b21c8c78aa94a8355cf89a1365117 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sat, 17 Aug 2019 00:02:54 +0200 Subject: [PATCH 39/69] octave: finish scraper and filters --- .../templates/pages/about_tmpl.coffee | 5 + assets/javascripts/vendor/prism.js | 4787 +++++++++-------- lib/docs/filters/octave/clean_html.rb | 7 +- lib/docs/filters/octave/entries.rb | 8 +- lib/docs/scrapers/octave.rb | 2 +- 5 files changed, 2592 insertions(+), 2217 deletions(-) diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 892c4284..5238d850 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -516,6 +516,11 @@ credits = [ '2008-2017 NumPy Developers', 'NumPy', 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt' + ], [ + 'Octave', + '1996-2018 John W. Eaton', + 'Custom', + 'https://octave.org/doc/interpreter/' ], [ 'OpenJDK', '1993-2017, Oracle and/or its affiliates. All rights reserved.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses.
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.', diff --git a/assets/javascripts/vendor/prism.js b/assets/javascripts/vendor/prism.js index 09d6df87..c2cbaadd 100644 --- a/assets/javascripts/vendor/prism.js +++ b/assets/javascripts/vendor/prism.js @@ -1,12 +1,12 @@ -/* PrismJS 1.15.0 -https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+django+elixir+markup-templating+erlang+go+java+json+kotlin+lua+crystal+nginx+nim+perl+php+sql+scss+python+jsx+typescript+rust+yaml */ +/* PrismJS 1.17.1 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+java+php+json+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */ var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); + ? window // if in browser + : ( + (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) + ? self // if in worker + : {} // if in node js + ); /** * Prism: Lightweight, robust, elegant syntax highlighting @@ -14,977 +14,1174 @@ var _self = (typeof window !== 'undefined') * @author Lea Verou http://lea.verou.me */ -var Prism = (function(){ +var Prism = (function (_self){ // Private helper vars -var lang = /\blang(?:uage)?-([\w-]+)\b/i; -var uniqueId = 0; - -var _ = _self.Prism = { - manual: _self.Prism && _self.Prism.manual, - disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! - return; - } - - if (str instanceof Token) { - continue; - } - - if (greedy && i != strarr.length - 1) { - pattern.lastIndex = pos; - var match = pattern.exec(text); - if (!match) { - break; - } - - var from = match.index + (lookbehind ? match[1].length : 0), - to = match.index + match[0].length, - k = i, - p = pos; - - for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { - p += strarr[k].length; - // Move the index i to the element in strarr that is closest to from - if (from >= p) { - ++i; - pos = p; - } - } - - // If strarr[i] is a Token, then the match starts inside another Token, which is invalid - if (strarr[i] instanceof Token) { - continue; - } - - // Number of tokens to delete and replace with the new match - delNum = k - i; - str = text.slice(pos, p); - match.index -= pos; - } else { - pattern.lastIndex = 0; - - var match = pattern.exec(str), - delNum = 1; - } - - if (!match) { - if (oneshot) { - break; - } - - continue; - } - - if(lookbehind) { - lookbehindLength = match[1] ? match[1].length : 0; - } - - var from = match.index + lookbehindLength, - match = match[0].slice(lookbehindLength), - to = from + match.length, - before = str.slice(0, from), - after = str.slice(to); + var lang = /\blang(?:uage)?-([\w-]+)\b/i; + var uniqueId = 0; + + var _ = { + manual: _self.Prism && _self.Prism.manual, + disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, + util: { + encode: function (tokens) { + if (tokens instanceof Token) { + return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); + } else if (Array.isArray(tokens)) { + return tokens.map(_.util.encode); + } else { + return tokens.replace(/&/g, '&').replace(/ text.length) { + // Something went terribly wrong, ABORT, ABORT! + return; + } + + if (str instanceof Token) { + continue; + } + + if (greedy && i != strarr.length - 1) { + pattern.lastIndex = pos; + var match = pattern.exec(text); + if (!match) { + break; + } + + var from = match.index + (lookbehind ? match[1].length : 0), + to = match.index + match[0].length, + k = i, + p = pos; + + for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { + p += strarr[k].length; + // Move the index i to the element in strarr that is closest to from + if (from >= p) { + ++i; + pos = p; + } + } + + // If strarr[i] is a Token, then the match starts inside another Token, which is invalid + if (strarr[i] instanceof Token) { + continue; + } + + // Number of tokens to delete and replace with the new match + delNum = k - i; + str = text.slice(pos, p); + match.index -= pos; + } else { + pattern.lastIndex = 0; + + var match = pattern.exec(str), + delNum = 1; + } + + if (!match) { + if (oneshot) { + break; + } + + continue; + } + + if(lookbehind) { + lookbehindLength = match[1] ? match[1].length : 0; + } + + var from = match.index + lookbehindLength, + match = match[0].slice(lookbehindLength), + to = from + match.length, + before = str.slice(0, from), + after = str.slice(to); + + var args = [i, delNum]; + + if (before) { + ++i; + pos += before.length; + args.push(before); + } + + var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); + + args.push(wrapped); + + if (after) { + args.push(after); + } + + Array.prototype.splice.apply(strarr, args); + + if (delNum != 1) + _.matchGrammar(text, strarr, grammar, i, pos, true, token); + + if (oneshot) + break; + } + } + } + }, + + tokenize: function(text, grammar) { + var strarr = [text]; + + var rest = grammar.rest; + + if (rest) { + for (var token in rest) { + grammar[token] = rest[token]; + } + + delete grammar.rest; + } + + _.matchGrammar(text, strarr, grammar, 0, 0, false); + + return strarr; + }, + + hooks: { + all: {}, + + add: function (name, callback) { + var hooks = _.hooks.all; + + hooks[name] = hooks[name] || []; + + hooks[name].push(callback); + }, + + run: function (name, env) { + var callbacks = _.hooks.all[name]; + + if (!callbacks || !callbacks.length) { + return; + } - var args = [i, delNum]; - - if (before) { - ++i; - pos += before.length; - args.push(before); - } + for (var i=0, callback; callback = callbacks[i++];) { + callback(env); + } + } + }, - var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); - - args.push(wrapped); + Token: Token + }; - if (after) { - args.push(after); - } - - Array.prototype.splice.apply(strarr, args); - - if (delNum != 1) - _.matchGrammar(text, strarr, grammar, i, pos, true, token); + _self.Prism = _; - if (oneshot) - break; - } - } - } - }, + function Token(type, content, alias, matchedStr, greedy) { + this.type = type; + this.content = content; + this.alias = alias; + // Copy of the full string this token was created from + this.length = (matchedStr || "").length|0; + this.greedy = !!greedy; + } - tokenize: function(text, grammar, language) { - var strarr = [text]; + Token.stringify = function(o, language) { + if (typeof o == 'string') { + return o; + } - var rest = grammar.rest; + if (Array.isArray(o)) { + return o.map(function(element) { + return Token.stringify(element, language); + }).join(''); + } - if (rest) { - for (var token in rest) { - grammar[token] = rest[token]; - } - - delete grammar.rest; - } - - _.matchGrammar(text, strarr, grammar, 0, 0, false); - - return strarr; - }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - } -}; - -var Token = _.Token = function(type, content, alias, matchedStr, greedy) { - this.type = type; - this.content = content; - this.alias = alias; - // Copy of the full string this token was created from - this.length = (matchedStr || "").length|0; - this.greedy = !!greedy; -}; - -Token.stringify = function(o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (_.util.type(o) === 'Array') { - return o.map(function(element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = Object.keys(env.attributes).map(function(name) { - return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; - }).join(' '); - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; - -}; + var env = { + type: o.type, + content: Token.stringify(o.content, language), + tag: 'span', + classes: ['token', o.type], + attributes: {}, + language: language + }; -// if (!_self.document) { -// if (!_self.addEventListener) { -// // in Node.js -// return _self.Prism; -// } - -// if (!_.disableWorkerMessageHandler) { -// // In worker -// _self.addEventListener('message', function (evt) { -// var message = JSON.parse(evt.data), -// lang = message.language, -// code = message.code, -// immediateClose = message.immediateClose; - -// _self.postMessage(_.highlight(code, _.languages[lang], lang)); -// if (immediateClose) { -// _self.close(); -// } -// }, false); -// } - -// return _self.Prism; -// } - -// //Get current script and highlight -// var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); - -// if (script) { -// _.filename = script.src; - -// if (!_.manual && !script.hasAttribute('data-manual')) { -// if(document.readyState !== "loading") { -// if (window.requestAnimationFrame) { -// window.requestAnimationFrame(_.highlightAll); -// } else { -// window.setTimeout(_.highlightAll, 16); -// } -// } -// else { -// document.addEventListener('DOMContentLoaded', _.highlightAll); -// } -// } -// } - -return _self.Prism; - -})(); + if (o.alias) { + var aliases = Array.isArray(o.alias) ? o.alias : [o.alias]; + Array.prototype.push.apply(env.classes, aliases); + } + + _.hooks.run('wrap', env); + + var attributes = Object.keys(env.attributes).map(function(name) { + return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; + }).join(' '); + + return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; + }; + + if (!_self.document) { + if (!_self.addEventListener) { + // in Node.js + return _; + } + + if (!_.disableWorkerMessageHandler) { + // In worker + _self.addEventListener('message', function (evt) { + var message = JSON.parse(evt.data), + lang = message.language, + code = message.code, + immediateClose = message.immediateClose; + + _self.postMessage(_.highlight(code, _.languages[lang], lang)); + if (immediateClose) { + _self.close(); + } + }, false); + } + + return _; + } + +//Get current script and highlight + var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); + + if (script) { + _.filename = script.src; + + if (!_.manual && !script.hasAttribute('data-manual')) { + if(document.readyState !== "loading") { + if (window.requestAnimationFrame) { + window.requestAnimationFrame(_.highlightAll); + } else { + window.setTimeout(_.highlightAll, 16); + } + } + else { + document.addEventListener('DOMContentLoaded', _.highlightAll); + } + } + } + + return _; + +})(_self); if (typeof module !== 'undefined' && module.exports) { - module.exports = Prism; + module.exports = Prism; } // hack for components to work correctly in node.js if (typeof global !== 'undefined') { - global.Prism = Prism; + global.Prism = Prism; } ; Prism.languages.markup = { - 'comment': //, - 'prolog': /<\?[\s\S]+?\?>/, - 'doctype': //i, - 'cdata': //i, - 'tag': { - pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, - greedy: true, - inside: { - 'tag': { - pattern: /^<\/?[^\s>\/]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[^\s>\/:]+:/ - } - }, - 'attr-value': { - pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i, - inside: { - 'punctuation': [ - /^=/, - { - pattern: /(^|[^\\])["']/, - lookbehind: true - } - ] - } - }, - 'punctuation': /\/?>/, - 'attr-name': { - pattern: /[^\s>\/]+/, - inside: { - 'namespace': /^[^\s>\/:]+:/ - } - } - - } - }, - 'entity': /&#?[\da-z]{1,8};/i + 'comment': //, + 'prolog': /<\?[\s\S]+?\?>/, + 'doctype': //i, + 'cdata': //i, + 'tag': { + pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i, + greedy: true, + inside: { + 'tag': { + pattern: /^<\/?[^\s>\/]+/i, + inside: { + 'punctuation': /^<\/?/, + 'namespace': /^[^\s>\/:]+:/ + } + }, + 'attr-value': { + pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i, + inside: { + 'punctuation': [ + /^=/, + { + pattern: /^(\s*)["']|["']$/, + lookbehind: true + } + ] + } + }, + 'punctuation': /\/?>/, + 'attr-name': { + pattern: /[^\s>\/]+/, + inside: { + 'namespace': /^[^\s>\/:]+:/ + } + } + + } + }, + 'entity': /&#?[\da-z]{1,8};/i }; Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = - Prism.languages.markup['entity']; + Prism.languages.markup['entity']; // Plugin to make entity title show the real entity, idea by Roman Komarov Prism.hooks.add('wrap', function(env) { - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); - } + if (env.type === 'entity') { + env.attributes['title'] = env.content.replace(/&/, '&'); + } +}); + +Object.defineProperty(Prism.languages.markup.tag, 'addInlined', { + /** + * Adds an inlined language to markup. + * + * An example of an inlined language is CSS with `