History

Merge pull request #1827 from freeCodeCamp/numpy

Update NumPy documentation (1.23.0)

Simon Legner committed 4 years ago

Commit a6e101c2 parents 6745e65 526cc1a3 files · +21 −11Browse files

Unified · Split

3 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +1 −1
  2. lib/docs/filters/numpy/entries.rb +11 −7
  3. lib/docs/scrapers/numpy.rb +9 −3
assets/javascripts/templates/pages/about_tmpl.coffee+1−1
@@ -623,7 +623,7 @@ credits = [ · 622 unmodified lines
623 'https://raw.githubusercontent.com/npm/npm/master/LICENSE'623 'https://raw.githubusercontent.com/npm/npm/master/LICENSE'
624 ], [624 ], [
625 'NumPy',625 'NumPy',
626 '2005-2021 NumPy Developers',626 '2005-2022 NumPy Developers',
627 'BSD',627 'BSD',
628 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt'628 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt'
629 ], [629 ], [
lib/docs/filters/numpy/entries.rb+11−7
@@ -5,9 +5,9 @@ module Docs · 4 unmodified lines
5 if dt = at_css('dt')5 if dt = at_css('dt')
6 name = dt_to_name(dt)6 name = dt_to_name(dt)
7 else7 else
8 name = at_css('h1').content.strip8 name = at_xpath('//h1/text()').text.strip
9 end9 end
10 name.remove! "\u{00B6}"10 name.remove! %r{#\Z}
11 name11 name
12 end12 end
13 13
@@ -18,8 +18,12 @@ module Docs · 4 unmodified lines
18 elsif slug.start_with?('dev')18 elsif slug.start_with?('dev')
19 return 'Development'19 return 'Development'
20 end20 end
21 li_a = css('nav li.active > a')21 if css('nav li.toctree-l2.active .toctree-l3').length > 7
22 return li_a.last.content if li_a && li_a.last22 li_a = css('nav li.toctree-l2.active > a')
23 else
24 li_a = css('nav li.toctree-l1.active > a')
25 end
26 return li_a.last.xpath('./text()').text.remove('( )').strip if li_a && li_a.last
23 end27 end
24 28
25 nav_items = css('.nav.nav-pills.pull-left > li')29 nav_items = css('.nav.nav-pills.pull-left > li')
@@ -29,8 +33,8 @@ module Docs · 3 unmodified lines
29 elsif nav_items[4] && nav_items[4].content !~ /Manual|Reference/33 elsif nav_items[4] && nav_items[4].content !~ /Manual|Reference/
30 type = nav_items[4].content34 type = nav_items[4].content
31 else35 else
32 type = at_css('h1').content.strip36 type = at_xpath('//h1/text()').text.strip
33 type.remove! "\u{00B6}"37 type.remove! %r{#\Z}
34 38
35 # Handle some edge cases that aren't properly categorized in the docs39 # Handle some edge cases that aren't properly categorized in the docs
36 if type.start_with?('numpy.polynomial.') || type.start_with?('numpy.poly1d.')40 if type.start_with?('numpy.polynomial.') || type.start_with?('numpy.poly1d.')
@@ -90,7 +94,7 @@ module Docs · 53 unmodified lines
90 name.remove! %r{[\=\[].*}94 name.remove! %r{[\=\[].*}
91 name.remove! %r{\A(class(method)?|exception) }95 name.remove! %r{\A(class(method)?|exception) }
92 name.remove! %r{\s—.*}96 name.remove! %r{\s—.*}
93 name.remove! '¶'97 name.remove! %r{#\Z}
94 end98 end
95 end99 end
96 end100 end
lib/docs/scrapers/numpy.rb+9−3
@@ -22,18 +22,24 @@ module Docs · 21 unmodified lines
22 ]22 ]
23 23
24 options[:attribution] = <<-HTML24 options[:attribution] = <<-HTML
25 &copy; 2005&ndash;2021 NumPy Developers<br>25 &copy; 2005&ndash;2022 NumPy Developers<br>
26 Licensed under the 3-clause BSD License.26 Licensed under the 3-clause BSD License.
27 HTML27 HTML
28 28
29 version '1.23' do
30 self.release = '1.23.0'
31 self.base_url = "https://numpy.org/doc/#{self.version}/"
32 options[:container] = nil
33 end
34
29 version '1.22' do35 version '1.22' do
30 self.release = '1.22.0'36 self.release = '1.22.4'
31 self.base_url = "https://numpy.org/doc/#{self.version}/"37 self.base_url = "https://numpy.org/doc/#{self.version}/"
32 options[:container] = nil38 options[:container] = nil
33 end39 end
34 40
35 version '1.21' do41 version '1.21' do
36 self.release = '1.21.5'42 self.release = '1.21.6'
37 self.base_url = "https://numpy.org/doc/#{self.version}/"43 self.base_url = "https://numpy.org/doc/#{self.version}/"
38 options[:container] = nil44 options[:container] = nil
39 end45 end