mirror of https://github.com/freeCodeCamp/devdocs
commit
296a7e03e2
@ -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,34 @@
|
||||
module Docs
|
||||
class Redux < UrlScraper
|
||||
|
||||
self.type = 'simple'
|
||||
self.release = '3.7.2'
|
||||
self.base_url = 'http://redux.js.org/docs/'
|
||||
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
|
||||
© 2015–2017 Dan Abramov<br>
|
||||
© 2015–2020 Dan Abramov<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
|
||||
stub '' do
|
||||
request_one('http://redux.js.org/index.html').body
|
||||
version do
|
||||
self.release = '4.0.5'
|
||||
end
|
||||
|
||||
version '3' do
|
||||
self.release = '3.7.2'
|
||||
end
|
||||
|
||||
def get_latest_version(opts)
|
||||
get_npm_version('redux', opts)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in new issue