Update Docker documentation (17.06)

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

@ -210,9 +210,9 @@ credits = [
'https://raw.githubusercontent.com/django/django/master/LICENSE'
], [
'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',
'https://raw.githubusercontent.com/docker/docker/master/LICENSE'
'https://raw.githubusercontent.com/docker/docker.github.io/master/LICENSE'
], [
'Dojo',
'2005-2017 JS Foundation',

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

@ -7,12 +7,27 @@ module Docs
return doc
end
@doc = at_css('#content')
@doc = at_css('#DocumentationText')
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|
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
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 = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
'machine/' => 'Machine',
'notary/' => 'Notary'
}
def get_name
@ -19,52 +20,26 @@ module Docs
name.prepend 'docker-compose ' if subpath =~ /compose\/reference\/./
name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./
else
name << " (#{product})" if name !~ /#{product}/i
name << " (#{product})" if name !~ /#{product}/i && !subpath.start_with?('get-started')
end
name
end
TYPE_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
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: 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/
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
product
end
def nav_link
return @nav_link if defined?(@nav_link)
@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
def product

@ -1,15 +1,23 @@
module Docs
class Docker
class EntriesOldFilter < Docs::EntriesFilter
NAME_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
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.remove! ' (base command)'
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 'swarm ' if subpath =~ /swarm\/reference\/./ && name != 'swarm'
else
name << " (#{product})" if name !~ /#{product}/i
end
@ -17,32 +25,43 @@ module Docs
name
end
TYPE_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
def get_type
unless nav_link
return 'Engine: User guide' if subpath.start_with?('engine/userguide')
end
return TYPE_BY_SUBPATH[subpath] if TYPE_BY_SUBPATH[subpath]
return 'Engine: CLI' if subpath.start_with?('engine/reference/commandline/')
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|
node.at_css('> button').content.strip
end.join(': ')
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! %r{ Engine}
type.remove! ' Engine'
type.sub! %r{Command[\-\s]line reference}i, 'CLI'
type = 'Engine: Reference' if type == 'Engine: reference'
type.sub! 'CLI reference', 'CLI'
type
end
def nav_link
return @nav_link if defined?(@nav_link)
@nav_link = at_css('#multiple .active')
@nav_link = at_css('.currentPage')
unless @nav_link
link = at_css('#content li a')
link = at_css('#DocumentationText li a')
return unless link
link = at_css("#multiple a[href='#{link['href']}']")
link = at_css(".docsidebarnav_section a[href='#{link['href']}']")
return unless link
@nav_link = link.ancestors('article').first.at_css('button')
@nav_link = link.ancestors('.menu-closed').first.at_css('a')
end
@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,82 +8,131 @@ module Docs
options[:trailing_slash] = true
options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//]
options[:skip_patterns] = [/\Aengine\/api\/v/, /\Aengine\/installation/]
options[:skip] = %w(
/
engine/userguide/
engine/examples/
engine/reference/
engine/reference/api/
engine/reference/api/docker_remote_api_v1.24/
engine/getstarted/linux_install_help/
machine/reference/
machine/drivers/
machine/examples/
compose/reference/
)
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/dockervolumes/' => 'engine/tutorials/dockervolumes/',
'engine/reference/logging/overview/' => 'engine/admin/logging/overview/',
'engine/reference/commandline/daemon/' => 'engine/reference/commandline/dockerd/',
'engine/reference/commandline/' => 'engine/reference/commandline/docker/',
'engine/reference/api/docker_remote_api/' => 'engine/api/',
'engine/swarm/how-swarm-mode-works/' => 'engine/swarm/how-swarm-mode-works/nodes/',
'engine/tutorials/dockerizing/' => 'engine/getstarted/step_one/',
'engine/tutorials/usingdocker/' => 'engine/getstarted/step_three/',
'engine/tutorials/dockerimages/' => 'engine/getstarted/step_four/',
'engine/tutorials/dockerrepos/' => 'engine/getstarted/step_six/'
}
options[:attribution] = <<-HTML
&copy; 2013&ndash;2016 Docker, Inc.<br>
&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 '1.13' do
self.release = '1.13'
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/examples/
engine/reference/
engine/reference/api/
engine/reference/api/docker_remote_api_v1.24/
engine/getstarted/linux_install_help/
machine/reference/
machine/drivers/
machine/examples/
compose/reference/
)
klass.options[:replace_paths] = {
'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/',
'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/',
'engine/reference/logging/overview/' => 'engine/admin/logging/overview/',
'engine/reference/commandline/daemon/' => 'engine/reference/commandline/dockerd/',
'engine/reference/commandline/' => 'engine/reference/commandline/docker/',
'engine/reference/api/docker_remote_api/' => 'engine/api/',
'engine/swarm/how-swarm-mode-works/' => 'engine/swarm/how-swarm-mode-works/nodes/',
'engine/tutorials/dockerizing/' => 'engine/getstarted/step_one/',
'engine/tutorials/usingdocker/' => 'engine/getstarted/step_three/',
'engine/tutorials/dockerimages/' => 'engine/getstarted/step_four/',
'engine/tutorials/dockerrepos/' => 'engine/getstarted/step_six/'
}
end
end
version '1.13' do
include OldOptions
self.release = '1.13'
self.base_url = "https://docs.docker.com/v#{self.version}/"
html_filters.push 'docker/entries_old', 'docker/clean_html_old'
options[:container] = '.container-fluid .row'
end
version '1.12' do
include OldOptions
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'
end
version '1.11' do
include OldOptions
self.release = '1.11'
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[:only_patterns] << /\Aswarm\//
end
version '1.10' do
include OldOptions
self.release = '1.10'
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[:only_patterns] << /\Aswarm\//

Loading…
Cancel
Save