mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add Meteor documentation
This commit is contained in:
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 |
|
@ -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",
|
||||
|
|
|
@ -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
assets/javascripts/views/pages/meteor.coffee
Normal file
7
assets/javascripts/views/pages/meteor.coffee
Normal 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
|
|
@ -52,6 +52,7 @@
|
|||
'pages/markdown',
|
||||
'pages/maxcdn',
|
||||
'pages/mdn',
|
||||
'pages/meteor',
|
||||
'pages/modernizr',
|
||||
'pages/moment',
|
||||
'pages/mongoose',
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
'pages/markdown',
|
||||
'pages/maxcdn',
|
||||
'pages/mdn',
|
||||
'pages/meteor',
|
||||
'pages/modernizr',
|
||||
'pages/moment',
|
||||
'pages/mongoose',
|
||||
|
|
|
@ -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
assets/stylesheets/pages/_meteor.scss
Normal file
15
assets/stylesheets/pages/_meteor.scss
Normal 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;
|
||||
}
|
||||
}
|
22
lib/docs/filters/meteor/clean_html.rb
Normal file
22
lib/docs/filters/meteor/clean_html.rb
Normal 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
|
29
lib/docs/filters/meteor/entries.rb
Normal file
29
lib/docs/filters/meteor/entries.rb
Normal 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
|
51
lib/docs/scrapers/meteor.rb
Normal file
51
lib/docs/scrapers/meteor.rb
Normal 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
|
||||
© 2011–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
Normal file
BIN
public/icons/docs/meteor/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 302 B |
BIN
public/icons/docs/meteor/16@2x.png
Normal file
BIN
public/icons/docs/meteor/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 696 B |
1
public/icons/docs/meteor/SOURCE
Normal file
1
public/icons/docs/meteor/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://www.meteor.com/
|
Loading…
Reference in a new issue