mirror of https://github.com/freeCodeCamp/devdocs
parent
444e67d233
commit
7b358f6f28
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,9 @@
|
||||
#= require views/pages/base
|
||||
|
||||
class app.views.ReactPage extends app.views.BasePage
|
||||
afterRender: ->
|
||||
for el in @findAllByTag 'pre'
|
||||
switch el.getAttribute('data-lang')
|
||||
when 'html' then @highlightCode el, 'markup'
|
||||
when 'javascript' then @highlightCode el, 'javascript'
|
||||
return
|
@ -0,0 +1,8 @@
|
||||
._react {
|
||||
> h2 { @extend %block-heading; }
|
||||
> h3 { @extend %block-label, %label-blue; }
|
||||
> h4 { font-size: 1em; }
|
||||
|
||||
code { @extend %label; }
|
||||
blockquote { @extend %note; }
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
module Docs
|
||||
class React
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css('.inner-content')
|
||||
|
||||
if root_page?
|
||||
at_css('h1').content = 'React Documentation'
|
||||
end
|
||||
|
||||
css('.docs-prevnext', '.hash-link', '.edit-page-link').remove
|
||||
|
||||
css('a.anchor').each do |node|
|
||||
node.parent['id'] = node['name']
|
||||
end
|
||||
|
||||
css('.highlight').each do |node|
|
||||
node.name = 'pre'
|
||||
node['data-lang'] = node.at_css('[data-lang]')['data-lang']
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
css('blockquote > p:first-child').each do |node|
|
||||
node.remove if node.content.strip == 'Note:'
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,34 @@
|
||||
module Docs
|
||||
class React
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
API_SLUGS = %w(
|
||||
top-level-api
|
||||
component-api
|
||||
component-specs
|
||||
)
|
||||
|
||||
def get_name
|
||||
at_css('h1').child.content
|
||||
end
|
||||
|
||||
def get_type
|
||||
link = at_css('.nav-docs-section .active')
|
||||
section = link.ancestors('.nav-docs-section').first
|
||||
section.at_css('h3').content
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless API_SLUGS.include?(slug)
|
||||
|
||||
css('.inner-content h3, .inner-content h4').map do |node|
|
||||
name = node.content
|
||||
name.remove! %r{[#\(\)]}
|
||||
name.remove! %r{\w+\:}
|
||||
id = node.at_css('.anchor')['name']
|
||||
type = slug.include?('component') ? 'Component' : 'React'
|
||||
[name, id, type]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,23 @@
|
||||
module Docs
|
||||
class React < UrlScraper
|
||||
self.name = 'React'
|
||||
self.type = 'react'
|
||||
self.version = '0.12.2'
|
||||
self.base_url = 'http://facebook.github.io/react/docs/'
|
||||
self.root_path = 'getting-started.html'
|
||||
|
||||
html_filters.push 'react/entries', 'react/clean_html'
|
||||
|
||||
options[:container] = '.documentationContent'
|
||||
|
||||
options[:skip] = %w(
|
||||
videos.html
|
||||
complementary-tools.html
|
||||
examples.html)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2013–2014 Facebook Inc.<br>
|
||||
Licensed under the Creative Commons Attribution 4.0 International Public License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 830 B |
@ -0,0 +1 @@
|
||||
https://github.com/facebook/react/blob/master/docs/img/logo.svg
|
Loading…
Reference in new issue