diff --git a/assets/images/docs.png b/assets/images/docs.png index d1161c88..3c6fe660 100644 Binary files a/assets/images/docs.png and b/assets/images/docs.png differ diff --git a/assets/images/docs@2x.png b/assets/images/docs@2x.png index 6ccbcde5..546e2227 100644 Binary files a/assets/images/docs@2x.png and b/assets/images/docs@2x.png differ diff --git a/assets/javascripts/collections/types.coffee b/assets/javascripts/collections/types.coffee index 4b5b4ef3..0f5cbd9a 100644 --- a/assets/javascripts/collections/types.coffee +++ b/assets/javascripts/collections/types.coffee @@ -7,7 +7,7 @@ class app.collections.Types extends app.Collection (result[@_groupFor(type)] ||= []).push(type) result.filter (e) -> e.length > 0 - GUIDES_RGX = /(^|[\s\(])(guides?|tutorials?|reference|book|getting\ started|manual)($|[\s\):])/i + GUIDES_RGX = /(^|\()(guides?|tutorials?|reference|book|getting\ started|manual)($|[\):])/i _groupFor: (type) -> if GUIDES_RGX.test(type.name) diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index a541571c..09b2c1d2 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2016-08-07", + "New documentation: Docker" + ], [ "2016-07-31", "New documentations: Bootstrap 3 and Bootstrap 4" ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index cdf4723c..1988d1ff 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -179,6 +179,11 @@ credits = [ 'Django Software Foundation and individual contributors', 'BSD', 'https://raw.githubusercontent.com/django/django/master/LICENSE' + ], [ + 'Docker', + '2013-2016 Docker, Inc.
Docker and the Docker logo are trademarks of Docker, Inc.', + 'Apache', + 'https://raw.githubusercontent.com/docker/docker/master/LICENSE' ], [ 'Dojo', '2005-2015 The Dojo Foundation', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 56a2b589..9eaa8673 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -116,6 +116,7 @@ ._icon-socketio:before { background-position: -2rem -6rem; } ._icon-modernizr:before { background-position: -3rem -6rem; } ._icon-bower:before { background-position: -4rem -6rem; } +._icon-docker:before { background-position: -1rem -7rem; } ._icon-cakephp:before { background-position: -2rem -7rem; } ._icon-lua:before { background-position: -3rem -7rem; @extend %darkIconFix !optional; } ._icon-clojure:before { background-position: -4rem -7rem; } diff --git a/lib/docs/filters/docker/clean_html.rb b/lib/docs/filters/docker/clean_html.rb index bfc4e3ca..4237c7b7 100644 --- a/lib/docs/filters/docker/clean_html.rb +++ b/lib/docs/filters/docker/clean_html.rb @@ -3,14 +3,13 @@ module Docs class CleanHtmlFilter < Filter def call if root_page? - @doc = at_css('.tabs-content') - else - @doc = at_css('#content') + doc.inner_html = "

Docker Documentation

" + return doc end - if not at_css('h1') - at_css('h2').name = 'h1' - end + @doc = at_css('#content') + + at_css('h2').name = 'h1' unless at_css('h1') css('pre').each do |node| node.content = node.content diff --git a/lib/docs/filters/docker/entries.rb b/lib/docs/filters/docker/entries.rb index 8e4a5946..089f9e16 100644 --- a/lib/docs/filters/docker/entries.rb +++ b/lib/docs/filters/docker/entries.rb @@ -2,20 +2,56 @@ module Docs class Docker class EntriesFilter < Docs::EntriesFilter def get_name - title = at_css('h1').content + name = nav_link ? nav_link.content.strip : at_css('#content h1').content.strip + name.capitalize! if name == 'exoscale' - title = title.split(' — ').first - title = title.split(' - ').first + if name =~ /\A[a-z\-\s]+\z/ + name.prepend 'docker ' if subpath =~ /engine\/reference\/commandline\/./ + name.prepend 'docker-compose ' if subpath =~ /compose\/reference\/./ + name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./ + name.prepend 'swarm ' if subpath =~ /swarm\/reference\/./ && name != 'swarm' + else + name << " (#{product})" if name !~ /#{product}/i + end - title + name end def get_type - if slug.count('/') == 1 or slug.count('/') == 2 - slug.split('/').first.capitalize - else - slug.split('/')[0...-1].map(&:capitalize).join('/').gsub(/\-|\_/, ' ') + unless nav_link + return 'Engine: User guide' if subpath.start_with?('engine/userguide') + return 'Engine: Secure' if subpath.start_with?('engine/security') + return 'Engine' if subpath == 'engine/' + end + + type = nav_link.ancestors('article').to_a.reverse.to_a[0..1].map do |node| + node.at_css('> button').content.strip + end.join(': ') + + type.remove! %r{\ADocker } + type.remove! %r{ Engine} + type.sub! %r{Command[\-\s]line reference}i, 'CLI' + type = 'Engine: Reference' if type == 'Engine: reference' + type + end + + def nav_link + return @nav_link if defined?(@nav_link) + @nav_link = at_css('#multiple .active') + + unless @nav_link + link = at_css('#content li a') + return unless link + link = at_css("#multiple a[href='#{link['href']}']") + return unless link + @nav_link = link.ancestors('article').first.at_css('button') end + + @nav_link + end + + def product + @product ||= subpath.split('/').first.capitalize end end end diff --git a/lib/docs/scrapers/docker.rb b/lib/docs/scrapers/docker.rb index 7781471a..635247f3 100644 --- a/lib/docs/scrapers/docker.rb +++ b/lib/docs/scrapers/docker.rb @@ -1,16 +1,14 @@ module Docs class Docker < UrlScraper - self.name = 'Docker' - self.slug = 'docker' self.type = 'docker' - self.links = { home: 'https://docker.com/', code: 'https://github.com/docker/docker' } - html_filters.push 'docker/clean_html', 'docker/entries' + html_filters.push 'docker/entries', 'docker/clean_html' + options[:container] = '#docs' options[:trailing_slash] = true options[:only_patterns] = [ @@ -19,14 +17,16 @@ module Docs /\Amachine\//, /\Aswarm\// ] - - options[:skip] = [ - "engine/installation/ubuntulinux/" # invalid document - ] + options[:skip] = %w(swarm/scheduler/) + options[:replace_paths] = { + 'engine/installation/ubuntulinux/' => 'engine/installation/linux/ubuntulinux/' + } options[:attribution] = <<-HTML - © 2016 Docker Inc.
- Licensed under the Apache 2 License. + © 2013–2016 Docker, Inc.
+ Licensed under the Apache License, Version 2.0.
+ Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
+ Docker, Inc. and other parties may also have trademark rights in other terms used herein. HTML version '1.11' do diff --git a/public/icons/docs/docker/16.png b/public/icons/docs/docker/16.png new file mode 100644 index 00000000..8982eefe Binary files /dev/null and b/public/icons/docs/docker/16.png differ diff --git a/public/icons/docs/docker/16@2x.png b/public/icons/docs/docker/16@2x.png new file mode 100644 index 00000000..cf78a06a Binary files /dev/null and b/public/icons/docs/docker/16@2x.png differ