Add D3.js documentation

pull/47/head
Thibaut 11 years ago
parent 7fa7c8fc3c
commit 8e469d340e

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 36 KiB

@ -93,6 +93,11 @@ credits = [
'2005-2013 Mozilla Developer Network and individual contributors',
'CC BY-SA',
'http://creativecommons.org/licenses/by-sa/2.5/'
], [
'D3.js',
'2014 Michael Bostock',
'BSD',
'https://raw.github.com/mbostock/d3/master/LICENSE'
], [
'Ember.js',
'2014 Yehuda Katz, Tom Dale and Ember.js contributors',

@ -24,7 +24,10 @@ newsItem = (date, news) ->
result
app.news = [
[ 1390003200000, # January 18, 2013
[ 1390089600000, # January 19, 2013
""" New <a href="/d3/">D3.js</a> documentation """,
], [
1390003200000, # January 18, 2013
""" DevDocs is now available as a <a href="https://marketplace.firefox.com/app/devdocs/">Firefox web app</a> (currently requires Aurora). """,
], [
1389484800000, # January 12, 2013

@ -0,0 +1,6 @@
#= require views/pages/base
class app.views.D3Page extends app.views.BasePage
afterRender: ->
@highlightCode @findAll('.highlight > pre'), 'javascript'
return

@ -29,6 +29,7 @@
@import 'pages/angular',
'pages/coffeescript',
'pages/d3',
'pages/ember',
'pages/jquery',
'pages/git',

@ -45,3 +45,4 @@
._icon-git:before { background-position: -1rem -6rem; }
._icon-redis:before { background-position: -2rem -6rem; }
._icon-postgresql:before { background-position: -3rem -6rem; }
._icon-d3:before { background-position: -4rem -6rem; }

@ -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
&copy; 2014 Michael Bostock<br>
Licensed under the BSD License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -0,0 +1 @@
http://d3js.org/
Loading…
Cancel
Save