From 9709283d59f78997169bc3a9a4aea55bf66f3aca Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 19 Nov 2020 21:41:01 +0100 Subject: [PATCH] numpy: add versions 1.18 and 1.19 --- .../javascripts/templates/pages/about_tmpl.coffee | 2 +- docs/file-scrapers.md | 6 ++++++ lib/docs/filters/numpy/entries.rb | 14 +++++++------- lib/docs/scrapers/numpy.rb | 13 ++++++++++++- public/icons/docs/numpy/SOURCE | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index ba9d3506..f1d9b70f 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -573,7 +573,7 @@ credits = [ 'https://raw.githubusercontent.com/npm/npm/master/LICENSE' ], [ 'NumPy', - '2005-2019 NumPy Developers', + '2005-2020 NumPy Developers', 'BSD', 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt' ], [ diff --git a/docs/file-scrapers.md b/docs/file-scrapers.md index c429aea9..50842f0d 100644 --- a/docs/file-scrapers.md +++ b/docs/file-scrapers.md @@ -108,6 +108,12 @@ $GS = '/usr/local/opt/ghostscript/bin/gs'; # GhostScript ## NumPy +```sh +mkdir --parent docs/numpy~$VERSION/; \ +curl https://numpy.org/doc/$VERSION/numpy-html.zip | \ +bsdtar --extract --file=- --directory=docs/numpy~$VERSION/ +``` + ## OCaml Download from https://www.ocaml.org/docs/ the HTML reference: diff --git a/lib/docs/filters/numpy/entries.rb b/lib/docs/filters/numpy/entries.rb index 3819d644..7cfaca77 100644 --- a/lib/docs/filters/numpy/entries.rb +++ b/lib/docs/filters/numpy/entries.rb @@ -14,10 +14,10 @@ module Docs def get_type nav_items = css('.nav.nav-pills.pull-left > li') - if nav_items[3] - type = nav_items[3].content - elsif nav_items[2] && nav_items[2].content !~ /Manual|Reference/ - type = nav_items[2].content + if nav_items[5] + type = nav_items[5].content + elsif nav_items[4] && nav_items[4].content !~ /Manual|Reference/ + type = nav_items[4].content else type = at_css('h1').content.strip type.remove! "\u{00B6}" @@ -29,7 +29,7 @@ module Docs type = 'Universal functions' elsif type.start_with?('numpy.nditer.') || type.start_with?('numpy.lib.Arrayterator.') || type.start_with?('numpy.flatiter.') type = 'Indexing routines' - elsif type.start_with?('numpy.record.') || type.start_with?('numpy.recarray.') || type.start_with?('numpy.broadcast.') || type.start_with?('numpy.matrix.') + elsif type.start_with?('numpy.record.') || type.start_with?('numpy.recarray.') || type.start_with?('numpy.broadcast.') || type.start_with?('numpy.matrix.') || type.start_with?('numpy.ma.') type = 'Standard array subclasses' elsif type.start_with?('numpy.busdaycalendar.') type = 'Datetime support functions' @@ -41,9 +41,9 @@ module Docs type = 'Data type objects' elsif type.start_with?('numpy.generic.') type = 'Scalars' - elsif type.start_with?('numpy.char.chararray.') || type.start_with?('numpy.core.defchararray.chararray.') + elsif type.start_with?('numpy.chararray.') || type.start_with?('numpy.char.chararray.') || type.start_with?('numpy.core.defchararray.chararray.') type = 'String operations' - elsif type == 'numpy.memmap.shape' + elsif type.start_with?('numpy.memmap.') type = 'Input and output' elsif type == 'numpy.poly1d.variable' type = 'Polynomials' diff --git a/lib/docs/scrapers/numpy.rb b/lib/docs/scrapers/numpy.rb index 0ebe38dc..080a0d28 100644 --- a/lib/docs/scrapers/numpy.rb +++ b/lib/docs/scrapers/numpy.rb @@ -17,14 +17,25 @@ module Docs options[:skip_patterns] = [ /.*(? + © 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License. HTML + version '1.19' do + self.release = '1.19.0' + self.base_url = "https://numpy.org/doc/#{self.version}/" + end + + version '1.18' do + self.release = '1.18.5' + self.base_url = "https://numpy.org/doc/#{self.version}/" + end + version '1.17' do self.release = '1.17.0' self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/" diff --git a/public/icons/docs/numpy/SOURCE b/public/icons/docs/numpy/SOURCE index 1c2bf035..709633f2 100644 --- a/public/icons/docs/numpy/SOURCE +++ b/public/icons/docs/numpy/SOURCE @@ -1 +1 @@ -https://github.com/numpy/numpy/blob/master/branding/icons/numpylogoicon.svg +https://github.com/numpy/numpy/blob/master/doc/source/_static/numpylogo.svg