1
0
Thibaut 10 жил өмнө
parent
commit
34e804d455

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2015-03-22",
-    "New <a href=\"/mocha/\">mocha</a> documentation"
+    "New <a href=\"/meteor/\">Meteor</a> and <a href=\"/mocha/\">mocha</a> documentations"
   ], [
     "2015-02-22",
     "Improved <a href=\"/http/\">HTTP</a> documentation",

+ 5 - 0
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',

+ 7 - 0
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

+ 1 - 0
assets/stylesheets/application-dark.css.scss

@@ -52,6 +52,7 @@
         'pages/markdown',
         'pages/maxcdn',
         'pages/mdn',
+        'pages/meteor',
         'pages/modernizr',
         'pages/moment',
         'pages/mongoose',

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -52,6 +52,7 @@
         'pages/markdown',
         'pages/maxcdn',
         'pages/mdn',
+        'pages/meteor',
         'pages/modernizr',
         'pages/moment',
         'pages/mongoose',

+ 1 - 0
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; }

+ 15 - 0
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;
+  }
+}

+ 22 - 0
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

+ 29 - 0
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

+ 51 - 0
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
+      &copy; 2011&ndash;2015 Meteor Development Group<br>
+      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

BIN
public/icons/docs/meteor/16.png


BIN
public/icons/docs/meteor/16@2x.png


+ 1 - 0
public/icons/docs/meteor/SOURCE

@@ -0,0 +1 @@
+https://www.meteor.com/