Unified · Split
Binary file not shown.
Binary file not shown.
| @@ -93,6 +93,11 @@ credits = [ · 92 unmodified lines | ||
| 93 | 93 | '2005-2013 Mozilla Developer Network and individual contributors', |
| 94 | 94 | 'CC BY-SA', |
| 95 | 95 | 'http://creativecommons.org/licenses/by-sa/2.5/' |
| 96 | + ], [ | |
| 97 | + 'D3.js', | |
| 98 | + '2014 Michael Bostock', | |
| 99 | + 'BSD', | |
| 100 | + 'https://raw.github.com/mbostock/d3/master/LICENSE' | |
| 96 | 101 | ], [ |
| 97 | 102 | 'Ember.js', |
| 98 | 103 | '2014 Yehuda Katz, Tom Dale and Ember.js contributors', |
| @@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines | ||
| 24 | 24 | result |
| 25 | 25 | |
| 26 | 26 | app.news = [ |
| 27 | − [ 1390003200000, # January 18, 2013 | |
| 27 | + [ 1390089600000, # January 19, 2013 | |
| 28 | + """ New <a href="/d3/">D3.js</a> documentation """, | |
| 29 | + ], [ | |
| 30 | + 1390003200000, # January 18, 2013 | |
| 28 | 31 | """ DevDocs is now available as a <a href="https://marketplace.firefox.com/app/devdocs/">Firefox web app</a> (currently requires Aurora). """, |
| 29 | 32 | ], [ |
| 30 | 33 | 1389484800000, # January 12, 2013 |
| @@ -0,0 +1,6 @@ | ||
| 1 | +#= require views/pages/base | |
| 2 | + | |
| 3 | +class app.views.D3Page extends app.views.BasePage | |
| 4 | + afterRender: -> | |
| 5 | + @highlightCode @findAll('.highlight > pre'), 'javascript' | |
| 6 | + return | |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | @import 'pages/angular', |
| 31 | 31 | 'pages/coffeescript', |
| 32 | + 'pages/d3', | |
| 32 | 33 | 'pages/ember', |
| 33 | 34 | 'pages/jquery', |
| 34 | 35 | 'pages/git', |
| @@ -45,3 +45,4 @@ · 44 unmodified lines | ||
| 45 | 45 | ._icon-git:before { background-position: -1rem -6rem; } |
| 46 | 46 | ._icon-redis:before { background-position: -2rem -6rem; } |
| 47 | 47 | ._icon-postgresql:before { background-position: -3rem -6rem; } |
| 48 | +._icon-d3:before { background-position: -4rem -6rem; } | |
| @@ -0,0 +1,6 @@ | ||
| 1 | +._d3 { | |
| 2 | + > h2 { @extend %block-heading; } | |
| 3 | + > h3, > h4 { font-size: 1rem; } | |
| 4 | + > h6 { @extend %block-label, %label-blue; } | |
| 5 | + code { @extend %label; } | |
| 6 | +} | |
| @@ -0,0 +1,42 @@ | ||
| 1 | +module Docs | |
| 2 | + class D3 | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + css('#gollum-footer', '.markdown-body > blockquote:first-child', '.anchor').remove | |
| 6 | + | |
| 7 | + # Replace #head with <h1> | |
| 8 | + css('#head > h1').each do |node| | |
| 9 | + node.parent.before(node).remove | |
| 10 | + node.content = 'D3.js' if root_page? | |
| 11 | + end | |
| 12 | + | |
| 13 | + # Move content to the root-level | |
| 14 | + css('#wiki-content').each do |node| | |
| 15 | + node.before(node.at_css('.markdown-body').children).remove | |
| 16 | + end | |
| 17 | + | |
| 18 | + # Remove links inside <h2> | |
| 19 | + css('h2 > a').each do |node| | |
| 20 | + node.before(node.children).remove | |
| 21 | + end | |
| 22 | + | |
| 23 | + # Make headings for function definitions and add "id" attributes | |
| 24 | + css('p > a:first-child').each do |node| | |
| 25 | + next unless node['name'] || node.content == '#' | |
| 26 | + parent = node.parent | |
| 27 | + parent.name = 'h6' | |
| 28 | + parent['id'] = (node['name'] || node['href'].sub(/\A.+#/, '')).sub('wiki-', '') | |
| 29 | + parent.css('a[name]').remove | |
| 30 | + node.remove | |
| 31 | + end | |
| 32 | + | |
| 33 | + # Remove code highlighting | |
| 34 | + css('.highlight > pre').each do |node| | |
| 35 | + node.content = node.content | |
| 36 | + end | |
| 37 | + | |
| 38 | + doc | |
| 39 | + end | |
| 40 | + end | |
| 41 | + end | |
| 42 | +end | |
| @@ -0,0 +1,22 @@ | ||
| 1 | +module Docs | |
| 2 | + class D3 | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + at_css('h1').content | |
| 6 | + end | |
| 7 | + | |
| 8 | + def get_type | |
| 9 | + name | |
| 10 | + end | |
| 11 | + | |
| 12 | + def additional_entries | |
| 13 | + css('h6[id]').inject [] do |entries, node| | |
| 14 | + name = node.content | |
| 15 | + name.sub! %r{\(.*\z}, '' | |
| 16 | + entries << [name, node['id']] unless name == entries.last.try(:first) | |
| 17 | + entries | |
| 18 | + end | |
| 19 | + end | |
| 20 | + end | |
| 21 | + end | |
| 22 | +end | |
| @@ -0,0 +1,43 @@ | ||
| 1 | +module Docs | |
| 2 | + class D3 < UrlScraper | |
| 3 | + self.name = 'D3.js' | |
| 4 | + self.slug = 'd3' | |
| 5 | + self.type = 'd3' | |
| 6 | + self.version = '3.4.1' | |
| 7 | + self.base_url = 'https://github.com/mbostock/d3/wiki/' | |
| 8 | + self.root_path = 'API-Reference' | |
| 9 | + | |
| 10 | + html_filters.push 'd3/clean_html', 'd3/entries' | |
| 11 | + | |
| 12 | + options[:container] = '#wiki-wrapper' | |
| 13 | + | |
| 14 | + options[:only] = %w( | |
| 15 | + Selections | |
| 16 | + Transitions | |
| 17 | + Arrays | |
| 18 | + Math | |
| 19 | + Requests | |
| 20 | + Formatting | |
| 21 | + CSV | |
| 22 | + Localization | |
| 23 | + Colors | |
| 24 | + Namespaces | |
| 25 | + Internals) | |
| 26 | + | |
| 27 | + options[:only_patterns] = [ | |
| 28 | + /\-Scales\z/, | |
| 29 | + /\ASVG\-/, | |
| 30 | + /\ATime\-/, | |
| 31 | + /\-Layout\z/, | |
| 32 | + /\AGeo\-/, | |
| 33 | + /\-Geom\z/, | |
| 34 | + /\-Behavior\z/] | |
| 35 | + | |
| 36 | + options[:skip_patterns] = [/\//] | |
| 37 | + | |
| 38 | + options[:attribution] = <<-HTML | |
| 39 | + © 2014 Michael Bostock<br> | |
| 40 | + Licensed under the BSD License. | |
| 41 | + HTML | |
| 42 | + end | |
| 43 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +http://d3js.org/ | |