Update Docker documentation (17.06)

pull/669/head
Thibaut Courouble 8 years ago
parent 0e134dabdb
commit 437eb8dd54

@ -210,9 +210,9 @@ credits = [
'https://raw.githubusercontent.com/django/django/master/LICENSE' 'https://raw.githubusercontent.com/django/django/master/LICENSE'
], [ ], [
'Docker', 'Docker',
'2013-2016 Docker, Inc.<br>Docker and the Docker logo are trademarks of Docker, Inc.', '2017 Docker, Inc.<br>Docker and the Docker logo are trademarks of Docker, Inc.',
'Apache', 'Apache',
'https://raw.githubusercontent.com/docker/docker/master/LICENSE' 'https://raw.githubusercontent.com/docker/docker.github.io/master/LICENSE'
], [ ], [
'Dojo', 'Dojo',
'2005-2017 JS Foundation', '2005-2017 JS Foundation',

@ -7,7 +7,7 @@ module Docs
return doc return doc
end end
@doc = at_css('#DocumentationText') @doc = at_css('main .section')
at_css('h2').name = 'h1' unless at_css('h1') at_css('h2').name = 'h1' unless at_css('h1')
@ -30,8 +30,14 @@ module Docs
node.content = node.content.gsub(/\s+/, ' ').strip node.content = node.content.gsub(/\s+/, ' ').strip
end end
css('> span').each do |node|
node.name = 'p'
node.remove_attribute('style')
end
doc doc
end end
end end
end end
end end

@ -7,12 +7,27 @@ module Docs
return doc return doc
end end
@doc = at_css('#content') @doc = at_css('#DocumentationText')
at_css('h2').name = 'h1' unless at_css('h1') at_css('h2').name = 'h1' unless at_css('h1')
css('.anchorLink', '.reading-time', 'hr', '> div[style*="margin-top"]:last-child').remove
css('h1 + h1').each do |node|
node.name = 'h2'
end
css('pre').each do |node| css('pre').each do |node|
node.content = node.content node.content = node.content
node['data-language'] = node.parent['class'][/language-(\w+)/, 1] if node.parent['class']
end
css('div.highlighter-rouge').each do |node|
node.before(node.children).remove
end
css('code.highlighter-rouge').each do |node|
node.content = node.content.gsub(/\s+/, ' ').strip
end end
doc doc

@ -0,0 +1,22 @@
module Docs
class Docker
class CleanHtmlVeryOldFilter < Filter
def call
if root_page?
doc.inner_html = "<h1>Docker Documentation</h1>"
return doc
end
@doc = at_css('#content')
at_css('h2').name = 'h1' unless at_css('h1')
css('pre').each do |node|
node.content = node.content
end
doc
end
end
end
end

@ -4,7 +4,8 @@ module Docs
NAME_BY_SUBPATH = { NAME_BY_SUBPATH = {
'engine/' => 'Engine', 'engine/' => 'Engine',
'compose/' => 'Compose', 'compose/' => 'Compose',
'machine/' => 'Machine' 'machine/' => 'Machine',
'notary/' => 'Notary'
} }
def get_name def get_name
@ -19,52 +20,26 @@ module Docs
name.prepend 'docker-compose ' if subpath =~ /compose\/reference\/./ name.prepend 'docker-compose ' if subpath =~ /compose\/reference\/./
name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./ name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./
else else
name << " (#{product})" if name !~ /#{product}/i name << " (#{product})" if name !~ /#{product}/i && !subpath.start_with?('get-started')
end end
name name
end end
TYPE_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
def get_type def get_type
return TYPE_BY_SUBPATH[subpath] if TYPE_BY_SUBPATH[subpath] return NAME_BY_SUBPATH[subpath] if NAME_BY_SUBPATH[subpath]
return 'Get Started' if subpath.start_with?('get-started')
return 'Engine: CLI' if subpath.start_with?('engine/reference/commandline/') return 'Engine: CLI' if subpath.start_with?('engine/reference/commandline/')
return 'Engine: Admin Guide' if subpath.start_with?('engine/admin/') return 'Engine: Admin Guide' if subpath.start_with?('engine/admin/')
return 'Engine: Security' if subpath.start_with?('engine/security/') return 'Engine: Security' if subpath.start_with?('engine/security/')
return 'Engine: Extend' if subpath.start_with?('engine/extend/') return 'Engine: Extend' if subpath.start_with?('engine/extend/')
return 'Engine: Get Started' if subpath.start_with?('engine/getstarted')
return 'Engine: Tutorials' if subpath.start_with?('engine/tutorials/') return 'Engine: Tutorials' if subpath.start_with?('engine/tutorials/')
return product if !nav_link && subpath =~ /\A\w+\/[\w\-]+\/\z/ product
leaves = nav_link.ancestors('li.leaf').reverse
return product if leaves.length <= 2
type = leaves[0..1].map { |node| node.at_css('> a').content.strip }.join(': ')
type.remove! %r{\ADocker }
type.remove! ' Engine'
type.sub! %r{Command[\-\s]line reference}i, 'CLI'
type.sub! 'CLI reference', 'CLI'
type
end end
def nav_link def nav_link
return @nav_link if defined?(@nav_link) return @nav_link if defined?(@nav_link)
@nav_link = at_css('.currentPage') @nav_link = at_css('.currentPage')
unless @nav_link
link = at_css('#DocumentationText li a')
return unless link
link = at_css(".docsidebarnav_section a[href='#{link['href']}']")
return unless link
@nav_link = link.ancestors('.menu-closed').first.at_css('a')
end
@nav_link
end end
def product def product

@ -1,15 +1,23 @@
module Docs module Docs
class Docker class Docker
class EntriesOldFilter < Docs::EntriesFilter class EntriesOldFilter < Docs::EntriesFilter
NAME_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
def get_name def get_name
name = nav_link ? nav_link.content.strip : at_css('#content h1').content.strip return NAME_BY_SUBPATH[subpath] if NAME_BY_SUBPATH[subpath]
return at_css('h1').content unless nav_link
name = nav_link.content.strip
name.capitalize! if name == 'exoscale' name.capitalize! if name == 'exoscale'
name.remove! ' (base command)'
if name =~ /\A[a-z\-\s]+\z/ 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-compose ' if subpath =~ /compose\/reference\/./
name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./ name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./
name.prepend 'swarm ' if subpath =~ /swarm\/reference\/./ && name != 'swarm'
else else
name << " (#{product})" if name !~ /#{product}/i name << " (#{product})" if name !~ /#{product}/i
end end
@ -17,32 +25,43 @@ module Docs
name name
end end
TYPE_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
def get_type def get_type
unless nav_link return TYPE_BY_SUBPATH[subpath] if TYPE_BY_SUBPATH[subpath]
return 'Engine: User guide' if subpath.start_with?('engine/userguide') return 'Engine: CLI' if subpath.start_with?('engine/reference/commandline/')
end return 'Engine: Admin Guide' if subpath.start_with?('engine/admin/')
return 'Engine: Security' if subpath.start_with?('engine/security/')
return 'Engine: Extend' if subpath.start_with?('engine/extend/')
return 'Engine: Get Started' if subpath.start_with?('engine/getstarted')
return 'Engine: Tutorials' if subpath.start_with?('engine/tutorials/')
return product if !nav_link && subpath =~ /\A\w+\/[\w\-]+\/\z/
type = nav_link.ancestors('article').to_a.reverse.to_a[0..1].map do |node| leaves = nav_link.ancestors('li.leaf').reverse
node.at_css('> button').content.strip return product if leaves.length <= 2
end.join(': ')
type = leaves[0..1].map { |node| node.at_css('> a').content.strip }.join(': ')
type.remove! %r{\ADocker } type.remove! %r{\ADocker }
type.remove! %r{ Engine} type.remove! ' Engine'
type.sub! %r{Command[\-\s]line reference}i, 'CLI' type.sub! %r{Command[\-\s]line reference}i, 'CLI'
type = 'Engine: Reference' if type == 'Engine: reference' type.sub! 'CLI reference', 'CLI'
type type
end end
def nav_link def nav_link
return @nav_link if defined?(@nav_link) return @nav_link if defined?(@nav_link)
@nav_link = at_css('#multiple .active') @nav_link = at_css('.currentPage')
unless @nav_link unless @nav_link
link = at_css('#content li a') link = at_css('#DocumentationText li a')
return unless link return unless link
link = at_css("#multiple a[href='#{link['href']}']") link = at_css(".docsidebarnav_section a[href='#{link['href']}']")
return unless link return unless link
@nav_link = link.ancestors('article').first.at_css('button') @nav_link = link.ancestors('.menu-closed').first.at_css('a')
end end
@nav_link @nav_link

@ -0,0 +1,56 @@
module Docs
class Docker
class EntriesVeryOldFilter < Docs::EntriesFilter
def get_name
name = nav_link ? nav_link.content.strip : at_css('#content h1').content.strip
name.capitalize! if name == 'exoscale'
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
name
end
def get_type
unless nav_link
return 'Engine: User guide' if subpath.start_with?('engine/userguide')
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
end

@ -8,9 +8,62 @@ module Docs
options[:trailing_slash] = true options[:trailing_slash] = true
options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//] options[:fix_urls] = ->(url) do
options[:skip_patterns] = [/\Aengine\/api\/v/, /\Aengine\/installation/] url.sub! %r{\.md/?(?=#|\z)}, '/'
options[:skip] = %w( url.sub! '/index/', '/'
url
end
options[:attribution] = <<-HTML
&copy; 2017 Docker, Inc.<br>
Licensed under the Apache License, Version 2.0.<br>
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
HTML
version '17' do
self.release = '17.06'
self.base_url = 'https://docs.docker.com/'
html_filters.push 'docker/entries', 'docker/clean_html'
options[:container] = '.wrapper .container-fluid .row'
options[:only_patterns] = [/\Aget-started\//, /\Aengine\//, /\Acompose\//, /\Amachine\//, /\Anotary\//]
options[:skip_patterns] = [/\Aengine\/api\/v/, /glossary/, /docker-ee/]
options[:replace_paths] = {
'engine/installation/linux/docker-ee/linux-postinstall/' => 'engine/installation/linux/linux-postinstall/',
'engine/installation/linux/docker-ee/' => 'engine/installation/',
'engine/installation/linux/docker-ce/' => 'engine/installation/',
'engine/installation/linux/' => 'engine/installation/',
'engine/installation/windows/' => 'engine/installation/',
'engine/userguide/intro/' => 'engine/userguide/',
'engine/tutorials/dockervolumes/' => 'engine/admin/volumes/volumes/',
'engine/getstarted/' => 'get-started/',
'engine/tutorials/dockerimages/' => 'get-started/',
'engine/tutorials/dockerrepos/' => 'get-started/',
'engine/admin/host_integration/' => 'engine/admin/start-containers-automatically/',
'engine/installation/linux/rhel/' => 'engine/installation/linux/docker-ee/rhel/',
'engine/installation/linux/ubuntulinux/' => 'engine/installation/linux/docker-ee/ubuntu/',
'engine/installation/linux/suse/' => 'engine/installation/linux/docker-ee/suse/',
'engine/admin/logging/' => 'engine/admin/logging/view_container_logs/',
'engine/swarm/how-swarm-mode-works/' => 'engine/swarm/how-swarm-mode-works/nodes/',
'engine/installation/binaries/' => 'engine/installation/linux/docker-ce/binaries/',
'engine/reference/commandline/' => 'engine/reference/commandline/docker/',
'engine/reference/api/' => 'engine/api/',
'engine/userguide/dockervolumes/' => 'engine/admin/volumes/volumes/',
'engine/understanding-docker/' => 'engine/docker-overview/',
'engine/reference/commandline/swarm_join_token/' => 'engine/reference/commandline/swarm_join-token/',
'engine/api/getting-started/' => 'engine/api/get-started/',
}
end
module OldOptions
def self.included(klass)
klass.options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//]
klass.options[:skip_patterns] = [/\Aengine\/api\/v/, /\Aengine\/installation/]
klass.options[:skip] = %w(
/ /
engine/userguide/ engine/userguide/
engine/examples/ engine/examples/
@ -23,14 +76,7 @@ module Docs
machine/examples/ machine/examples/
compose/reference/ compose/reference/
) )
klass.options[:replace_paths] = {
options[:fix_urls] = ->(url) do
url.sub! %r{\.md/?(?=#|\z)}, '/'
url.sub! '/index/', '/'
url
end
options[:replace_paths] = {
'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/', 'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/',
'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/', 'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/',
'engine/reference/logging/overview/' => 'engine/admin/logging/overview/', 'engine/reference/logging/overview/' => 'engine/admin/logging/overview/',
@ -43,47 +89,50 @@ module Docs
'engine/tutorials/dockerimages/' => 'engine/getstarted/step_four/', 'engine/tutorials/dockerimages/' => 'engine/getstarted/step_four/',
'engine/tutorials/dockerrepos/' => 'engine/getstarted/step_six/' 'engine/tutorials/dockerrepos/' => 'engine/getstarted/step_six/'
} }
end
options[:attribution] = <<-HTML end
&copy; 2013&ndash;2016 Docker, Inc.<br>
Licensed under the Apache License, Version 2.0.<br>
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
HTML
version '1.13' do version '1.13' do
include OldOptions
self.release = '1.13' self.release = '1.13'
self.base_url = 'https://docs.docker.com/' self.base_url = "https://docs.docker.com/v#{self.version}/"
html_filters.push 'docker/entries', 'docker/clean_html' html_filters.push 'docker/entries_old', 'docker/clean_html_old'
options[:container] = '.container-fluid .row' options[:container] = '.container-fluid .row'
end end
version '1.12' do version '1.12' do
include OldOptions
self.release = '1.12' self.release = '1.12'
# self.base_url = 'https://docs.docker.com/' self.base_url = "https://docs.docker.com/v#{self.version}/"
html_filters.push 'docker/entries', 'docker/clean_html' html_filters.push 'docker/entries_old', 'docker/clean_html_old'
options[:container] = '.container-fluid .row' options[:container] = '.container-fluid .row'
end end
version '1.11' do version '1.11' do
include OldOptions
self.release = '1.11' self.release = '1.11'
self.base_url = "https://docs.docker.com/v#{self.version}/" self.base_url = "https://docs.docker.com/v#{self.version}/"
html_filters.push 'docker/entries_old', 'docker/clean_html_old' html_filters.push 'docker/entries_very_old', 'docker/clean_html_very_old'
options[:container] = '#docs' options[:container] = '#docs'
options[:only_patterns] << /\Aswarm\// options[:only_patterns] << /\Aswarm\//
end end
version '1.10' do version '1.10' do
include OldOptions
self.release = '1.10' self.release = '1.10'
self.base_url = "https://docs.docker.com/v#{self.version}/" self.base_url = "https://docs.docker.com/v#{self.version}/"
html_filters.push 'docker/entries_old', 'docker/clean_html_old' html_filters.push 'docker/entries_very_old', 'docker/clean_html_very_old'
options[:container] = '#docs' options[:container] = '#docs'
options[:only_patterns] << /\Aswarm\// options[:only_patterns] << /\Aswarm\//

Loading…
Cancel
Save