Add Mongoose documentation

This commit is contained in:
Thibaut 2014-10-19 12:52:37 -04:00
parent e9c9884a13
commit 5d0f2cd5a6
13 changed files with 115 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View file

@ -212,6 +212,11 @@ credits = [
'2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',
'MIT',
'https://raw.github.com/moment/moment/master/LICENSE'
], [
'Mongoose',
'2010 LearnBoost',
'MIT',
'https://github.com/LearnBoost/mongoose/blob/master/README.md#license'
], [
'nginx',
'2002-2014 Igor Sysoev<br>&copy; 2011-2014 Nginx, Inc.',

View file

@ -34,7 +34,7 @@ newsItem = (date, news) ->
app.news = [
[ 1413676800000, # October 19, 2014
""" New <a href="/svg/">SVG</a> and <a href="/marionette">Marionette.js</a> documentations """,
""" New <a href="/svg/">SVG</a>, <a href="/marionette/">Marionette.js</a>, and <a href="/mongoose/">Mongoose</a> documentations """,
], [
1413590400000, # October 18, 2014
""" New <a href="/nginx/">nginx</a> documentation """,

View file

@ -0,0 +1,4 @@
#= require views/pages/base
#= require views/pages/underscore
app.views.MongoosePage = app.views.UnderscorePage

View file

@ -50,6 +50,7 @@
'pages/maxcdn',
'pages/mdn',
'pages/moment',
'pages/mongoose',
'pages/nginx',
'pages/node',
'pages/php',

View file

@ -68,3 +68,4 @@
._icon-nginx:before { background-position: -4rem -10rem; }
._icon-svg:before { background-position: 0 -11rem; }
._icon-marionette:before { background-position: -1rem -11rem; }
._icon-mongoose:before { background-position: -2rem -11rem; }

View file

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

View file

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

View file

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

View file

@ -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
&copy; 2010 LearnBoost<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B