History

Add Redux documentation

Thibaut Courouble committed 10 years ago

Commit 7ab53671 parent 8e35fa313 files · +98 −-3Browse files

Unified · Split

13 files
  1. assets/images/docs.png +0 −0
  2. assets/images/docs@2x.png +0 −0
  3. assets/javascripts/news.json +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/simple.coffee +1 −0
  6. assets/stylesheets/global/_icons.scss +1 −0
  7. assets/stylesheets/pages/_simple.scss +2 −0
  8. lib/docs/filters/redux/clean_html.rb +38 −0
  9. lib/docs/filters/redux/entries.rb +29 −0
  10. lib/docs/scrapers/redux.rb +24 −0
  11. public/icons/docs/redux/16.png +0 −0
  12. public/icons/docs/redux/16@2x.png +0 −0
  13. public/icons/docs/redux/SOURCE +1 −0
assets/images/docs.png+0−0

Binary file not shown.

assets/images/docs@2x.png+0−0

Binary file not shown.

assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
11 [
22 [
33 "2016-07-24",
4− "New documentations: <a href=\"/julia/\">Julia</a> and <a href=\"/crystal/\">Crystal</a>"
4+ "New documentations: <a href=\"/julia/\">Julia</a>, <a href=\"/crystal/\">Crystal</a> and <a href=\"/redux/\">Redux</a>"
55 ], [
66 "2016-07-03",
77 "New documentations: <a href=\"/cmake/\">CMake</a> and <a href=\"/matplotlib/\">Matplotlib</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -435,6 +435,11 @@ credits = [ · 434 unmodified lines
435435 '2009-2016 Salvatore Sanfilippo',
436436 'CC BY-SA',
437437 'https://creativecommons.org/licenses/by-sa/4.0/'
438+ ], [
439+ 'Redux',
440+ '2015-2016 Dan Abramov',
441+ 'MIT',
442+ 'https://raw.githubusercontent.com/reactjs/redux/master/LICENSE.md'
438443 ], [
439444 'RequireJS',
440445 'jQuery Foundation and other contributors',
assets/javascripts/views/pages/simple.coffee+1−0
@@ -37,6 +37,7 @@ app.views.PhpunitPage = · 36 unmodified lines
3737 app.views.PostgresPage =
3838 app.views.RamdaPage =
3939 app.views.ReactPage =
40+app.views.ReduxPage =
4041 app.views.RethinkdbPage =
4142 app.views.RubydocPage =
4243 app.views.SinonPage =
assets/stylesheets/global/_icons.scss+1−0
@@ -132,6 +132,7 @@ · 131 unmodified lines
132132 ._icon-q:before { background-position: -5rem -8rem; }
133133 ._icon-crystal:before { background-position: -6rem -8rem; @extend %darkIconFix !optional; }
134134 ._icon-julia:before { background-position: -7rem -8rem; @extend %darkIconFix !optional; }
135+._icon-redux:before { background-position: -8rem -8rem; @extend %darkIconFix !optional; }
135136 ._icon-react_native:before { background-position: 0 -9rem; }
136137 ._icon-phalcon:before { background-position: -1rem -9rem; }
137138 ._icon-matplotlib:before { background-position: -2rem -9rem; }
assets/stylesheets/pages/_simple.scss+2−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 p > code, li > code { @extend %label; }
1616 blockquote { @extend %note; }
17+ blockquote > h4, blockquote > h5 { margin-top: .25rem; }
1718 }
1819
1920 ._apache_pig,
@@ -29,6 +30,7 @@ · 9 unmodified lines
2930 ._markdown,
3031 ._mocha,
3132 ._mongoose,
33+._redux,
3234 ._sinon,
3335 ._typescript,
3436 ._webpack {
lib/docs/filters/redux/clean_html.rb+38−0
@@ -0,0 +1,38 @@
1+module Docs
2+ class Redux
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css('.page-inner > section')
6+
7+ css('#edit-link', 'hr').remove
8+
9+ at_css('h2').name = 'h1' unless at_css('h1')
10+
11+ if root_page?
12+ at_css('h1').content = 'Redux'
13+
14+ at_css('a[href="https://www.npmjs.com/package/redux"]').parent.remove
15+
16+ css('a[target]').each do |node|
17+ node.remove_attribute('target') unless node['href'].start_with?('http')
18+ end
19+ end
20+
21+ css('a[id]:empty').each do |node|
22+ (node.next_element || node.parent.next_element)['id'] = node['id']
23+ end
24+
25+ css('h1 > code').each do |node|
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+
34+ doc
35+ end
36+ end
37+ end
38+end
lib/docs/filters/redux/entries.rb+29−0
@@ -0,0 +1,29 @@
1+module Docs
2+ class Redux
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ name = at_css('.page-inner h1, .page-inner h2').content
6+ name.sub! %r{\(.*\)}, '()'
7+ name
8+ end
9+
10+ def get_type
11+ path = slug.split('/')
12+
13+ if path.length > 1
14+ path[0].titleize.sub('Api', 'API')
15+ else
16+ 'Miscellaneous'
17+ end
18+ end
19+
20+ def additional_entries
21+ css('#store-methods + ul > li > a').map do |node|
22+ id = node['href'].remove('#')
23+ name = "#{self.name}##{id}()"
24+ [name, id]
25+ end
26+ end
27+ end
28+ end
29+end
lib/docs/scrapers/redux.rb+24−0
@@ -0,0 +1,24 @@
1+module Docs
2+ class Redux < UrlScraper
3+ self.type = 'redux'
4+ self.release = '3.5.2'
5+ self.base_url = 'http://redux.js.org/docs/'
6+ self.links = {
7+ home: 'http://redux.js.org/',
8+ code: 'https://github.com/reactjs/redux/'
9+ }
10+
11+ html_filters.push 'redux/entries', 'redux/clean_html'
12+
13+ options[:skip] = %w(Feedback.html)
14+
15+ options[:attribution] = <<-HTML
16+ &copy; 2015&ndash;2016 Dan Abramov<br>
17+ Licensed under the MIT License.
18+ HTML
19+
20+ stub '' do
21+ request_one('http://redux.js.org/index.html').body
22+ end
23+ end
24+end
public/icons/docs/redux/16.png+0−0

Binary file not shown.

public/icons/docs/redux/16@2x.png+0−0

Binary file not shown.

public/icons/docs/redux/SOURCE+1−0
@@ -0,0 +1 @@
1+http://redux.js.org/gitbook/images/favicon.ico