diff --git a/assets/images/icons.png b/assets/images/icons.png index e1d524af..701f0d07 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index edc05b05..3ae14726 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 5828cd57..91af7181 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -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
© 2011-2014 Nginx, Inc.', diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index cac5eaf4..eaf9f59f 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -34,7 +34,7 @@ newsItem = (date, news) -> app.news = [ [ 1413676800000, # October 19, 2014 - """ New SVG and Marionette.js documentations """, + """ New SVG, Marionette.js, and Mongoose documentations """, ], [ 1413590400000, # October 18, 2014 """ New nginx documentation """, diff --git a/assets/javascripts/views/pages/mongoose.coffee b/assets/javascripts/views/pages/mongoose.coffee new file mode 100644 index 00000000..ee4bcb66 --- /dev/null +++ b/assets/javascripts/views/pages/mongoose.coffee @@ -0,0 +1,4 @@ +#= require views/pages/base +#= require views/pages/underscore + +app.views.MongoosePage = app.views.UnderscorePage diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 9ce677c5..1014a649 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -50,6 +50,7 @@ 'pages/maxcdn', 'pages/mdn', 'pages/moment', + 'pages/mongoose', 'pages/nginx', 'pages/node', 'pages/php', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 34e29200..0f9db3e8 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -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; } diff --git a/assets/stylesheets/pages/_mongoose.scss b/assets/stylesheets/pages/_mongoose.scss new file mode 100644 index 00000000..0a76f58e --- /dev/null +++ b/assets/stylesheets/pages/_mongoose.scss @@ -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; } +} diff --git a/lib/docs/filters/mongoose/clean_html.rb b/lib/docs/filters/mongoose/clean_html.rb new file mode 100644 index 00000000..04ef6a12 --- /dev/null +++ b/lib/docs/filters/mongoose/clean_html.rb @@ -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('

Mongoose API

') + + css('.private', '.controls').remove + + css('a + .method').each do |node| + node.previous_element.replace("

#{node.previous_element.to_html}

") + 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 diff --git a/lib/docs/filters/mongoose/entries.rb b/lib/docs/filters/mongoose/entries.rb new file mode 100644 index 00000000..dd579146 --- /dev/null +++ b/lib/docs/filters/mongoose/entries.rb @@ -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 diff --git a/lib/docs/scrapers/mongoose.rb b/lib/docs/scrapers/mongoose.rb new file mode 100644 index 00000000..93a22f3a --- /dev/null +++ b/lib/docs/scrapers/mongoose.rb @@ -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
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/mongoose/16.png b/public/icons/docs/mongoose/16.png new file mode 100644 index 00000000..2b3a67e7 Binary files /dev/null and b/public/icons/docs/mongoose/16.png differ diff --git a/public/icons/docs/mongoose/16@2x.png b/public/icons/docs/mongoose/16@2x.png new file mode 100644 index 00000000..68e480b5 Binary files /dev/null and b/public/icons/docs/mongoose/16@2x.png differ