Update Docker documentation (1.13)

pull/566/merge
Thibaut Courouble 8 years ago
parent 4e41ed9f25
commit d4d1b37626

@ -20,6 +20,7 @@ app.views.CoffeescriptPage =
app.views.CordovaPage = app.views.CordovaPage =
app.views.CrystalPage = app.views.CrystalPage =
app.views.D3Page = app.views.D3Page =
app.views.DockerPage =
app.views.DrupalPage = app.views.DrupalPage =
app.views.ElixirPage = app.views.ElixirPage =
app.views.EmberPage = app.views.EmberPage =

@ -11,10 +11,23 @@ module Docs
at_css('h2').name = 'h1' unless at_css('h1') at_css('h2').name = 'h1' unless at_css('h1')
css('.anchorLink').remove 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

@ -1,15 +1,22 @@
module Docs module Docs
class Docker class Docker
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
NAME_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
def get_name def get_name
return 'Engine' if subpath == 'engine/' return NAME_BY_SUBPATH[subpath] if NAME_BY_SUBPATH[subpath]
return at_css('h1').content unless nav_link
name = nav_link.content.strip 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\/./
else else
name << " (#{product})" if name !~ /#{product}/i name << " (#{product})" if name !~ /#{product}/i
@ -18,18 +25,30 @@ module Docs
name name
end end
TYPE_BY_SUBPATH = {
'engine/' => 'Engine',
'compose/' => 'Compose',
'machine/' => 'Machine'
}
def get_type def get_type
return 'Engine' if subpath == 'engine/' 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('.menu-open').to_a.reverse.to_a[0..1].map do |node| leaves = nav_link.ancestors('li.leaf').reverse
node.at_css('> a').content.strip return product if leaves.length <= 2
end.join(': ')
type = self.name if type.empty? 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

@ -9,34 +9,39 @@ module Docs
options[:trailing_slash] = true options[:trailing_slash] = true
options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//] options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//]
options[:skip_patterns] = [/\Aengine\/api\/v/, /\Aengine\/installation/]
options[:skip] = %w( options[:skip] = %w(
swarm/scheduler/ /
swarm/swarm_at_scale/
swarm/reference/
engine/installation/linux/
engine/installation/cloud/
engine/installation/
engine/tutorials/
engine/userguide/ engine/userguide/
engine/extend/
engine/examples/ engine/examples/
engine/reference/ engine/reference/
engine/reference/api/ engine/reference/api/
engine/security/ engine/reference/api/docker_remote_api_v1.24/
engine/security/trust/
engine/getstarted/linux_install_help/ engine/getstarted/linux_install_help/
machine/reference/ machine/reference/
machine/drivers/ machine/drivers/
machine/examples/ machine/examples/
compose/reference/ compose/reference/
) # index pages )
options[:fix_urls] = ->(url) do
url.sub! %r{\.md/?(?=#|\z)}, '/'
url.sub! '/index/', '/'
url
end
options[:replace_paths] = { options[:replace_paths] = {
'engine/installation/ubuntulinux/' => 'engine/installation/linux/ubuntulinux/',
'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/', 'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/',
'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/',
'engine/reference/logging/overview/' => 'engine/admin/logging/overview/', 'engine/reference/logging/overview/' => 'engine/admin/logging/overview/',
'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/' '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 options[:attribution] = <<-HTML
@ -46,9 +51,18 @@ module Docs
Docker, Inc. and other parties may also have trademark rights in other terms used herein. Docker, Inc. and other parties may also have trademark rights in other terms used herein.
HTML HTML
version '1.13' do
self.release = '1.13'
self.base_url = 'https://docs.docker.com/'
html_filters.push 'docker/entries', 'docker/clean_html'
options[:container] = '.container-fluid .row'
end
version '1.12' do version '1.12' do
self.release = '1.12' self.release = '1.12'
self.base_url = 'https://docs.docker.com/' # self.base_url = 'https://docs.docker.com/'
html_filters.push 'docker/entries', 'docker/clean_html' html_filters.push 'docker/entries', 'docker/clean_html'

Loading…
Cancel
Save