Update Redux to 4.0.5

pull/1397/head
MasterEnoc 4 years ago
parent a525a79d97
commit 49f83fdbad

@ -668,7 +668,7 @@ credits = [
'https://creativecommons.org/licenses/by-sa/4.0/'
], [
'Redux',
'2015-2017 Dan Abramov',
'2015-2020 Dan Abramov',
'MIT',
'https://raw.githubusercontent.com/reactjs/redux/master/LICENSE.md'
], [

@ -2,36 +2,30 @@ module Docs
class Redux
class CleanHtmlFilter < Filter
def call
@doc = at_css('.page-inner section')
css('#edit-link', 'hr').remove
at_css('h2').name = 'h1' unless at_css('h1')
if root_page?
at_css('h1').content = 'Redux'
at_css('a[href="https://www.npmjs.com/package/redux"]').parent.remove
css('a[target]').each do |node|
node.remove_attribute('target') unless node['href'].start_with?('http')
end
css('h1, h2, h3, h4').each do |node|
node.css('a').remove
end
css('a[id]:empty').each do |node|
(node.next_element || node.parent.next_element)['id'] = node['id']
css('h3').each do |node|
node['id'] = node.content.gsub(/\(|\)/, '').downcase
end
css('h1 > code').each do |node|
node.before(node.children).remove
css('.codeBlockLines_b7E3').each do |node|
node.remove_attribute('style')
node.name = 'pre'
node['data-language'] = 'javascript'
node.css('div, span').each do |subnode|
subnode.remove_attribute('style')
end
css('pre > code').each do |node|
node.parent['data-language'] = node['class'][/lang-(\w+)/, 1] if node['class']
node.parent.content = node.parent.content
end
css('.copyButton_10dd').remove
doc
end
end
end

@ -1,29 +1,30 @@
module Docs
class Redux
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('.page-inner h1, .page-inner h2').content
name.sub! %r{\(.*\)}, '()'
name
name = at_css('h1').content
name.gsub(/\(.*\)/, '()')
end
def get_type
path = slug.split('/')
if path.length > 1
path[0].titleize.sub('Api', 'API').sub('Faq', 'FAQ')
else
'Miscellaneous'
end
slug.match?(/\Astore\Z/) ? 'Store API' : 'Top-Level Exports'
end
def additional_entries
css('#store-methods + ul > li > a').map do |node|
id = node['href'].remove('#')
name = "#{self.name}##{id}()"
[name, id]
entries = []
if slug.match?(/\Astore\Z/)
css('h3').each do |node|
entry_path = node.content.gsub(/\(|\)/, '')
entry_name = node.content.gsub(/\(.*\)/, '()')
entries << [entry_name, entry_path.downcase, 'Store API']
end
end
entries
end
end
end
end

@ -1,28 +1,27 @@
module Docs
class Redux < UrlScraper
self.type = 'simple'
self.release = '3.7.2'
self.base_url = 'http://redux.js.org/docs/'
self.release = '4.0.5'
self.base_url = 'https://redux.js.org/api'
self.root_path = 'index.html'
self.links = {
home: 'http://redux.js.org/',
code: 'https://github.com/reactjs/redux/'
code: 'https://github.com/reduxjs/redux/'
}
html_filters.push 'redux/entries', 'redux/clean_html'
html_filters.push 'redux/clean_html', 'redux/entries'
options[:skip] = %w(Feedback.html)
options[:container] = '.markdown'
options[:attribution] = <<-HTML
&copy; 2015&ndash;2017 Dan Abramov<br>
&copy; 2015&ndash;2020 Dan Abramov<br>
Licensed under the MIT License.
HTML
stub '' do
request_one('http://redux.js.org/index.html').body
end
def get_latest_version(opts)
get_npm_version('redux', opts)
end
end
end

Loading…
Cancel
Save