History

Update Redux to 4.0.5

MasterEnoc committed 5 years ago

Commit 49f83fd1 parent a525a794 files · +39 −45Browse files

Unified · Split

4 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +1 −1
  2. lib/docs/filters/redux/clean_html.rb +14 −20
  3. lib/docs/filters/redux/entries.rb +15 −14
  4. lib/docs/scrapers/redux.rb +9 −10
assets/javascripts/templates/pages/about_tmpl.coffee+1−1
@@ -668,7 +668,7 @@ credits = [ · 667 unmodified lines
668 'https://creativecommons.org/licenses/by-sa/4.0/'668 'https://creativecommons.org/licenses/by-sa/4.0/'
669 ], [669 ], [
670 'Redux',670 'Redux',
671 '2015-2017 Dan Abramov',671 '2015-2020 Dan Abramov',
672 'MIT',672 'MIT',
673 'https://raw.githubusercontent.com/reactjs/redux/master/LICENSE.md'673 'https://raw.githubusercontent.com/reactjs/redux/master/LICENSE.md'
674 ], [674 ], [
lib/docs/filters/redux/clean_html.rb+14−20
@@ -2,36 +2,30 @@ module Docs · 1 unmodified line
2 class Redux2 class Redux
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 @doc = at_css('.page-inner section')
6 5
7 css('#edit-link', 'hr').remove6 css('h1, h2, h3, h4').each do |node|
8 7 node.css('a').remove
9 at_css('h2').name = 'h1' unless at_css('h1')8 end
10 9
11 if root_page?10 css('h3').each do |node|
12 at_css('h1').content = 'Redux'11 node['id'] = node.content.gsub(/\(|\)/, '').downcase
12 end
13 13
14 at_css('a[href="https://www.npmjs.com/package/redux"]').parent.remove14 css('.codeBlockLines_b7E3').each do |node|
15 node.remove_attribute('style')
16 node.name = 'pre'
17 node['data-language'] = 'javascript'
15 18
16 css('a[target]').each do |node|19 node.css('div, span').each do |subnode|
17 node.remove_attribute('target') unless node['href'].start_with?('http')20 subnode.remove_attribute('style')
18 end21 end
19 end
20 22
21 css('a[id]:empty').each do |node|
22 (node.next_element || node.parent.next_element)['id'] = node['id']
23 end23 end
24 24
25 css('h1 > code').each do |node|25 css('.copyButton_10dd').remove
26 node.before(node.children).remove
27 end
28
29 css('pre > code').each do |node|
30 node.parent['data-language'] = node['class'][/lang-(\w+)/, 1] if node['class']
31 node.parent.content = node.parent.content
32 end
33 26
34 doc27 doc
28
35 end29 end
36 end30 end
37 end31 end
lib/docs/filters/redux/entries.rb+15−14
@@ -1,29 +1,30 @@
1module Docs1module Docs
2 class Redux2 class Redux
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4
4 def get_name5 def get_name
5 name = at_css('.page-inner h1, .page-inner h2').content6 name = at_css('h1').content
6 name.sub! %r{\(.*\)}, '()'7 name.gsub(/\(.*\)/, '()')
7 name
8 end8 end
9 9
10 def get_type10 def get_type
11 path = slug.split('/')11 slug.match?(/\Astore\Z/) ? 'Store API' : 'Top-Level Exports'
12
13 if path.length > 1
14 path[0].titleize.sub('Api', 'API').sub('Faq', 'FAQ')
15 else
16 'Miscellaneous'
17 end
18 end12 end
19 13
20 def additional_entries14 def additional_entries
21 css('#store-methods + ul > li > a').map do |node|15 entries = []
22 id = node['href'].remove('#')16
23 name = "#{self.name}##{id}()"17 if slug.match?(/\Astore\Z/)
24 [name, id]18 css('h3').each do |node|
19 entry_path = node.content.gsub(/\(|\)/, '')
20 entry_name = node.content.gsub(/\(.*\)/, '()')
21 entries << [entry_name, entry_path.downcase, 'Store API']
22 end
25 end23 end
24
25 entries
26 end26 end
27
27 end28 end
28 end29 end
29end30end
lib/docs/scrapers/redux.rb+9−10
@@ -1,28 +1,27 @@
1module Docs1module Docs
2 class Redux < UrlScraper2 class Redux < UrlScraper
3
3 self.type = 'simple'4 self.type = 'simple'
4 self.release = '3.7.2'5 self.release = '4.0.5'
5 self.base_url = 'http://redux.js.org/docs/'6 self.base_url = 'https://redux.js.org/api'
7 self.root_path = 'index.html'
6 self.links = {8 self.links = {
7 home: 'http://redux.js.org/',9 home: 'http://redux.js.org/',
8 code: 'https://github.com/reactjs/redux/'10 code: 'https://github.com/reduxjs/redux/'
9 }11 }
10 12
11 html_filters.push 'redux/entries', 'redux/clean_html'13 html_filters.push 'redux/clean_html', 'redux/entries'
12 14
13 options[:skip] = %w(Feedback.html)15 options[:container] = '.markdown'
14 16
15 options[:attribution] = <<-HTML17 options[:attribution] = <<-HTML
16 &copy; 2015&ndash;2017 Dan Abramov<br>18 &copy; 2015&ndash;2020 Dan Abramov<br>
17 Licensed under the MIT License.19 Licensed under the MIT License.
18 HTML20 HTML
19 21
20 stub '' do
21 request_one('http://redux.js.org/index.html').body
22 end
23
24 def get_latest_version(opts)22 def get_latest_version(opts)
25 get_npm_version('redux', opts)23 get_npm_version('redux', opts)
26 end24 end
25
27 end26 end
28end27end