mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add Mongoose documentation
This commit is contained in:
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 |
|
@ -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>© 2011-2014 Nginx, Inc.',
|
||||
|
|
|
@ -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 """,
|
||||
|
|
4
assets/javascripts/views/pages/mongoose.coffee
Normal file
4
assets/javascripts/views/pages/mongoose.coffee
Normal file
|
@ -0,0 +1,4 @@
|
|||
#= require views/pages/base
|
||||
#= require views/pages/underscore
|
||||
|
||||
app.views.MongoosePage = app.views.UnderscorePage
|
|
@ -50,6 +50,7 @@
|
|||
'pages/maxcdn',
|
||||
'pages/mdn',
|
||||
'pages/moment',
|
||||
'pages/mongoose',
|
||||
'pages/nginx',
|
||||
'pages/node',
|
||||
'pages/php',
|
||||
|
|
|
@ -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; }
|
||||
|
|
8
assets/stylesheets/pages/_mongoose.scss
Normal file
8
assets/stylesheets/pages/_mongoose.scss
Normal 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; }
|
||||
}
|
31
lib/docs/filters/mongoose/clean_html.rb
Normal file
31
lib/docs/filters/mongoose/clean_html.rb
Normal 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
|
39
lib/docs/filters/mongoose/entries.rb
Normal file
39
lib/docs/filters/mongoose/entries.rb
Normal 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
|
25
lib/docs/scrapers/mongoose.rb
Normal file
25
lib/docs/scrapers/mongoose.rb
Normal 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
|
||||
© 2010 LearnBoost<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
BIN
public/icons/docs/mongoose/16.png
Normal file
BIN
public/icons/docs/mongoose/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 209 B |
BIN
public/icons/docs/mongoose/16@2x.png
Normal file
BIN
public/icons/docs/mongoose/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 393 B |
Loading…
Reference in a new issue