From 4e1d561c078aba3f48c473987a86458af8910826 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 7 Feb 2020 20:04:16 +0100 Subject: [PATCH 0001/2435] bundle update ffi --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 473542b632..a73db0362e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,7 +26,7 @@ GEM eventmachine (1.2.7) execjs (2.7.0) exifr (1.3.6) - ffi (1.11.1) + ffi (1.12.2) fspath (3.1.2) highline (2.0.3) html-pipeline (2.12.0) From b1a143440f48d71edb78039e94e17f6d2e7dcb2c Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 7 Feb 2020 20:17:09 +0100 Subject: [PATCH 0002/2435] Fix get_latest_version for various scrapers --- lib/docs/scrapers/ansible.rb | 2 +- lib/docs/scrapers/dart.rb | 2 +- lib/docs/scrapers/gnuplot.rb | 6 ++++++ lib/docs/scrapers/pandas.rb | 4 +--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/docs/scrapers/ansible.rb b/lib/docs/scrapers/ansible.rb index 6826b393f3..5a19e39344 100644 --- a/lib/docs/scrapers/ansible.rb +++ b/lib/docs/scrapers/ansible.rb @@ -71,7 +71,7 @@ class Ansible < UrlScraper def get_latest_version(opts) doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts) - doc.at_css('.DocSiteProduct-CurrentVersion').content.strip + doc.at_css('.version').content.strip end end end diff --git a/lib/docs/scrapers/dart.rb b/lib/docs/scrapers/dart.rb index e3b8c28998..4522762b1a 100644 --- a/lib/docs/scrapers/dart.rb +++ b/lib/docs/scrapers/dart.rb @@ -33,7 +33,7 @@ class Dart < FileScraper def get_latest_version(opts) doc = fetch_doc('https://api.dartlang.org/', opts) label = doc.at_css('footer > span').content.strip - label.sub(/Dart /, '') + label.sub(/Dart\s*/, '') end end end diff --git a/lib/docs/scrapers/gnuplot.rb b/lib/docs/scrapers/gnuplot.rb index 0682ade4b3..d6d5b1955a 100644 --- a/lib/docs/scrapers/gnuplot.rb +++ b/lib/docs/scrapers/gnuplot.rb @@ -37,5 +37,11 @@ class Gnuplot < FileScraper Distributed under the gnuplot license (rights to distribute modified versions are withheld). HTML + def get_latest_version(opts) + doc = fetch_doc('http://www.gnuplot.info/download.html', opts) + label = doc.at_css('h2').content.strip + label.sub(/[^0-9.]*/, '') + end + end end diff --git a/lib/docs/scrapers/pandas.rb b/lib/docs/scrapers/pandas.rb index e333da7f6a..fedba47b26 100644 --- a/lib/docs/scrapers/pandas.rb +++ b/lib/docs/scrapers/pandas.rb @@ -62,9 +62,7 @@ class Pandas < UrlScraper end def get_latest_version(opts) - doc = fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', opts) - label = doc.at_css('.body > .section > p').content - label.scan(/Version: ([0-9.]+)/)[0][0] + get_latest_github_release('pandas-dev', 'pandas', opts) end end end From c25fbb4b3c8d61802fca38e175373ce26b491b09 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 7 Feb 2020 20:23:56 +0100 Subject: [PATCH 0003/2435] doc.fetch: read GITHUB_TOKEN also from ENV --- lib/docs/core/doc.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/docs/core/doc.rb b/lib/docs/core/doc.rb index a5268300db..9461120821 100644 --- a/lib/docs/core/doc.rb +++ b/lib/docs/core/doc.rb @@ -220,6 +220,8 @@ def fetch(url, opts) if opts.key?(:github_token) and url.start_with?('https://api.github.com/') headers['Authorization'] = "token #{opts[:github_token]}" + elsif ENV['GITHUB_TOKEN'] and url.start_with?('https://api.github.com/') + headers['Authorization'] = "token #{ENV['GITHUB_TOKEN']}" end opts[:logger].debug("Fetching #{url}") From e75655ac086c2f1c9dd9d05dc6c7b81ba45e5748 Mon Sep 17 00:00:00 2001 From: Mark Knol Date: Thu, 20 Feb 2020 11:41:43 +0100 Subject: [PATCH 0004/2435] Update haxe.rb --- lib/docs/scrapers/haxe.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/docs/scrapers/haxe.rb b/lib/docs/scrapers/haxe.rb index 2dbab01ad8..892085be3a 100644 --- a/lib/docs/scrapers/haxe.rb +++ b/lib/docs/scrapers/haxe.rb @@ -2,7 +2,7 @@ module Docs class Haxe < UrlScraper self.name = 'Haxe' self.type = 'simple' - self.release = '3.4.7' + self.release = '4.0.5' self.base_url = 'https://api.haxe.org/' html_filters.push 'haxe/clean_html', 'haxe/entries' @@ -10,7 +10,7 @@ class Haxe < UrlScraper options[:container] = '.span9' options[:attribution] = <<-HTML - © 2005–2018 Haxe Foundation
+ © 2005–2020 Haxe Foundation
Licensed under a MIT license. HTML @@ -20,7 +20,7 @@ class Haxe < UrlScraper code: 'https://github.com/HaxeFoundation/haxe' } - options[:skip_patterns] = [/\A(?:cpp|cs|flash|java|js|neko|php|python|lua|hl|sys)/i] + options[:skip_patterns] = [/\A(?:cpp|cs|flash|java|js|neko|php|python|lua|hl|sys|eval)/i] end version 'C++' do @@ -67,6 +67,10 @@ class Haxe < UrlScraper self.base_url = 'https://api.haxe.org/python/' end + version 'Eval' do + self.base_url = 'https://api.haxe.org/eval/' + end + def get_latest_version(opts) doc = fetch_doc('https://api.haxe.org/', opts) label = doc.at_css('.container.main-content h1 > small').content From 89ca063d86401efb18036acffc868414846bd3d9 Mon Sep 17 00:00:00 2001 From: Daniel Worrall Date: Fri, 6 Mar 2020 21:12:38 +0000 Subject: [PATCH 0005/2435] Update crystal 0.33 --- lib/docs/scrapers/crystal.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/docs/scrapers/crystal.rb b/lib/docs/scrapers/crystal.rb index 7813b848ab..12e131dd9a 100644 --- a/lib/docs/scrapers/crystal.rb +++ b/lib/docs/scrapers/crystal.rb @@ -25,6 +25,32 @@ class Crystal < UrlScraper end } + version '0.33' do + self.release = '0.33.0' + self.root_path = "api/#{release}/index.html" + + options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] + options[:skip_patterns] = [/debug/i] + + options[:replace_paths] = { + "api/#{release}/" => "api/#{release}/index.html", + 'docs/' => 'docs/index.html' + } + end + + version '0.32' do + self.release = '0.32.1' + self.root_path = "api/#{release}/index.html" + + options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] + options[:skip_patterns] = [/debug/i] + + options[:replace_paths] = { + "api/#{release}/" => "api/#{release}/index.html", + 'docs/' => 'docs/index.html' + } + end + version '0.31' do self.release = '0.31.1' self.root_path = "api/#{release}/index.html" From c55dc57e64501551c7d8868ca9f3140c58a2c071 Mon Sep 17 00:00:00 2001 From: Ignas Kiela Date: Thu, 2 Apr 2020 20:08:57 +0300 Subject: [PATCH 0006/2435] Update Godot versions Godot 3.2 released Jan 29th After discussion in IRC remove 3.0 and 3.1 docs as almost nobody uses 3.0 anymore and 3.2 docs are mostly compatable with 3.1 --- lib/docs/scrapers/godot.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/docs/scrapers/godot.rb b/lib/docs/scrapers/godot.rb index 1ccf693f14..e5c50154d6 100644 --- a/lib/docs/scrapers/godot.rb +++ b/lib/docs/scrapers/godot.rb @@ -28,18 +28,13 @@ class Godot < UrlScraper end end - version '3.1' do - self.release = '3.1.1' - self.base_url = "http://docs.godotengine.org/en/#{self.version}/" - end - - version '3.0' do - self.release = '3.0.6' + version '3.2' do + self.release = '3.2.1' self.base_url = "http://docs.godotengine.org/en/#{self.version}/" end version '2.1' do - self.release = '2.1' + self.release = '2.1.6' self.base_url = "http://docs.godotengine.org/en/#{self.version}/" end From 6c9f765c046beb851feaa86953b1ff194bd9eb09 Mon Sep 17 00:00:00 2001 From: Daniel Worrall Date: Mon, 11 May 2020 21:24:48 +0100 Subject: [PATCH 0007/2435] Add crystal 0.34 --- lib/docs/scrapers/crystal.rb | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/docs/scrapers/crystal.rb b/lib/docs/scrapers/crystal.rb index 12e131dd9a..0a14ab4372 100644 --- a/lib/docs/scrapers/crystal.rb +++ b/lib/docs/scrapers/crystal.rb @@ -25,21 +25,8 @@ class Crystal < UrlScraper end } - version '0.33' do - self.release = '0.33.0' - self.root_path = "api/#{release}/index.html" - - options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] - options[:skip_patterns] = [/debug/i] - - options[:replace_paths] = { - "api/#{release}/" => "api/#{release}/index.html", - 'docs/' => 'docs/index.html' - } - end - - version '0.32' do - self.release = '0.32.1' + version '0.34' do + self.release = '0.34.0' self.root_path = "api/#{release}/index.html" options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] @@ -51,21 +38,8 @@ class Crystal < UrlScraper } end - version '0.31' do - self.release = '0.31.1' - self.root_path = "api/#{release}/index.html" - - options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] - options[:skip_patterns] = [/debug/i] - - options[:replace_paths] = { - "api/#{release}/" => "api/#{release}/index.html", - 'docs/' => 'docs/index.html' - } - end - - version '0.30' do - self.release = '0.30.1' + version '0.33' do + self.release = '0.33.0' self.root_path = "api/#{release}/index.html" options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//] From f4b66063ac8a235b228a82b5bfd318bc03b05c8a Mon Sep 17 00:00:00 2001 From: Aymen Hosni Date: Sat, 16 May 2020 03:00:17 +0100 Subject: [PATCH 0008/2435] Add documentation for Spring Boot --- .../templates/pages/about_tmpl.coffee | 5 ++++ lib/docs/filters/spring_boot/clean_html.rb | 15 ++++++++++ lib/docs/filters/spring_boot/entries.rb | 21 +++++++++++++ lib/docs/scrapers/spring_boot.rb | 28 ++++++++++++++++++ public/icons/docs/spring_boot/16.png | Bin 0 -> 2781 bytes public/icons/docs/spring_boot/16@2x.png | Bin 0 -> 4929 bytes public/icons/docs/spring_boot/SOURCE | 1 + 7 files changed, 70 insertions(+) create mode 100644 lib/docs/filters/spring_boot/clean_html.rb create mode 100644 lib/docs/filters/spring_boot/entries.rb create mode 100644 lib/docs/scrapers/spring_boot.rb create mode 100644 public/icons/docs/spring_boot/16.png create mode 100644 public/icons/docs/spring_boot/16@2x.png create mode 100644 public/icons/docs/spring_boot/SOURCE diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 8ac93ed428..b86ab6e6cc 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -821,5 +821,10 @@ credits = [ '2008-2017 by Yii Software LLC', 'BSD', 'https://raw.githubusercontent.com/yiisoft/yii/master/LICENSE' + ], [ + 'Spring Boot', + '2002 - 2020 Pivotal, Inc. All Rights Reserved.', + 'Apache License 2.0', + 'https://raw.githubusercontent.com/spring-projects/spring-boot/master/LICENSE.txt' ] ] diff --git a/lib/docs/filters/spring_boot/clean_html.rb b/lib/docs/filters/spring_boot/clean_html.rb new file mode 100644 index 0000000000..eb1639d335 --- /dev/null +++ b/lib/docs/filters/spring_boot/clean_html.rb @@ -0,0 +1,15 @@ +module Docs + class SpringBoot + class CleanHtmlFilter < Filter + def call + + css('pre').each do |node| + language = node.children.first['data-lang'] if node.children.first.name == 'code' + node['data-language'] = language + end + + doc + end + end + end +end diff --git a/lib/docs/filters/spring_boot/entries.rb b/lib/docs/filters/spring_boot/entries.rb new file mode 100644 index 0000000000..f680902408 --- /dev/null +++ b/lib/docs/filters/spring_boot/entries.rb @@ -0,0 +1,21 @@ +module Docs + class SpringBoot + class EntriesFilter < Docs::EntriesFilter + + def get_type + slug.gsub('-', ' ').capitalize + end + + def additional_entries + css('td a[href], li a[href]').each_with_object [] do |node, entries| + next if root_page? + next if node['href'].start_with?('http') + name = node.content.strip + id = node['href'].remove('#') + next if id.blank? + entries << [name, id, get_type] + end + end + end + end +end diff --git a/lib/docs/scrapers/spring_boot.rb b/lib/docs/scrapers/spring_boot.rb new file mode 100644 index 0000000000..10792cb90d --- /dev/null +++ b/lib/docs/scrapers/spring_boot.rb @@ -0,0 +1,28 @@ +module Docs + class SpringBoot < UrlScraper + self.name = 'Spring Boot' + self.slug = 'spring_boot' + self.type = 'simple' + self.release = '2.3.0.RELEASE' + self.base_url = 'https://docs.spring.io/spring-boot/docs/current/reference/html/' + self.root_path = "index.html" + self.links = { + home: 'https://spring.io/', + code: 'https://github.com/spring-projects/spring-boot' + } + + html_filters.push 'spring_boot/entries', 'spring_boot/clean_html' + + options[:skip_patterns] = [/legal/] + + options[:attribution] = <<-HTML + Copyright © 2002 - 2020 Pivotal, Inc. All Rights Reserved. + HTML + + def get_latest_version(opts) + doc = fetch_doc('https://docs.spring.io/spring-boot/docs/current/reference/html/legal.html', opts) + table = doc.at_css('#content p').inner_text + end + + end +end diff --git a/public/icons/docs/spring_boot/16.png b/public/icons/docs/spring_boot/16.png new file mode 100644 index 0000000000000000000000000000000000000000..8668b90404ad6f76e51eeff3ba4b3d34ec2e3615 GIT binary patch literal 2781 zcmV<33L^E1P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvvg9ZX{O1&N1dsrUo&+=XtSL=V{#B6NDi~%llRG zS)VZ;K0df)xbi%1^vsZ+joiKQ`tg)J`|VLljME->{%n-`?!=_>sA@SI)w6J^a&CXC zwVU~Fo(2RcwE#g()Y-9JPu&{uzBBHCr{joqc8y?-+0EGufIJ=V2GBkN^aS$NGq331 zy%+E)pK*S{G9HZ3`RjxWFXMcRp+~`dYedfzTCKbt=iFm79i#8lWgmfPJQlUUcGoso zSO7V%&mu0t9nhC`C0uH=t)RTwY74IFk|VG(jPtI!?1t;Bt*$~vPn`rUQ6*ku%0h`M zICAXg6)@mJpavz$GrYwJDNWhlduK!x}B7<~q4q!>AFtws13? zgvl8gBk#btOa@@kG&!^Cyr;?B;^wG8jWeAjG9^Gs^_sT~M^t2{qS% zZozCB%C2td8H&~cdX5|fwLoESl#-X)iw_QUK#Q(dJG+RdZg_388wOQLc8v!6*VcSC z@m0$Q0w2;+G*|dq*&>qy)VddpoVf}2X-(@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!32;bRa{vGf6951U69E94oEQKA00(qQO+^Rf z1rHYz5<{lgd;kCfqe(HI}^QFL3&=A5%lOk;noX_oeV zpW{tB>ZtwR9UeZMbH3m62pe?ro1QT6B5(pY2&8IHdEh(XOW^wHzR|Vgmpkg}oXDzd zfK$K+z#Bl4%~b?0_|{&Gh2t-+tSt@82KZCpH9*)xRs+8!_SDT>rq}uQ?pH_M+Snfg zN45eL#oB;mH0>Pj80bpHc2_4$<2e_2894q#7gY6eZN$-7I6;S((?i*QX>G{z$S>EW z<824s+Ri%wR4tAPX(rLG>3AE7`W@7{5w_QRWD-w{7tI*QxTspfPCbng?|@r#8>^P& zww>Dd?AzLz>XwKb-PDUfeM;qg;6+=VczAop1w2KGhU41bbxNOWe!*{?Kj zR4jvt6E*8QcQohpndI|Z!iDAg`djfAO*do(Ah2tz1}LD=+K?3^|Igo@o3PiWKDYZ) zIkPPklR$lDSEgs&+J&8{_~lKbTc{NEhX>bmvNW!*w7)646YT=<&q|)D(v49U_(H_= zP87zPbGv%AG2$^-`I`reQ#x51=l;TNZHeunfB*YtXMC>!RQ(Fy|8ZsJX7Q&X7Z?%b z((>y3sjIin>ci?BOVv5*-Kg$u+Q*U3lag)f64!*J;+M7X@E)W0zP2~=Bj=}=e*aMb z4iD{Wey97RK_lka literal 0 HcmV?d00001 diff --git a/public/icons/docs/spring_boot/16@2x.png b/public/icons/docs/spring_boot/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..cfaf4d833017ab93f49dd8946b76321908b9f09c GIT binary patch literal 4929 zcmV-H6Ta+;P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3#rlH58Dg#Ysta|DqfxEzOT#N1$xKOZP{^=A9I zC#K~psU(U7kU%17xBm0*?f%7|T;+06b4fL&i@#W74ULO(-GB9b`zxOB^B0~+{Qh*` zy&eQ^31_)~=Jt$l+}HOP-q!H_^L*`DJLwoMamsqAJMqK>zf!8nh<+V)sxUjq|3ZEa$aJ6sl zJfFR1*?ZmIwU~%#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zfD>9{#59lcf#bk-V5_ApyD#0P-#q#=cSYGZT~J)?I;C#*x6(b-rc#-H4T8@K%8bY( zrY62b78QR{l|(BoTRY=ETYKuN*?V@oeAv1_rU6ZX# zxZSGWv{w9&}#Xtz}s3`n+556t+xLElsjuOZLZ1uG(R-0@VU7^ej=GSOXA^#*?H<$ zgq?_+jLmYV;yIs-EEvb?Qa~ma<(-+ZHJ0nv6T_4lz*_5Mq$ zFWsqa?I@oWtOt47h}$>1G1&my>JIYtKbErd*^8%MJM!Y@urK;*f4X}~d+Lf(N-I~g z`h4d}{c+ndT*)XA5tKrW1kh595D!80C_Bpe Date: Mon, 18 May 2020 09:06:18 -0400 Subject: [PATCH 0009/2435] Console docs for --all --- lib/tasks/docs.thor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor index 4e7cbcced1..65f6298075 100644 --- a/lib/tasks/docs.thor +++ b/lib/tasks/docs.thor @@ -119,7 +119,7 @@ class DocsCLI < Thor puts 'Done' end - desc 'download ( ... | --default | --installed)', 'Download documentations' + desc 'download ( ... | --default | --installed | --all)', 'Download documentations' option :default, type: :boolean option :installed, type: :boolean option :all, type: :boolean From fd5b25c92adb80c2b39431f8fc9d993d99886b8d Mon Sep 17 00:00:00 2001 From: Rick Mac Gillis <8941225+rickmacgillis@users.noreply.github.com> Date: Mon, 18 May 2020 09:07:50 -0400 Subject: [PATCH 0010/2435] Document thor docs:download --all --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63d31ddcea..cecd562787 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ bundle exec rackup Finally, point your browser at [localhost:9292](http://localhost:9292) (the first request will take a few seconds to compile the assets). You're all set. -The `thor docs:download` command is used to download pre-generated documentations from DevDocs's servers (e.g. `thor docs:download html css`). You can see the list of available documentations and versions by running `thor docs:list`. To update all downloaded documentations, run `thor docs:download --installed`. +The `thor docs:download` command is used to download pre-generated documentations from DevDocs's servers (e.g. `thor docs:download html css`). You can see the list of available documentations and versions by running `thor docs:list`. To update all downloaded documentations, run `thor docs:download --installed`. To download and install all documentation this project has available, run `thor docs:download --all`. **Note:** there is currently no update mechanism other than `git pull origin master` to update the code and `thor docs:download --installed` to download the latest version of the docs. To stay informed about new releases, be sure to [watch](https://github.com/freeCodeCamp/devdocs/subscription) this repository. From 7ce6008b91896c3162047cf2169bb0d66f4152a3 Mon Sep 17 00:00:00 2001 From: David Chen Date: Sat, 23 May 2020 12:47:37 -0700 Subject: [PATCH 0011/2435] Add ruby 2.7.1 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 3a2b8b7619..8dab6bf420 100644 --- a/lib/docs/scrapers/rdoc/ruby.rb +++ b/lib/docs/scrapers/rdoc/ruby.rb @@ -69,6 +69,10 @@ class Ruby < Rdoc Licensed under their own licenses. HTML + version '2.7' do + self.release = '2.7.1' + end + version '2.6' do self.release = '2.6.3' end From db0746c16ebc2cae9499011abb79e8f918f2ac54 Mon Sep 17 00:00:00 2001 From: Antoine Pietri Date: Sun, 24 May 2020 11:42:28 +0200 Subject: [PATCH 0012/2435] Add documentation for OCaml --- .../templates/pages/about_tmpl.coffee | 5 + assets/javascripts/vendor/prism.js | 5698 +++++++++-------- docs/file-scrapers.md | 12 + lib/docs/filters/ocaml/clean_html.rb | 13 + lib/docs/filters/ocaml/entries.rb | 65 + lib/docs/scrapers/ocaml.rb | 28 + public/icons/docs/ocaml/16.png | Bin 0 -> 606 bytes public/icons/docs/ocaml/16@2x.png | Bin 0 -> 1183 bytes public/icons/docs/ocaml/SOURCE | 2 + 9 files changed, 3132 insertions(+), 2691 deletions(-) create mode 100644 lib/docs/filters/ocaml/clean_html.rb create mode 100644 lib/docs/filters/ocaml/entries.rb create mode 100644 lib/docs/scrapers/ocaml.rb create mode 100644 public/icons/docs/ocaml/16.png create mode 100644 public/icons/docs/ocaml/16@2x.png create mode 100644 public/icons/docs/ocaml/SOURCE diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 8ac93ed428..1b8082dcfd 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -541,6 +541,11 @@ credits = [ '2005-2019 NumPy Developers', 'BSD', 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt' + ], [ + 'OCaml', + '1995-2020 Inria', + 'CC BY-SA', + 'https://ocaml.org/docs/' ], [ 'Octave', '1996-2018 John W. Eaton', diff --git a/assets/javascripts/vendor/prism.js b/assets/javascripts/vendor/prism.js index 86fbb0743b..608f999c94 100644 --- a/assets/javascripts/vendor/prism.js +++ b/assets/javascripts/vendor/prism.js @@ -1,12 +1,12 @@ -/* PrismJS 1.19.0 -https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+c+cpp+coffeescript+crystal+d+dart+django+elixir+erlang+go+groovy+java+json+julia+kotlin+lua+markup-templating+matlab+nginx+nim+perl+php+python+jsx+ruby+rust+scss+shell-session+sql+typescript+yaml */ +/* PrismJS 1.20.0 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+c+cpp+coffeescript+crystal+d+dart+django+elixir+erlang+go+groovy+java+json+julia+kotlin+lua+markup-templating+matlab+nginx+nim+ocaml+perl+php+python+jsx+ruby+rust+scss+shell-session+sql+typescript+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 @@ -22,591 +22,695 @@ 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] ? 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]; + manual: _self.Prism && _self.Prism.manual, + disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, + util: { + encode: function encode(tokens) { + if (tokens instanceof Token) { + return new Token(tokens.type, encode(tokens.content), tokens.alias); + } else if (Array.isArray(tokens)) { + return tokens.map(encode); + } else { + return tokens.replace(/&/g, '&').replace(/' + env.content + ''; +}; - run: function (name, env) { - var callbacks = _.hooks.all[name]; +/** + * @param {string} text + * @param {LinkedList} tokenList + * @param {any} grammar + * @param {LinkedListNode} startNode + * @param {number} startPos + * @param {boolean} [oneshot=false] + * @param {string} [target] + */ +function matchGrammar(text, tokenList, grammar, startNode, startPos, oneshot, target) { + for (var token in grammar) { + if (!grammar.hasOwnProperty(token) || !grammar[token]) { + continue; + } + + var patterns = grammar[token]; + patterns = Array.isArray(patterns) ? patterns : [patterns]; + + for (var j = 0; j < patterns.length; ++j) { + if (target && target == token + ',' + j) { + return; + } + + var pattern = patterns[j], + inside = pattern.inside, + lookbehind = !!pattern.lookbehind, + greedy = !!pattern.greedy, + lookbehindLength = 0, + alias = pattern.alias; + + if (greedy && !pattern.pattern.global) { + // Without the global flag, lastIndex won't work + var flags = pattern.pattern.toString().match(/[imsuy]*$/)[0]; + pattern.pattern = RegExp(pattern.pattern.source, flags + 'g'); + } + + pattern = pattern.pattern || pattern; + + for ( // iterate the token list and keep track of the current token/string position + var currentNode = startNode.next, pos = startPos; + currentNode !== tokenList.tail; + pos += currentNode.value.length, currentNode = currentNode.next + ) { + + var str = currentNode.value; + + if (tokenList.length > text.length) { + // Something went terribly wrong, ABORT, ABORT! + return; + } + + if (str instanceof Token) { + continue; + } + + var removeCount = 1; // this is the to parameter of removeBetween + + if (greedy && currentNode != tokenList.tail.prev) { + pattern.lastIndex = pos; + var match = pattern.exec(text); + if (!match) { + break; + } + + var from = match.index + (lookbehind && match[1] ? match[1].length : 0); + var to = match.index + match[0].length; + var p = pos; + + // find the node that contains the match + p += currentNode.value.length; + while (from >= p) { + currentNode = currentNode.next; + p += currentNode.value.length; + } + // adjust pos (and p) + p -= currentNode.value.length; + pos = p; + + // the current node is a Token, then the match starts inside another Token, which is invalid + if (currentNode.value instanceof Token) { + continue; + } + + // find the last node which is affected by this match + for ( + var k = currentNode; + k !== tokenList.tail && (p < to || (typeof k.value === 'string' && !k.prev.value.greedy)); + k = k.next + ) { + removeCount++; + p += k.value.length; + } + removeCount--; + + // replace with the new match + str = text.slice(pos, p); + match.index -= pos; + } else { + pattern.lastIndex = 0; + + var match = pattern.exec(str); + } + + 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 removeFrom = currentNode.prev; + + if (before) { + removeFrom = addAfter(tokenList, removeFrom, before); + pos += before.length; + } + + removeRange(tokenList, removeFrom, removeCount); + + var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy); + currentNode = addAfter(tokenList, removeFrom, wrapped); + + if (after) { + addAfter(tokenList, currentNode, after); + } + + + if (removeCount > 1) + matchGrammar(text, tokenList, grammar, currentNode.prev, pos, true, token + ',' + j); + + if (oneshot) + break; + } + } + } +} - if (!callbacks || !callbacks.length) { - return; - } +/** + * @typedef LinkedListNode + * @property {T} value + * @property {LinkedListNode | null} prev The previous node. + * @property {LinkedListNode | null} next The next node. + * @template T + */ - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - }, +/** + * @template T + */ +function LinkedList() { + /** @type {LinkedListNode} */ + var head = { value: null, prev: null, next: null }; + /** @type {LinkedListNode} */ + var tail = { value: null, prev: head, next: null }; + head.next = tail; + + /** @type {LinkedListNode} */ + this.head = head; + /** @type {LinkedListNode} */ + this.tail = tail; + this.length = 0; +} - Token: Token -}; +/** + * Adds a new node with the given value to the list. + * @param {LinkedList} list + * @param {LinkedListNode} node + * @param {T} value + * @returns {LinkedListNode} The added node. + * @template T + */ +function addAfter(list, node, value) { + // assumes that node != list.tail && values.length >= 0 + var next = node.next; -_self.Prism = _; + var newNode = { value: value, prev: node, next: next }; + node.next = newNode; + next.prev = newNode; + list.length++; -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; + return newNode; +} +/** + * Removes `count` nodes after the given node. The given node will not be removed. + * @param {LinkedList} list + * @param {LinkedListNode} node + * @param {number} count + * @template T + */ +function removeRange(list, node, count) { + var next = node.next; + for (var i = 0; i < count && next !== list.tail; i++) { + next = next.next; + } + node.next = next; + next.prev = node; + list.length -= i; +} +/** + * @param {LinkedList} list + * @returns {T[]} + * @template T + */ +function toArray(list) { + var array = []; + var node = list.head.next; + while (node !== list.tail) { + array.push(node.value); + node = node.next; + } + return array; } -Token.stringify = function(o, language) { - if (typeof o == 'string') { - return o; - } - - if (Array.isArray(o)) { - return o.map(function(element) { - return Token.stringify(element, language); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language - }; - - 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 _; + 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 = _.util.currentScript(); if (script) { - _.filename = script.src; + _.filename = script.src; + + if (script.hasAttribute('data-manual')) { + _.manual = true; + } +} - if (script.hasAttribute('data-manual')) { - _.manual = true; - } +function highlightAutomaticallyCallback() { + if (!_.manual) { + _.highlightAll(); + } } if (!_.manual) { - function highlightAutomaticallyCallback() { - if (!_.manual) { - _.highlightAll(); - } - } - - // If the document state is "loading", then we'll use DOMContentLoaded. - // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the - // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they - // might take longer one animation frame to execute which can create a race condition where only some plugins have - // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded. - // See https://github.com/PrismJS/prism/issues/2102 - var readyState = document.readyState; - if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) { - document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback); - } else { - if (window.requestAnimationFrame) { - window.requestAnimationFrame(highlightAutomaticallyCallback); - } else { - window.setTimeout(highlightAutomaticallyCallback, 16); - } - } + // If the document state is "loading", then we'll use DOMContentLoaded. + // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the + // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they + // might take longer one animation frame to execute which can create a race condition where only some plugins have + // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded. + // See https://github.com/PrismJS/prism/issues/2102 + var readyState = document.readyState; + if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) { + document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback); + } else { + if (window.requestAnimationFrame) { + window.requestAnimationFrame(highlightAutomaticallyCallback); + } else { + window.setTimeout(highlightAutomaticallyCallback, 16); + } + } } return _; @@ -614,642 +718,724 @@ 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': { - pattern: /"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:(?!)*\]\s*)?>/i, - greedy: true - }, - '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 + 'comment': //, + 'prolog': /<\?[\s\S]+?\?>/, + 'doctype': { + // https://www.w3.org/TR/xml/#NT-doctypedecl + pattern: /"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i, + greedy: true, + inside: { + 'internal-subset': { + pattern: /(\[)[\s\S]+(?=\]>$)/, + lookbehind: true, + greedy: true, + inside: null // see below + }, + 'string': { + pattern: /"[^"]*"|'[^']*'/, + greedy: true + }, + 'punctuation': /^$|[[\]]/, + 'doctype-tag': /^DOCTYPE/, + 'name': /[^\s<>'"]+/ + } + }, + 'cdata': //i, + 'tag': { + pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/, + greedy: true, + inside: { + 'tag': { + pattern: /^<\/?[^\s>\/]+/, + inside: { + 'punctuation': /^<\/?/, + 'namespace': /^[^\s>\/:]+:/ + } + }, + 'attr-value': { + pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/, + inside: { + 'punctuation': [ + { + pattern: /^=/, + alias: 'attr-equals' + }, + /"|'/ + ] + } + }, + 'punctuation': /\/?>/, + 'attr-name': { + pattern: /[^\s>\/]+/, + inside: { + 'namespace': /^[^\s>\/:]+:/ + } + } + + } + }, + 'entity': [ + { + pattern: /&[\da-z]{1,8};/i, + alias: 'named-entity' + }, + /&#x?[\da-f]{1,8};/i + ] }; Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = - Prism.languages.markup['entity']; + Prism.languages.markup['entity']; +Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup; // Plugin to make entity title show the real entity, idea by Roman Komarov -Prism.hooks.add('wrap', function(env) { +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 ` - - - """ - source.replace / +\ +` + ); + return source.replace(/ \ -` +`, ); return source.replace(/