mirror of https://github.com/freeCodeCamp/devdocs
parent
e9c9884a13
commit
5d0f2cd5a6
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
@ -0,0 +1,4 @@
|
||||
#= require views/pages/base
|
||||
#= require views/pages/underscore
|
||||
|
||||
app.views.MongoosePage = app.views.UnderscorePage
|
@ -0,0 +1,8 @@
|
||||
._mongoose {
|
||||
padding-left: 1rem;
|
||||
|
||||
> h1, > h2, > h3 { margin-left: -1rem; }
|
||||
> h2 { @extend %block-heading; }
|
||||
> h3 { @extend %block-label, %label-blue; }
|
||||
h4 { font-size: 1em; }
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
module Docs
|
||||
class Mongoose
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('hr', '.showcode', '.sourcecode').remove
|
||||
|
||||
if slug == 'api'
|
||||
at_css('.controls').after('<h1>Mongoose API</h1>')
|
||||
|
||||
css('.private', '.controls').remove
|
||||
|
||||
css('a + .method').each do |node|
|
||||
node.previous_element.replace("<h2>#{node.previous_element.to_html}</h2>")
|
||||
end
|
||||
else
|
||||
at_css('h2').name = 'h1'
|
||||
|
||||
css('h3').each do |node|
|
||||
node.name = 'h2'
|
||||
end
|
||||
end
|
||||
|
||||
css('pre > code', 'h1 + ul', '.module', '.item', 'h3 > a', 'h3 code').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,39 @@
|
||||
module Docs
|
||||
class Mongoose
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
if slug == 'api'
|
||||
'Mongoose'
|
||||
else
|
||||
at_css('h1').content
|
||||
end
|
||||
end
|
||||
|
||||
def get_type
|
||||
if slug == 'api'
|
||||
'Mongoose'
|
||||
else
|
||||
'Guides'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless slug == 'api'
|
||||
entries = []
|
||||
|
||||
css('h3[id]').each do |node|
|
||||
next if node['id'] == 'index_'
|
||||
|
||||
name = node.content.strip
|
||||
name.sub! %r{\(.+\)}, '()'
|
||||
next if name.include?(' ')
|
||||
|
||||
type = name.split(/[#\.\(]/).first
|
||||
entries << [name, node['id'], type]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,25 @@
|
||||
module Docs
|
||||
class Mongoose < UrlScraper
|
||||
self.name = 'Mongoose'
|
||||
self.type = 'mongoose'
|
||||
self.version = '3.8.17'
|
||||
self.base_url = 'http://mongoosejs.com/docs/'
|
||||
self.root_path = 'index.html'
|
||||
self.initial_paths = %w(guide.html api.html)
|
||||
|
||||
html_filters.push 'mongoose/clean_html', 'mongoose/entries'
|
||||
|
||||
options[:container] = '#content'
|
||||
|
||||
options[:skip] = %w(
|
||||
faq.html
|
||||
prior.html
|
||||
migration.html
|
||||
plugins)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2010 LearnBoost<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 393 B |
Loading…
Reference in new issue