Merge pull request #1397 from MasterEnoc/redux

Update Redux to 4.0.5
pull/1402/head
Simon Legner 4 years ago committed by GitHub
commit 296a7e03e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

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

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

@ -1,28 +1,34 @@
module Docs module Docs
class Redux < UrlScraper class Redux < UrlScraper
self.type = 'simple' self.type = 'simple'
self.release = '3.7.2' self.base_url = 'https://redux.js.org/api'
self.base_url = 'http://redux.js.org/docs/' self.root_path = 'index.html'
self.links = { self.links = {
home: 'http://redux.js.org/', 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 options[:attribution] = <<-HTML
&copy; 2015&ndash;2017 Dan Abramov<br> &copy; 2015&ndash;2020 Dan Abramov<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
stub '' do version do
request_one('http://redux.js.org/index.html').body self.release = '4.0.5'
end
version '3' do
self.release = '3.7.2'
end end
def get_latest_version(opts) def get_latest_version(opts)
get_npm_version('redux', opts) get_npm_version('redux', opts)
end end
end end
end end

Loading…
Cancel
Save