diff --git a/assets/images/icons.png b/assets/images/icons.png
index e451327b..ac4af351 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 33d88791..2e16040d 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 fb092787..0404492c 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,7 +1,7 @@
[
[
- "2016-02-14",
- "New documentation: CakePHP"
+ "2016-02-15",
+ "New documentations: CakePHP and Chef"
], [
"2016-01-31",
"New documentations: Erlang and Tcl/Tk"
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index c700c6c9..735e76cc 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -109,6 +109,11 @@ credits = [
'2011-2015 Jake Luer',
'MIT',
'https://github.com/chaijs/chai/blob/master/README.md#license'
+ ], [
+ 'Chef™',
+ 'Chef Software, Inc.',
+ 'CC BY',
+ 'https://raw.githubusercontent.com/chef/chef-web-docs-2016/master/LICENSE'
], [
'Clojure',
'Rich Hickey',
diff --git a/assets/javascripts/views/pages/sphinx_simple.coffee b/assets/javascripts/views/pages/sphinx_simple.coffee
new file mode 100644
index 00000000..971c25ed
--- /dev/null
+++ b/assets/javascripts/views/pages/sphinx_simple.coffee
@@ -0,0 +1,7 @@
+#= require views/pages/base
+
+class app.views.SphinxSimplePage extends app.views.BasePage
+ prepare: ->
+ @highlightCode @findAll('pre.highlight-ruby'), 'ruby'
+ @highlightCode @findAll('pre.highlight-javascript'), 'javascript'
+ return
diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss
index 99cb1ada..daa53fb9 100644
--- a/assets/stylesheets/application-dark.css.scss
+++ b/assets/stylesheets/application-dark.css.scss
@@ -35,7 +35,6 @@
'pages/c',
'pages/cakephp',
'pages/chai',
- 'pages/chef',
'pages/clojure',
'pages/coffeescript',
'pages/d3',
@@ -59,7 +58,6 @@
'pages/nginx',
'pages/node',
'pages/npm',
- 'pages/opentsdb',
'pages/phalcon',
'pages/phaser',
'pages/php',
@@ -75,6 +73,7 @@
'pages/rust',
'pages/socketio',
'pages/sphinx',
+ 'pages/sphinx_simple',
'pages/tcl_tk',
'pages/underscore',
'pages/vagrant',
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 2352df26..5a047bb8 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -35,7 +35,6 @@
'pages/c',
'pages/cakephp',
'pages/chai',
- 'pages/chef',
'pages/clojure',
'pages/coffeescript',
'pages/d3',
@@ -59,7 +58,6 @@
'pages/nginx',
'pages/node',
'pages/npm',
- 'pages/opentsdb',
'pages/phalcon',
'pages/phaser',
'pages/php',
@@ -75,6 +73,7 @@
'pages/rust',
'pages/socketio',
'pages/sphinx',
+ 'pages/sphinx_simple',
'pages/tcl_tk',
'pages/underscore',
'pages/vagrant',
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 6b3c51be..385f03fe 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -124,3 +124,4 @@
._icon-phoenix:before { background-position: -9rem -9rem; }
._icon-tcl_tk:before { background-position: 0 -10rem; }
._icon-erlang:before { background-position: -1rem -10rem; }
+._icon-chef:before { background-position: -2rem -10rem; }
diff --git a/assets/stylesheets/pages/_chef.scss b/assets/stylesheets/pages/_chef.scss
index 42c15758..1314c403 100644
--- a/assets/stylesheets/pages/_chef.scss
+++ b/assets/stylesheets/pages/_chef.scss
@@ -1,4 +1,8 @@
._chef {
@extend %simple;
-}
\ No newline at end of file
+ .note, .warning { @extend %note; }
+ .warning { @extend %note, %note-red; }
+
+ code { @extend %label; }
+}
diff --git a/assets/stylesheets/pages/_opentsdb.scss b/assets/stylesheets/pages/_sphinx_simple.scss
similarity index 79%
rename from assets/stylesheets/pages/_opentsdb.scss
rename to assets/stylesheets/pages/_sphinx_simple.scss
index 308f1c46..7aa27442 100644
--- a/assets/stylesheets/pages/_opentsdb.scss
+++ b/assets/stylesheets/pages/_sphinx_simple.scss
@@ -1,4 +1,4 @@
-._opentsdb {
+._sphinx_simple {
@extend %simple;
.admonition { @extend %note; }
@@ -7,4 +7,6 @@
margin: 0 0 .25rem;
font-weight: bold;
}
+
+ code { @extend %label; }
}
diff --git a/lib/docs/core/response.rb b/lib/docs/core/response.rb
index c9477f27..64ecc302 100644
--- a/lib/docs/core/response.rb
+++ b/lib/docs/core/response.rb
@@ -5,7 +5,7 @@ module Docs
end
def error?
- code != 404 && code >= 400 && code <= 599
+ code != 404 && code != 403 && code >= 400 && code <= 599
end
def empty?
diff --git a/lib/docs/core/scraper.rb b/lib/docs/core/scraper.rb
index 0ca8059b..9f973c8a 100644
--- a/lib/docs/core/scraper.rb
+++ b/lib/docs/core/scraper.rb
@@ -13,6 +13,7 @@ module Docs
autoload_all "docs/filters/#{to_s.demodulize.underscore}", 'filter'
end
+ subclass.base_url = base_url
subclass.root_path = root_path
subclass.initial_paths = initial_paths.dup
subclass.options = options.deep_dup
diff --git a/lib/docs/filters/chef/clean_html.rb b/lib/docs/filters/chef/clean_html.rb
index 5d79623b..05c4e713 100644
--- a/lib/docs/filters/chef/clean_html.rb
+++ b/lib/docs/filters/chef/clean_html.rb
@@ -2,7 +2,33 @@ module Docs
class Chef
class CleanHtmlFilter < Filter
def call
- css('h1 a', 'h2 a', 'h3 a','div.footer').remove
+ @doc = at_css('div[role="main"]')
+
+ css('.headerlink').remove
+
+ css('em', 'div.align-center', 'a[href$=".svg"]').each do |node|
+ node.before(node.children).remove
+ end
+
+ css('.section').each do |node|
+ node.first_element_child['id'] = node['id'] if node['id']
+ node.before(node.children).remove
+ end
+
+ css('tt').each do |node|
+ node.content = node.content.strip
+ node.name = 'code'
+ end
+
+ css('table[border]').each do |node|
+ node.remove_attribute('border')
+ end
+
+ css('div[class^="highlight-"]').each do |node|
+ node.content = node.content.strip
+ node.name = 'pre'
+ end
+
doc
end
end
diff --git a/lib/docs/filters/chef/entries.rb b/lib/docs/filters/chef/entries.rb
index 0c52fcf9..3c28a2eb 100644
--- a/lib/docs/filters/chef/entries.rb
+++ b/lib/docs/filters/chef/entries.rb
@@ -2,8 +2,60 @@ module Docs
class Chef
class EntriesFilter < Docs::EntriesFilter
def get_name
- at_css('div.body h1 a').remove
- at_css('div.body h1').content
+ name = at_css('.body h1').content
+ name.remove! "\u{00b6}"
+ name.remove! 'About the '
+ name.remove! 'About '
+ name
+ end
+
+ CLIENT_TYPE_BY_SLUG_END_WITH = {
+ 'knife_common_options' => 'Knife Commands',
+ 'knife_using' => 'Knife Commands',
+ 'resource_common' => 'Chef Resources',
+ 'config_rb_knife_optional_settings' => 'Config Files'
+ }
+
+ SERVER_TYPE_BY_SLUG_END_WITH = {
+ 'auth' => 'Theory & Concepts',
+ 'install_server_pre' => 'Setup & Config',
+ 'config_rb_server_optional_settings' => 'Config Files'
+ }
+
+ def get_type
+ if server_page?
+ SERVER_TYPE_BY_SLUG_END_WITH.each do |key, value|
+ return "Chef Server / #{value}" if slug.end_with?(key)
+ end
+ else
+ CLIENT_TYPE_BY_SLUG_END_WITH.each do |key, value|
+ return value if slug.end_with?(key)
+ end
+ end
+
+ path = nav_path
+ path.delete('Reference')
+ path = path[0..0]
+ path.unshift('Chef Server') if server_page?
+
+ type = path.join(' / ')
+ type.sub 'Cookbooks / Cookbook', 'Cookbooks /'
+ type
+ end
+
+ def server_page?
+ slug.start_with?(context[:server_path])
+ end
+
+ def nav_path
+ node = at_css(".nav-docs a[href='#{result[:path].split('/').last}']")
+ path = []
+ until node['class'] && node['class'].include?('main-item')
+ path.unshift(node.first_element_child.content.strip) if node['class'] && node['class'].include?('has-sub-items')
+ node = node.parent
+ end
+ path.unshift(node.first_element_child.content.strip)
+ path
end
end
end
diff --git a/lib/docs/scrapers/chef.rb b/lib/docs/scrapers/chef.rb
index 9ed4ae3c..f5942f82 100644
--- a/lib/docs/scrapers/chef.rb
+++ b/lib/docs/scrapers/chef.rb
@@ -1,27 +1,50 @@
module Docs
class Chef < UrlScraper
- self.name = 'Chef'
- self.slug = 'chef'
- self.type = 'chef'
- self.version = '12.5'
- self.base_url = 'https://docs.chef.io/'
+ self.type = 'sphinx_simple'
+ self.base_url = 'https://docs.chef.io/release/'
self.links = {
home: 'https://www.chef.io/',
- docs: 'https://docs.chef.io/'
+ code: 'https://github.com/chef/chef'
}
html_filters.push 'chef/entries', 'chef/clean_html'
- options[:container] = '.bodywrapper'
-
- options[:only_patterns] = [/resource_.*.html/]
- options[:skip_patterns] = [/resource_common\.html/]
-
- options[:trailing_slash] = false
+ options[:skip_patterns] = [
+ /\A[^\/]+\/\z/,
+ /\A[^\/]+\/index\.html\z/,
+ /\A[^\/]+\/release_notes\.html\z/,
+ /\Aserver[^\/]+\/chef_overview\.html\z/ ]
options[:attribution] = <<-HTML
- © 2015 Chef Software, Inc.
- Creative Commons Attribution 3.0 Unported License.
+ © Chef Software, Inc.
+ Licensed under the Creative Commons Attribution 3.0 Unported License.
+ The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/service
+ marks of Chef, in the United States and other countries and are used with Chef Inc's permission.
+ We are not affiliated with, endorsed or sponsored by Chef Inc.
HTML
+
+ version '12' do
+ self.release = '12.7'
+
+ options[:client_path] = client_path = '12-7'
+ options[:server_path] = server_path = 'server_12-4'
+
+ self.root_path = "#{client_path}/chef_overview.html"
+ self.initial_paths = ["#{server_path}/server_components.html"]
+
+ options[:only_patterns] = [/\A#{client_path}\//, /\A#{server_path}\//]
+ end
+
+ version '11' do
+ self.release = '11.18'
+
+ options[:client_path] = client_path = '11-18'
+ options[:server_path] = server_path = 'server_12-4'
+
+ self.root_path = "#{client_path}/chef_overview.html"
+ self.initial_paths = ["#{server_path}/server_components.html"]
+
+ options[:only_patterns] = [/\A#{client_path}\//, /\A#{server_path}\//]
+ end
end
end
diff --git a/public/icons/docs/chef/16.png b/public/icons/docs/chef/16.png
index e7792f94..6c4dc7db 100644
Binary files a/public/icons/docs/chef/16.png and b/public/icons/docs/chef/16.png differ
diff --git a/public/icons/docs/chef/16@2x.png b/public/icons/docs/chef/16@2x.png
index 5c8d5c30..a115f432 100644
Binary files a/public/icons/docs/chef/16@2x.png and b/public/icons/docs/chef/16@2x.png differ
diff --git a/public/icons/docs/chef/SOURCE b/public/icons/docs/chef/SOURCE
index 8d21f1f4..21cb5c3c 100644
--- a/public/icons/docs/chef/SOURCE
+++ b/public/icons/docs/chef/SOURCE
@@ -1 +1 @@
-http://style.chef.io/assets/images/downloads/Chef_Regular.png
\ No newline at end of file
+https://www.chef.io/
\ No newline at end of file