Add Meteor documentation

This commit is contained in:
Thibaut 2015-03-22 15:15:23 -04:00
parent 4f12a6e826
commit 34e804d455
15 changed files with 134 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View file

@ -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",

View file

@ -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',

View file

@ -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

View file

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

View file

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

View file

@ -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; }

View file

@ -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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

View file

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