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
623623 'https://raw.githubusercontent.com/npm/npm/master/LICENSE'
624624 ], [
625625 'NumPy',
626− '2005-2021 NumPy Developers',
626+ '2005-2022 NumPy Developers',
627627 'BSD',
628628 'https://raw.githubusercontent.com/numpy/numpy/master/LICENSE.txt'
629629 ], [
lib/docs/filters/numpy/entries.rb+11−7
@@ -5,9 +5,9 @@ module Docs · 4 unmodified lines
55 if dt = at_css('dt')
66 name = dt_to_name(dt)
77 else
8− name = at_css('h1').content.strip
8+ name = at_xpath('//h1/text()').text.strip
99 end
10− name.remove! "\u{00B6}"
10+ name.remove! %r{#\Z}
1111 name
1212 end
1313
@@ -18,8 +18,12 @@ module Docs · 4 unmodified lines
1818 elsif slug.start_with?('dev')
1919 return 'Development'
2020 end
21− li_a = css('nav li.active > a')
22− return li_a.last.content if li_a && li_a.last
21+ if css('nav li.toctree-l2.active .toctree-l3').length > 7
22+ 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
2327 end
2428
2529 nav_items = css('.nav.nav-pills.pull-left > li')
@@ -29,8 +33,8 @@ module Docs · 3 unmodified lines
2933 elsif nav_items[4] && nav_items[4].content !~ /Manual|Reference/
3034 type = nav_items[4].content
3135 else
32− type = at_css('h1').content.strip
33− type.remove! "\u{00B6}"
36+ type = at_xpath('//h1/text()').text.strip
37+ type.remove! %r{#\Z}
3438
3539 # Handle some edge cases that aren't properly categorized in the docs
3640 if type.start_with?('numpy.polynomial.') || type.start_with?('numpy.poly1d.')
@@ -90,7 +94,7 @@ module Docs · 53 unmodified lines
9094 name.remove! %r{[\=\[].*}
9195 name.remove! %r{\A(class(method)?|exception) }
9296 name.remove! %r{\s—.*}
93− name.remove! '¶'
97+ name.remove! %r{#\Z}
9498 end
9599 end
96100 end
lib/docs/scrapers/numpy.rb+9−3
@@ -22,18 +22,24 @@ module Docs · 21 unmodified lines
2222 ]
2323
2424 options[:attribution] = <<-HTML
25− &copy; 2005&ndash;2021 NumPy Developers<br>
25+ &copy; 2005&ndash;2022 NumPy Developers<br>
2626 Licensed under the 3-clause BSD License.
2727 HTML
2828
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+
2935 version '1.22' do
30− self.release = '1.22.0'
36+ self.release = '1.22.4'
3137 self.base_url = "https://numpy.org/doc/#{self.version}/"
3238 options[:container] = nil
3339 end
3440
3541 version '1.21' do
36− self.release = '1.21.5'
42+ self.release = '1.21.6'
3743 self.base_url = "https://numpy.org/doc/#{self.version}/"
3844 options[:container] = nil
3945 end