diff --git a/assets/images/icons.png b/assets/images/icons.png index 10f469f5..eb4fa489 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 8eef93d6..a027c705 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index dfd65939..f18e4523 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2015-03-22", - "New mocha documentation" + "New Meteor and mocha documentations" ], [ "2015-02-22", "Improved HTTP documentation", diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 791f2be6..e29a9a44 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -220,6 +220,11 @@ credits = [ '2015 MaxCDN', 'MIT', 'https://raw.githubusercontent.com/MaxCDN/api-docs/master/LICENSE' + ], [ + 'Meteor', + '2011-2015 Meteor Development Group', + 'MIT', + 'https://raw.githubusercontent.com/meteor/meteor/master/LICENSE.txt' ], [ 'Minitest', 'Ryan Davis, seattle.rb', diff --git a/assets/javascripts/views/pages/meteor.coffee b/assets/javascripts/views/pages/meteor.coffee new file mode 100644 index 00000000..bd8c96ca --- /dev/null +++ b/assets/javascripts/views/pages/meteor.coffee @@ -0,0 +1,7 @@ +#= require views/pages/base + +class app.views.MeteorPage extends app.views.BasePage + afterRender: -> + @highlightCode @findAll('pre.js, pre.javascript'), 'javascript' + @highlightCode @findAll('pre.html'), 'markup' + return diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index 4c4478ae..edac5fc0 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -52,6 +52,7 @@ 'pages/markdown', 'pages/maxcdn', 'pages/mdn', + 'pages/meteor', 'pages/modernizr', 'pages/moment', 'pages/mongoose', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 15e7b6f4..a1ab6d15 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -52,6 +52,7 @@ 'pages/markdown', 'pages/maxcdn', 'pages/mdn', + 'pages/meteor', 'pages/modernizr', 'pages/moment', 'pages/mongoose', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 033fdf0f..abe57e13 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -98,3 +98,4 @@ ._icon-clojure:before { background-position: -4rem -7rem; } ._icon-symfony:before { background-position: -5rem -7rem; } ._icon-mocha:before { background-position: -6rem -7rem; } +._icon-meteor:before { background-position: -7rem -7rem; @extend %darkIconFix !optional; } diff --git a/assets/stylesheets/pages/_meteor.scss b/assets/stylesheets/pages/_meteor.scss new file mode 100644 index 00000000..7b1e4a6f --- /dev/null +++ b/assets/stylesheets/pages/_meteor.scss @@ -0,0 +1,15 @@ +._meteor { + @extend %simple; + + .note, .warning { @extend %note; } + .warning { @extend %note-red; } + + dl.args { margin-left: 1rem; } + + .locus { float: right; } + .locus, .type { + margin-left: .5em; + font-size: .9em; + color: $textColorLight; + } +} diff --git a/lib/docs/filters/meteor/clean_html.rb b/lib/docs/filters/meteor/clean_html.rb new file mode 100644 index 00000000..eb761207 --- /dev/null +++ b/lib/docs/filters/meteor/clean_html.rb @@ -0,0 +1,22 @@ +module Docs + class Meteor + class CleanHtmlFilter < Filter + def call + @doc = at_css('#introduction').parent + + css('.github-ribbon').remove + + css('.selflink', 'b > em').each do |node| + node.before(node.children).remove + end + + css('pre').each do |node| + node['class'] = node.at_css('code')['class'] + node.content = node.content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/meteor/entries.rb b/lib/docs/filters/meteor/entries.rb new file mode 100644 index 00000000..8fbb8070 --- /dev/null +++ b/lib/docs/filters/meteor/entries.rb @@ -0,0 +1,29 @@ +module Docs + class Meteor + class EntriesFilter < Docs::EntriesFilter + def additional_entries + type = nil + + at_css('.full-api-toc').element_children.each_with_object [] do |node, entries| + link = node.at_css('a') + next unless link + + target = link['href'].remove('#/full/') + + case node.name + when 'h1' + type = node.content.strip + when 'h2' + if type == 'Concepts' + entries << [node.content, target, type] + else + type = node.content.strip + end + when 'h3', 'h4' + entries << [node.content, target, type] + end + end + end + end + end +end diff --git a/lib/docs/scrapers/meteor.rb b/lib/docs/scrapers/meteor.rb new file mode 100644 index 00000000..2fb54cab --- /dev/null +++ b/lib/docs/scrapers/meteor.rb @@ -0,0 +1,51 @@ +module Docs + class Meteor < UrlScraper + self.type = 'meteor' + self.version = '1.0.4' + self.base_url = 'http://docs.meteor.com' + self.root_path = '/#/full/' + self.links = { + home: 'https://www.meteor.com/', + code: 'https://github.com/meteor/meteor/' + } + + html_filters.push 'meteor/entries', 'meteor/clean_html', 'title' + + options[:title] = 'Meteor' + options[:skip_links] = true + + options[:attribution] = <<-HTML + © 2011–2015 Meteor Development Group
+ Licensed under the MIT License. + HTML + + private + + def request_one(url) + stub_root_page if url == root_url.to_s + super + end + + def request_all(urls, &block) + stub_root_page + super + end + + def stub_root_page + response = Typhoeus::Response.new( + effective_url: root_url.to_s, + code: 200, + headers: { 'Content-Type' => 'text/html' }, + body: get_root_page_body) + + Typhoeus.stub(root_url.to_s).and_return(response) + end + + def get_root_page_body + require 'capybara' + Capybara.current_driver = :selenium + Capybara.visit(root_url.to_s) + Capybara.find('.body')['innerHTML'] + end + end +end diff --git a/public/icons/docs/meteor/16.png b/public/icons/docs/meteor/16.png new file mode 100644 index 00000000..ee768c1d Binary files /dev/null and b/public/icons/docs/meteor/16.png differ diff --git a/public/icons/docs/meteor/16@2x.png b/public/icons/docs/meteor/16@2x.png new file mode 100644 index 00000000..6fb8b495 Binary files /dev/null and b/public/icons/docs/meteor/16@2x.png differ diff --git a/public/icons/docs/meteor/SOURCE b/public/icons/docs/meteor/SOURCE new file mode 100644 index 00000000..4e7b8a25 --- /dev/null +++ b/public/icons/docs/meteor/SOURCE @@ -0,0 +1 @@ +https://www.meteor.com/