mirror of https://github.com/freeCodeCamp/devdocs
parent
4f12a6e826
commit
34e804d455
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 75 KiB |
@ -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
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 696 B |
@ -0,0 +1 @@
|
||||
https://www.meteor.com/
|
Loading…
Reference in new issue