diff --git a/assets/images/icons.png b/assets/images/icons.png index 1b1906a8..1c559c4a 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 8d236a2b..52a988d6 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 d333742b..8592da88 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2015-04-26", - "New npm documentation" + "New Apache HTTP Server and npm documentations" ], [ "2015-03-22", "New Meteor and mocha documentations" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 81ee046f..8eaad397 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -80,6 +80,11 @@ credits = [ '2010-2015 Google, Inc.', 'CC BY', 'http://creativecommons.org/licenses/by/3.0/' + ], [ + 'Apache HTTP Server', + 'The Apache Software Foundation', + 'Apache', + 'http://www.apache.org/licenses/LICENSE-2.0' ], [ 'Backbone.js', '2010-2014 Jeremy Ashkenas, DocumentCloud', diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index 34eb902d..09696ae0 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -30,6 +30,7 @@ @import 'pages/base', 'pages/angular', + 'pages/apache', 'pages/bower', 'pages/c', 'pages/chai', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 4fc1fc87..749ffa94 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -30,6 +30,7 @@ @import 'pages/base', 'pages/angular', + 'pages/apache', 'pages/bower', 'pages/c', 'pages/chai', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 3093a756..cd967057 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -99,4 +99,5 @@ ._icon-symfony:before { background-position: -5rem -7rem; } ._icon-mocha:before { background-position: -6rem -7rem; } ._icon-meteor:before { background-position: -7rem -7rem; @extend %darkIconFix !optional; } -._icon-npm:before { background-position: -8rem -7rem } +._icon-npm:before { background-position: -8rem -7rem; } +._icon-apache_http_server:before { background-position: -9rem -7rem; } diff --git a/assets/stylesheets/pages/_apache.scss b/assets/stylesheets/pages/_apache.scss new file mode 100644 index 00000000..ff494bb5 --- /dev/null +++ b/assets/stylesheets/pages/_apache.scss @@ -0,0 +1,6 @@ +._apache { + @extend %simple; + + .note, .warning { @extend %note; } + .warning { @extend %note-red; } +} diff --git a/lib/docs/filters/apache/clean_html.rb b/lib/docs/filters/apache/clean_html.rb new file mode 100644 index 00000000..3d912f3c --- /dev/null +++ b/lib/docs/filters/apache/clean_html.rb @@ -0,0 +1,41 @@ +module Docs + class Apache + class CleanHtmlFilter < Filter + def call + if root_page? + doc.children = css('h1, .category') + return doc + end + + css('.toplang', '#quickview', '.top').remove + + css('> .section', '#preamble', 'a[href*="dict.html"]', 'code var', 'code strong').each do |node| + node.before(node.children).remove + end + + css('p > code:first-child:last-child', 'td > code:first-child:last-child').each do |node| + next if node.previous.try(:content).present? || node.next.try(:content).present? + node.inner_html = node.inner_html.squish.gsub(/\s*/, "\n") + node.content = node.content.strip + node.name = 'pre' if node.content =~ /\s/ + node.parent.before(node.parent.children).remove if node.parent.name == 'p' + end + + css('code').each do |node| + node.inner_html = node.inner_html.squish + end + + css('.note h3', '.warning h3').each do |node| + node.before("

#{node.inner_html}

").remove + end + + css('h2:not([id]) a[id]:not([href])').each do |node| + node.parent['id'] = node['id'] + node.before(node.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/apache/entries.rb b/lib/docs/filters/apache/entries.rb new file mode 100644 index 00000000..8fd7f8ae --- /dev/null +++ b/lib/docs/filters/apache/entries.rb @@ -0,0 +1,56 @@ +module Docs + class Apache + class EntriesFilter < Docs::EntriesFilter + def get_name + if slug == 'mod/' + 'Modules' + elsif slug == 'programs/' + 'Programs' + elsif slug == 'mod/core' + 'core' + else + name = at_css('h1').content.strip + name.remove! %r{\ Support\z}i + name.remove! %r{in\ Apache\z} + name.remove! %r{\ documentation\z}i + name.remove! %r{\AApache\ (httpd\ )?(Tutorial:\ )?}i + name.remove! 'HTTP Server Tutorial: ' + name.sub! 'Module mod_', 'mod_' + name.remove! %r{\ \-.*} if slug.start_with?('programs') + name + end + end + + def get_type + if slug.start_with?('howto') + 'Tutorials' + elsif slug.start_with?('platform') + 'Platform Specific Notes' + elsif slug.start_with?('programs') + 'Programs' + elsif slug.start_with?('misc') + 'Miscellaneous' + elsif slug.start_with?('mod/') + 'Modules' + elsif slug.start_with?('ssl/') + 'Guide: SSL/TLS' + elsif slug.start_with?('rewrite/') + 'Guide: Rewrite' + elsif slug.start_with?('vhosts/') + 'Guide: Virtual Host' + else + 'Guide' + end + end + + def additional_entries + css('.directive-section > h2').each_with_object [] do |node, entries| + name = node.content.strip + next unless name.sub!(/\ Directive\z/, '') + name.prepend "#{self.name.start_with?('MPM') ? 'MPM' : self.name}: " + entries << [name, node['id'], 'Directives'] + end + end + end + end +end diff --git a/lib/docs/scrapers/apache.rb b/lib/docs/scrapers/apache.rb new file mode 100644 index 00000000..1c75a11c --- /dev/null +++ b/lib/docs/scrapers/apache.rb @@ -0,0 +1,37 @@ +module Docs + class Apache < UrlScraper + self.name = 'Apache HTTP Server' + self.slug = 'apache_http_server' + self.type = 'apache' + self.version = '2.4.12' + self.base_url = 'http://httpd.apache.org/docs/2.4/en/' + self.links = { + home: 'http://httpd.apache.org/' + } + + html_filters.push 'apache/clean_html', 'apache/entries' + + options[:container] = '#page-content' + + options[:skip] = %w( + upgrading.html + license.html + sitemap.html + glossary.html + mod/quickreference.html + mod/directive-dict.html + mod/directives.html + mod/module-dict.html + programs/other.html) + + options[:skip_patterns] = [ + /\A(da|de|en|es|fr|ja|ko|pt-br|tr|zh-cn)\//, + /\Anew_features/, + /\Adeveloper\// ] + + options[:attribution] = <<-HTML + © The Apache Software Foundation
+ Licensed under the Apache License, Version 2.0. + HTML + end +end diff --git a/public/icons/docs/apache_http_server/16.png b/public/icons/docs/apache_http_server/16.png new file mode 100644 index 00000000..1fffcd42 Binary files /dev/null and b/public/icons/docs/apache_http_server/16.png differ diff --git a/public/icons/docs/apache_http_server/16@2x.png b/public/icons/docs/apache_http_server/16@2x.png new file mode 100644 index 00000000..aa1cae78 Binary files /dev/null and b/public/icons/docs/apache_http_server/16@2x.png differ diff --git a/public/icons/docs/apache_http_server/SOURCE b/public/icons/docs/apache_http_server/SOURCE new file mode 100644 index 00000000..c7afcce2 --- /dev/null +++ b/public/icons/docs/apache_http_server/SOURCE @@ -0,0 +1 @@ +https://github.com/Kapeli/Dash-X-Platform-Resources/blob/master/docset_icons/apache%402x.png