diff --git a/assets/images/icons.png b/assets/images/icons.png index e22109c3..c3c1203b 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 1ab985f4..8f0eec88 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 4151b13c..3fd33883 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,6 +1,6 @@ [ [ "2014-12-21", - "New React, RethinkDB and Socket.IO documentations" + "New React, RethinkDB, Socket.IO and Modernizr documentations" ], [ "2014-11-30", "New PHPUnit and Nokogiri documentations" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index e9a0e2f8..f7b57839 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -208,6 +208,11 @@ credits = [ '2014 MaxCDN', 'MIT', 'https://raw.githubusercontent.com/MaxCDN/api-docs/master/LICENSE' + ], [ + 'Modernizr', + '2009-2014 Modernizr', + 'MIT', + 'http://modernizr.com/license/' ], [ 'Moment.js', '2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors', diff --git a/assets/javascripts/views/pages/modernizr.coffee b/assets/javascripts/views/pages/modernizr.coffee new file mode 100644 index 00000000..63ba5658 --- /dev/null +++ b/assets/javascripts/views/pages/modernizr.coffee @@ -0,0 +1,4 @@ +#= require views/pages/base +#= require views/pages/requirejs + +app.views.ModernizrPage = app.views.RequirejsPage diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index c7d26cd8..efce2ff9 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -49,6 +49,7 @@ 'pages/markdown', 'pages/maxcdn', 'pages/mdn', + 'pages/modernizr', 'pages/moment', 'pages/mongoose', 'pages/nginx', diff --git a/assets/stylesheets/global/_base.scss b/assets/stylesheets/global/_base.scss index 51cd083d..b69f1694 100644 --- a/assets/stylesheets/global/_base.scss +++ b/assets/stylesheets/global/_base.scss @@ -147,6 +147,8 @@ td { + td { border-left: 1px solid $boxBorderLight; } tr:last-child > & { border-bottom: 0; } + + > pre:last-child, > p:last-child, > ul:last-child, > ol:last-child { margin-bottom: 0; } } input { diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 0e684114..e5558653 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -75,3 +75,4 @@ ._icon-rethinkdb:before { background-position: 0 -12rem; } ._icon-react:before { background-position: -1rem -12rem; } ._icon-socketio:before { background-position: -2rem -12rem; } +._icon-modernizr:before { background-position: -3rem -12rem; } diff --git a/assets/stylesheets/pages/_modernizr.scss b/assets/stylesheets/pages/_modernizr.scss new file mode 100644 index 00000000..eb34fe37 --- /dev/null +++ b/assets/stylesheets/pages/_modernizr.scss @@ -0,0 +1,8 @@ +._modernizr { + h2 { @extend %block-heading; } + h3 { @extend %block-label, %label-blue; } + h4 { font-size: 1em; } + + code { @extend %label; } + blockquote { @extend %note; } +} diff --git a/lib/docs/filters/modernizr/clean_html.rb b/lib/docs/filters/modernizr/clean_html.rb new file mode 100644 index 00000000..c37f0efa --- /dev/null +++ b/lib/docs/filters/modernizr/clean_html.rb @@ -0,0 +1,21 @@ +module Docs + class Modernizr + class CleanHtmlFilter < Filter + def call + css('pre').each do |node| + node.content = node.content + end + + css('> div', '> section').each do |node| + node.before(node.children).remove + end + + css('h3, h4').each do |node| + node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } + end + + doc + end + end + end +end diff --git a/lib/docs/filters/modernizr/entries.rb b/lib/docs/filters/modernizr/entries.rb new file mode 100644 index 00000000..d2cb377a --- /dev/null +++ b/lib/docs/filters/modernizr/entries.rb @@ -0,0 +1,36 @@ +module Docs + class Modernizr + class EntriesFilter < Docs::EntriesFilter + def additional_entries + entries = [] + + css('h3[id]').each do |node| + next unless name = node.content.strip[/\AModernizr\.\w+\(\)/] + entries << [name, node['id'], 'Modernizr'] + end + + css('section[id]').each do |node| + next unless heading = node.at_css('h3') + next unless name = heading.content.strip[/\A(Modernizr\.)?\w+\(\)/] + + heading['id'] = node['id'] + node.remove_attribute('id') + + name.prepend('Modernizr.') unless name.start_with?('Modernizr') + entries << [name, heading['id'], 'Modernizr'] + end + + css('h4[id^="features-"] + table').each do |table| + type = table.previous_element.content.strip + type << ' features' unless type.end_with?('features') + + table.css('tbody th[id]').each do |node| + entries << [node.content, node['id'], type] + end + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/modernizr.rb b/lib/docs/scrapers/modernizr.rb new file mode 100644 index 00000000..9299ed91 --- /dev/null +++ b/lib/docs/scrapers/modernizr.rb @@ -0,0 +1,19 @@ +module Docs + class Modernizr < UrlScraper + self.name = 'Modernizr' + self.type = 'modernizr' + self.version = '2.8.3' + self.base_url = 'http://modernizr.com/docs/' + + html_filters.push 'modernizr/entries', 'modernizr/clean_html', 'title' + + options[:title] = 'Modernizr' + options[:container] = '#documentation' + options[:skip_links] = true + + options[:attribution] = <<-HTML + © 2009–2014 Modernizr
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/modernizr/16.png b/public/icons/docs/modernizr/16.png new file mode 100644 index 00000000..305a2916 Binary files /dev/null and b/public/icons/docs/modernizr/16.png differ diff --git a/public/icons/docs/modernizr/16@2x.png b/public/icons/docs/modernizr/16@2x.png new file mode 100644 index 00000000..a1c720d5 Binary files /dev/null and b/public/icons/docs/modernizr/16@2x.png differ diff --git a/public/icons/docs/modernizr/SOURCE b/public/icons/docs/modernizr/SOURCE new file mode 100644 index 00000000..0a668b4b --- /dev/null +++ b/public/icons/docs/modernizr/SOURCE @@ -0,0 +1 @@ +https://github.com/Modernizr/Modernizr/tree/master/media