History

Add Meteor documentation

Thibaut committed 11 years ago

Commit 34e804d1 parent 4f12a6e15 files · +130 −-3Browse files

Unified · Split

15 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/news.json +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/meteor.coffee +7 −0
  6. assets/stylesheets/application-dark.css.scss +1 −0
  7. assets/stylesheets/application.css.scss +1 −0
  8. assets/stylesheets/global/_icons.scss +1 −0
  9. assets/stylesheets/pages/_meteor.scss +15 −0
  10. lib/docs/filters/meteor/clean_html.rb +22 −0
  11. lib/docs/filters/meteor/entries.rb +29 −0
  12. lib/docs/scrapers/meteor.rb +51 −0
  13. public/icons/docs/meteor/16.png +0 −0
  14. public/icons/docs/meteor/16@2x.png +0 −0
  15. public/icons/docs/meteor/SOURCE +1 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
11 [
22 [
33 "2015-03-22",
4− "New <a href=\"/mocha/\">mocha</a> documentation"
4+ "New <a href=\"/meteor/\">Meteor</a> and <a href=\"/mocha/\">mocha</a> documentations"
55 ], [
66 "2015-02-22",
77 "Improved <a href=\"/http/\">HTTP</a> documentation",
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -220,6 +220,11 @@ credits = [ · 219 unmodified lines
220220 '2015 MaxCDN',
221221 'MIT',
222222 'https://raw.githubusercontent.com/MaxCDN/api-docs/master/LICENSE'
223+ ], [
224+ 'Meteor',
225+ '2011-2015 Meteor Development Group',
226+ 'MIT',
227+ 'https://raw.githubusercontent.com/meteor/meteor/master/LICENSE.txt'
223228 ], [
224229 'Minitest',
225230 'Ryan Davis, seattle.rb',
assets/javascripts/views/pages/meteor.coffee+7−0
@@ -0,0 +1,7 @@
1+#= require views/pages/base
2+
3+class app.views.MeteorPage extends app.views.BasePage
4+ afterRender: ->
5+ @highlightCode @findAll('pre.js, pre.javascript'), 'javascript'
6+ @highlightCode @findAll('pre.html'), 'markup'
7+ return
assets/stylesheets/application-dark.css.scss+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 'pages/markdown',
5353 'pages/maxcdn',
5454 'pages/mdn',
55+ 'pages/meteor',
5556 'pages/modernizr',
5657 'pages/moment',
5758 'pages/mongoose',
assets/stylesheets/application.css.scss+1−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 'pages/markdown',
5353 'pages/maxcdn',
5454 'pages/mdn',
55+ 'pages/meteor',
5556 'pages/modernizr',
5657 'pages/moment',
5758 'pages/mongoose',
assets/stylesheets/global/_icons.scss+1−0
@@ -98,3 +98,4 @@ · 97 unmodified lines
9898 ._icon-clojure:before { background-position: -4rem -7rem; }
9999 ._icon-symfony:before { background-position: -5rem -7rem; }
100100 ._icon-mocha:before { background-position: -6rem -7rem; }
101+._icon-meteor:before { background-position: -7rem -7rem; @extend %darkIconFix !optional; }
assets/stylesheets/pages/_meteor.scss+15−0
@@ -0,0 +1,15 @@
1+._meteor {
2+ @extend %simple;
3+
4+ .note, .warning { @extend %note; }
5+ .warning { @extend %note-red; }
6+
7+ dl.args { margin-left: 1rem; }
8+
9+ .locus { float: right; }
10+ .locus, .type {
11+ margin-left: .5em;
12+ font-size: .9em;
13+ color: $textColorLight;
14+ }
15+}
lib/docs/filters/meteor/clean_html.rb+22−0
@@ -0,0 +1,22 @@
1+module Docs
2+ class Meteor
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css('#introduction').parent
6+
7+ css('.github-ribbon').remove
8+
9+ css('.selflink', 'b > em').each do |node|
10+ node.before(node.children).remove
11+ end
12+
13+ css('pre').each do |node|
14+ node['class'] = node.at_css('code')['class']
15+ node.content = node.content
16+ end
17+
18+ doc
19+ end
20+ end
21+ end
22+end
lib/docs/filters/meteor/entries.rb+29−0
@@ -0,0 +1,29 @@
1+module Docs
2+ class Meteor
3+ class EntriesFilter < Docs::EntriesFilter
4+ def additional_entries
5+ type = nil
6+
7+ at_css('.full-api-toc').element_children.each_with_object [] do |node, entries|
8+ link = node.at_css('a')
9+ next unless link
10+
11+ target = link['href'].remove('#/full/')
12+
13+ case node.name
14+ when 'h1'
15+ type = node.content.strip
16+ when 'h2'
17+ if type == 'Concepts'
18+ entries << [node.content, target, type]
19+ else
20+ type = node.content.strip
21+ end
22+ when 'h3', 'h4'
23+ entries << [node.content, target, type]
24+ end
25+ end
26+ end
27+ end
28+ end
29+end
lib/docs/scrapers/meteor.rb+51−0
@@ -0,0 +1,51 @@
1+module Docs
2+ class Meteor < UrlScraper
3+ self.type = 'meteor'
4+ self.version = '1.0.4'
5+ self.base_url = 'http://docs.meteor.com'
6+ self.root_path = '/#/full/'
7+ self.links = {
8+ home: 'https://www.meteor.com/',
9+ code: 'https://github.com/meteor/meteor/'
10+ }
11+
12+ html_filters.push 'meteor/entries', 'meteor/clean_html', 'title'
13+
14+ options[:title] = 'Meteor'
15+ options[:skip_links] = true
16+
17+ options[:attribution] = <<-HTML
18+ &copy; 2011&ndash;2015 Meteor Development Group<br>
19+ Licensed under the MIT License.
20+ HTML
21+
22+ private
23+
24+ def request_one(url)
25+ stub_root_page if url == root_url.to_s
26+ super
27+ end
28+
29+ def request_all(urls, &block)
30+ stub_root_page
31+ super
32+ end
33+
34+ def stub_root_page
35+ response = Typhoeus::Response.new(
36+ effective_url: root_url.to_s,
37+ code: 200,
38+ headers: { 'Content-Type' => 'text/html' },
39+ body: get_root_page_body)
40+
41+ Typhoeus.stub(root_url.to_s).and_return(response)
42+ end
43+
44+ def get_root_page_body
45+ require 'capybara'
46+ Capybara.current_driver = :selenium
47+ Capybara.visit(root_url.to_s)
48+ Capybara.find('.body')['innerHTML']
49+ end
50+ end
51+end
public/icons/docs/meteor/16.png+0−0

Binary file not shown.

public/icons/docs/meteor/16@2x.png+0−0

Binary file not shown.

public/icons/docs/meteor/SOURCE+1−0
@@ -0,0 +1 @@
1+https://www.meteor.com/

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t