History

Add Mongoose documentation

Thibaut committed 12 years ago

Commit 5d0f2cd1 parent e9c988413 files · +111 −-3Browse files

Unified · Split

13 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  4. assets/javascripts/templates/pages/news_tmpl.coffee +1 −1
  5. assets/javascripts/views/pages/mongoose.coffee +4 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +1 −0
  8. assets/stylesheets/pages/_mongoose.scss +8 −0
  9. lib/docs/filters/mongoose/clean_html.rb +31 −0
  10. lib/docs/filters/mongoose/entries.rb +39 −0
  11. lib/docs/scrapers/mongoose.rb +25 −0
  12. public/icons/docs/mongoose/16.png +0 −0
  13. public/icons/docs/mongoose/16@2x.png +0 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -212,6 +212,11 @@ credits = [ · 211 unmodified lines
212 '2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',212 '2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',
213 'MIT',213 'MIT',
214 'https://raw.github.com/moment/moment/master/LICENSE'214 'https://raw.github.com/moment/moment/master/LICENSE'
215 ], [
216 'Mongoose',
217 '2010 LearnBoost',
218 'MIT',
219 'https://github.com/LearnBoost/mongoose/blob/master/README.md#license'
215 ], [220 ], [
216 'nginx',221 'nginx',
217 '2002-2014 Igor Sysoev<br>&copy; 2011-2014 Nginx, Inc.',222 '2002-2014 Igor Sysoev<br>&copy; 2011-2014 Nginx, Inc.',
assets/javascripts/templates/pages/news_tmpl.coffee+1−1
@@ -34,7 +34,7 @@ newsItem = (date, news) -> · 33 unmodified lines
34 34
35app.news = [35app.news = [
36 [ 1413676800000, # October 19, 201436 [ 1413676800000, # October 19, 2014
37 """ New <a href="/svg/">SVG</a> and <a href="/marionette">Marionette.js</a> documentations """,37 """ New <a href="/svg/">SVG</a>, <a href="/marionette/">Marionette.js</a>, and <a href="/mongoose/">Mongoose</a> documentations """,
38 ], [38 ], [
39 1413590400000, # October 18, 201439 1413590400000, # October 18, 2014
40 """ New <a href="/nginx/">nginx</a> documentation """,40 """ New <a href="/nginx/">nginx</a> documentation """,
assets/javascripts/views/pages/mongoose.coffee+4−0
@@ -0,0 +1,4 @@
1#= require views/pages/base
2#= require views/pages/underscore
3
4app.views.MongoosePage = app.views.UnderscorePage
assets/stylesheets/application.css.scss+1−0
@@ -50,6 +50,7 @@ · 49 unmodified lines
50 'pages/maxcdn',50 'pages/maxcdn',
51 'pages/mdn',51 'pages/mdn',
52 'pages/moment',52 'pages/moment',
53 'pages/mongoose',
53 'pages/nginx',54 'pages/nginx',
54 'pages/node',55 'pages/node',
55 'pages/php',56 'pages/php',
assets/stylesheets/global/_icons.scss+1−0
@@ -68,3 +68,4 @@ · 67 unmodified lines
68._icon-nginx:before { background-position: -4rem -10rem; }68._icon-nginx:before { background-position: -4rem -10rem; }
69._icon-svg:before { background-position: 0 -11rem; }69._icon-svg:before { background-position: 0 -11rem; }
70._icon-marionette:before { background-position: -1rem -11rem; }70._icon-marionette:before { background-position: -1rem -11rem; }
71._icon-mongoose:before { background-position: -2rem -11rem; }
assets/stylesheets/pages/_mongoose.scss+8−0
@@ -0,0 +1,8 @@
1._mongoose {
2 padding-left: 1rem;
3
4 > h1, > h2, > h3 { margin-left: -1rem; }
5 > h2 { @extend %block-heading; }
6 > h3 { @extend %block-label, %label-blue; }
7 h4 { font-size: 1em; }
8}
lib/docs/filters/mongoose/clean_html.rb+31−0
@@ -0,0 +1,31 @@
1module Docs
2 class Mongoose
3 class CleanHtmlFilter < Filter
4 def call
5 css('hr', '.showcode', '.sourcecode').remove
6
7 if slug == 'api'
8 at_css('.controls').after('<h1>Mongoose API</h1>')
9
10 css('.private', '.controls').remove
11
12 css('a + .method').each do |node|
13 node.previous_element.replace("<h2>#{node.previous_element.to_html}</h2>")
14 end
15 else
16 at_css('h2').name = 'h1'
17
18 css('h3').each do |node|
19 node.name = 'h2'
20 end
21 end
22
23 css('pre > code', 'h1 + ul', '.module', '.item', 'h3 > a', 'h3 code').each do |node|
24 node.before(node.children).remove
25 end
26
27 doc
28 end
29 end
30 end
31end
lib/docs/filters/mongoose/entries.rb+39−0
@@ -0,0 +1,39 @@
1module Docs
2 class Mongoose
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 if slug == 'api'
6 'Mongoose'
7 else
8 at_css('h1').content
9 end
10 end
11
12 def get_type
13 if slug == 'api'
14 'Mongoose'
15 else
16 'Guides'
17 end
18 end
19
20 def additional_entries
21 return [] unless slug == 'api'
22 entries = []
23
24 css('h3[id]').each do |node|
25 next if node['id'] == 'index_'
26
27 name = node.content.strip
28 name.sub! %r{\(.+\)}, '()'
29 next if name.include?(' ')
30
31 type = name.split(/[#\.\(]/).first
32 entries << [name, node['id'], type]
33 end
34
35 entries
36 end
37 end
38 end
39end
lib/docs/scrapers/mongoose.rb+25−0
@@ -0,0 +1,25 @@
1module Docs
2 class Mongoose < UrlScraper
3 self.name = 'Mongoose'
4 self.type = 'mongoose'
5 self.version = '3.8.17'
6 self.base_url = 'http://mongoosejs.com/docs/'
7 self.root_path = 'index.html'
8 self.initial_paths = %w(guide.html api.html)
9
10 html_filters.push 'mongoose/clean_html', 'mongoose/entries'
11
12 options[:container] = '#content'
13
14 options[:skip] = %w(
15 faq.html
16 prior.html
17 migration.html
18 plugins)
19
20 options[:attribution] = <<-HTML
21 &copy; 2010 LearnBoost<br>
22 Licensed under the MIT License.
23 HTML
24 end
25end
public/icons/docs/mongoose/16.png+0−0

Binary file not shown.

public/icons/docs/mongoose/16@2x.png+0−0

Binary file not shown.