diff --git a/assets/images/icons.png b/assets/images/icons.png index 01e9dda8..a9977a65 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index 483e2bd2..d9051667 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 807646f4..8e4a50df 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -210,6 +210,11 @@ credits = [ '2009-2014 Salvatore Sanfilippo', 'CC BY-SA', 'http://creativecommons.org/licenses/by-sa/4.0/' + ], [ + 'RequireJS', + '2010-2014 The Dojo Foundation', + 'MIT', + 'https://raw.githubusercontent.com/jrburke/requirejs/master/LICENSE' ], [ 'Ruby', '1993-2014 Yukihiro Matsumoto', diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index ec995de1..5dcede7c 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -24,7 +24,10 @@ newsItem = (date, news) -> result app.news = [ - [ 1402704000000, # June 14, 2014 + [ 1402790400000, # June 15, 2014 + """ New RequireJS documentation """, + ], [ + 1402704000000, # June 14, 2014 """ New Haskell documentation """, ], [ 1400976000000, # May 25, 2014 diff --git a/assets/javascripts/views/pages/requirejs.coffee b/assets/javascripts/views/pages/requirejs.coffee new file mode 100644 index 00000000..26b448a2 --- /dev/null +++ b/assets/javascripts/views/pages/requirejs.coffee @@ -0,0 +1,11 @@ +#= require views/pages/base + +class app.views.RequirejsPage extends app.views.BasePage + afterRender: -> + for el in @findAllByTag 'pre' + language = if el.textContent.match(/^\s* .sect').remove + css('h1 + .note').remove if root_page? + + css('.section', 'pre > code').each do |node| + node.before(node.children).remove + end + + css('h2', 'h3', 'h4').each do |node| + next unless link = node.at_css('a[name]') + node['id'] = link['name'] + link.before(link.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/requirejs/entries.rb b/lib/docs/filters/requirejs/entries.rb new file mode 100644 index 00000000..f2e95d5f --- /dev/null +++ b/lib/docs/filters/requirejs/entries.rb @@ -0,0 +1,35 @@ +module Docs + class Requirejs + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + 'Guides' + end + + def additional_entries + return [] unless root_page? + + entries = [] + type = nil + + css('*').each do |node| + if node.name == 'h2' + type = node.content + elsif node.name == 'h3' || node.name == 'h4' + entries << [node.content, node['id'], type] + end + end + + css('p[id^="config-"]').each do |node| + next if node['id'].include?('note') + entries << [node.at_css('strong').content, node['id'], 'Configuration Options'] + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/requirejs.rb b/lib/docs/scrapers/requirejs.rb new file mode 100644 index 00000000..a35f36d0 --- /dev/null +++ b/lib/docs/scrapers/requirejs.rb @@ -0,0 +1,29 @@ +module Docs + class Requirejs < UrlScraper + self.name = 'RequireJS' + self.type = 'requirejs' + self.version = '2.1.4' + self.base_url = 'http://requirejs.org/docs/' + self.root_path = 'api.html' + self.initial_paths = %w( + optimization.html + jquery.html + node.html + dojo.html + commonjs.html + plugins.html + why.html + whyamd.html) + + html_filters.push 'requirejs/clean_html', 'requirejs/entries' + + options[:container] = '#content' + options[:follow_links] = false + options[:only] = self.initial_paths + + options[:attribution] = <<-HTML + © 2010–2014 The Dojo Foundation
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/requirejs/16.png b/public/icons/docs/requirejs/16.png new file mode 100644 index 00000000..b516defd Binary files /dev/null and b/public/icons/docs/requirejs/16.png differ diff --git a/public/icons/docs/requirejs/16@2x.png b/public/icons/docs/requirejs/16@2x.png new file mode 100644 index 00000000..ba6706e7 Binary files /dev/null and b/public/icons/docs/requirejs/16@2x.png differ diff --git a/public/icons/docs/requirejs/SOURCE b/public/icons/docs/requirejs/SOURCE new file mode 100644 index 00000000..3ebf1b6e --- /dev/null +++ b/public/icons/docs/requirejs/SOURCE @@ -0,0 +1 @@ +http://requirejs.org/