mirror of https://github.com/freeCodeCamp/devdocs
parent
7fa7c8fc3c
commit
8e469d340e
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,6 @@
|
||||
#= require views/pages/base
|
||||
|
||||
class app.views.D3Page extends app.views.BasePage
|
||||
afterRender: ->
|
||||
@highlightCode @findAll('.highlight > pre'), 'javascript'
|
||||
return
|
@ -0,0 +1,6 @@
|
||||
._d3 {
|
||||
> h2 { @extend %block-heading; }
|
||||
> h3, > h4 { font-size: 1rem; }
|
||||
> h6 { @extend %block-label, %label-blue; }
|
||||
code { @extend %label; }
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
module Docs
|
||||
class D3
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('#gollum-footer', '.markdown-body > blockquote:first-child', '.anchor').remove
|
||||
|
||||
# Replace #head with <h1>
|
||||
css('#head > h1').each do |node|
|
||||
node.parent.before(node).remove
|
||||
node.content = 'D3.js' if root_page?
|
||||
end
|
||||
|
||||
# Move content to the root-level
|
||||
css('#wiki-content').each do |node|
|
||||
node.before(node.at_css('.markdown-body').children).remove
|
||||
end
|
||||
|
||||
# Remove links inside <h2>
|
||||
css('h2 > a').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Make headings for function definitions and add "id" attributes
|
||||
css('p > a:first-child').each do |node|
|
||||
next unless node['name'] || node.content == '#'
|
||||
parent = node.parent
|
||||
parent.name = 'h6'
|
||||
parent['id'] = (node['name'] || node['href'].sub(/\A.+#/, '')).sub('wiki-', '')
|
||||
parent.css('a[name]').remove
|
||||
node.remove
|
||||
end
|
||||
|
||||
# Remove code highlighting
|
||||
css('.highlight > pre').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
module Docs
|
||||
class D3
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
name
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h6[id]').inject [] do |entries, node|
|
||||
name = node.content
|
||||
name.sub! %r{\(.*\z}, ''
|
||||
entries << [name, node['id']] unless name == entries.last.try(:first)
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
module Docs
|
||||
class D3 < UrlScraper
|
||||
self.name = 'D3.js'
|
||||
self.slug = 'd3'
|
||||
self.type = 'd3'
|
||||
self.version = '3.4.1'
|
||||
self.base_url = 'https://github.com/mbostock/d3/wiki/'
|
||||
self.root_path = 'API-Reference'
|
||||
|
||||
html_filters.push 'd3/clean_html', 'd3/entries'
|
||||
|
||||
options[:container] = '#wiki-wrapper'
|
||||
|
||||
options[:only] = %w(
|
||||
Selections
|
||||
Transitions
|
||||
Arrays
|
||||
Math
|
||||
Requests
|
||||
Formatting
|
||||
CSV
|
||||
Localization
|
||||
Colors
|
||||
Namespaces
|
||||
Internals)
|
||||
|
||||
options[:only_patterns] = [
|
||||
/\-Scales\z/,
|
||||
/\ASVG\-/,
|
||||
/\ATime\-/,
|
||||
/\-Layout\z/,
|
||||
/\AGeo\-/,
|
||||
/\-Geom\z/,
|
||||
/\-Behavior\z/]
|
||||
|
||||
options[:skip_patterns] = [/\//]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2014 Michael Bostock<br>
|
||||
Licensed under the BSD License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 756 B |
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1 @@
|
||||
http://d3js.org/
|
Loading…
Reference in new issue