mirror of https://github.com/freeCodeCamp/devdocs
parent
8e35fa3a2a
commit
7ab536743c
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 120 KiB |
@ -0,0 +1,38 @@
|
||||
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
|
||||
end
|
||||
|
||||
css('a[id]:empty').each do |node|
|
||||
(node.next_element || node.parent.next_element)['id'] = node['id']
|
||||
end
|
||||
|
||||
css('h1 > code').each do |node|
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
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
|
||||
end
|
||||
|
||||
def get_type
|
||||
path = slug.split('/')
|
||||
|
||||
if path.length > 1
|
||||
path[0].titleize.sub('Api', 'API')
|
||||
else
|
||||
'Miscellaneous'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('#store-methods + ul > li > a').map do |node|
|
||||
id = node['href'].remove('#')
|
||||
name = "#{self.name}##{id}()"
|
||||
[name, id]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,24 @@
|
||||
module Docs
|
||||
class Redux < UrlScraper
|
||||
self.type = 'redux'
|
||||
self.release = '3.5.2'
|
||||
self.base_url = 'http://redux.js.org/docs/'
|
||||
self.links = {
|
||||
home: 'http://redux.js.org/',
|
||||
code: 'https://github.com/reactjs/redux/'
|
||||
}
|
||||
|
||||
html_filters.push 'redux/entries', 'redux/clean_html'
|
||||
|
||||
options[:skip] = %w(Feedback.html)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2015–2016 Dan Abramov<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
|
||||
stub '' do
|
||||
request_one('http://redux.js.org/index.html').body
|
||||
end
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 622 B |
After Width: | Height: | Size: 877 B |
@ -0,0 +1 @@
|
||||
http://redux.js.org/gitbook/images/favicon.ico
|
Loading…
Reference in new issue