Unified · Split
| @@ -20,6 +20,7 @@ app.views.CoffeescriptPage = · 19 unmodified lines | |||
| 20 | app.views.CordovaPage = | 20 | app.views.CordovaPage = |
| 21 | app.views.CrystalPage = | 21 | app.views.CrystalPage = |
| 22 | app.views.D3Page = | 22 | app.views.D3Page = |
| 23 | app.views.DockerPage = | ||
| 23 | app.views.DrupalPage = | 24 | app.views.DrupalPage = |
| 24 | app.views.ElixirPage = | 25 | app.views.ElixirPage = |
| 25 | app.views.EmberPage = | 26 | app.views.EmberPage = |
| @@ -11,10 +11,23 @@ module Docs · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | at_css('h2').name = 'h1' unless at_css('h1') | 12 | at_css('h2').name = 'h1' unless at_css('h1') |
| 13 | 13 | ||
| 14 | css('.anchorLink').remove | 14 | css('.anchorLink', '.reading-time', 'hr', '> div[style*="margin-top"]:last-child').remove |
| 15 | |||
| 16 | css('h1 + h1').each do |node| | ||
| 17 | node.name = 'h2' | ||
| 18 | end | ||
| 15 | 19 | ||
| 16 | css('pre').each do |node| | 20 | css('pre').each do |node| |
| 17 | node.content = node.content | 21 | node.content = node.content |
| 22 | node['data-language'] = node.parent['class'][/language-(\w+)/, 1] if node.parent['class'] | ||
| 23 | end | ||
| 24 | |||
| 25 | css('div.highlighter-rouge').each do |node| | ||
| 26 | node.before(node.children).remove | ||
| 27 | end | ||
| 28 | |||
| 29 | css('code.highlighter-rouge').each do |node| | ||
| 30 | node.content = node.content.gsub(/\s+/, ' ').strip | ||
| 18 | end | 31 | end |
| 19 | 32 | ||
| 20 | doc | 33 | doc |
| @@ -1,15 +1,22 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Docker | 2 | class Docker |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | NAME_BY_SUBPATH = { | ||
| 5 | 'engine/' => 'Engine', | ||
| 6 | 'compose/' => 'Compose', | ||
| 7 | 'machine/' => 'Machine' | ||
| 8 | } | ||
| 9 | |||
| 4 | def get_name | 10 | def get_name |
| 5 | return 'Engine' if subpath == 'engine/' | 11 | return NAME_BY_SUBPATH[subpath] if NAME_BY_SUBPATH[subpath] |
| 12 | return at_css('h1').content unless nav_link | ||
| 6 | 13 | ||
| 7 | name = nav_link.content.strip | 14 | name = nav_link.content.strip |
| 8 | name.capitalize! if name == 'exoscale' | 15 | name.capitalize! if name == 'exoscale' |
| 16 | name.remove! ' (base command)' | ||
| 9 | 17 | ||
| 10 | if name =~ /\A[a-z\-\s]+\z/ | 18 | if name =~ /\A[a-z\-\s]+\z/ |
| 11 | name.prepend 'docker ' if subpath =~ /engine\/reference\/commandline\/./ | 19 | name.prepend 'docker-compose ' if subpath =~ /compose\/reference\/./ |
| 12 | name.prepend 'docker-compose ' if subpath =~ /compose\/reference\/./ | ||
| 13 | name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./ | 20 | name.prepend 'docker-machine ' if subpath =~ /machine\/reference\/./ |
| 14 | else | 21 | else |
| 15 | name << " (#{product})" if name !~ /#{product}/i | 22 | name << " (#{product})" if name !~ /#{product}/i |
| @@ -18,18 +25,30 @@ module Docs · 2 unmodified lines | |||
| 18 | name | 25 | name |
| 19 | end | 26 | end |
| 20 | 27 | ||
| 28 | TYPE_BY_SUBPATH = { | ||
| 29 | 'engine/' => 'Engine', | ||
| 30 | 'compose/' => 'Compose', | ||
| 31 | 'machine/' => 'Machine' | ||
| 32 | } | ||
| 33 | |||
| 21 | def get_type | 34 | def get_type |
| 22 | return 'Engine' if subpath == 'engine/' | 35 | return TYPE_BY_SUBPATH[subpath] if TYPE_BY_SUBPATH[subpath] |
| 36 | return 'Engine: CLI' if subpath.start_with?('engine/reference/commandline/') | ||
| 37 | return 'Engine: Admin Guide' if subpath.start_with?('engine/admin/') | ||
| 38 | return 'Engine: Security' if subpath.start_with?('engine/security/') | ||
| 39 | return 'Engine: Extend' if subpath.start_with?('engine/extend/') | ||
| 40 | return 'Engine: Get Started' if subpath.start_with?('engine/getstarted') | ||
| 41 | return 'Engine: Tutorials' if subpath.start_with?('engine/tutorials/') | ||
| 42 | return product if !nav_link && subpath =~ /\A\w+\/[\w\-]+\/\z/ | ||
| 23 | 43 | ||
| 24 | type = nav_link.ancestors('.menu-open').to_a.reverse.to_a[0..1].map do |node| | 44 | leaves = nav_link.ancestors('li.leaf').reverse |
| 25 | node.at_css('> a').content.strip | 45 | return product if leaves.length <= 2 |
| 26 | end.join(': ') | ||
| 27 | 46 | ||
| 28 | type = self.name if type.empty? | 47 | type = leaves[0..1].map { |node| node.at_css('> a').content.strip }.join(': ') |
| 29 | type.remove! %r{\ADocker } | 48 | type.remove! %r{\ADocker } |
| 30 | type.remove! %r{ Engine} | 49 | type.remove! ' Engine' |
| 31 | type.sub! %r{Command[\-\s]line reference}i, 'CLI' | 50 | type.sub! %r{Command[\-\s]line reference}i, 'CLI' |
| 32 | type = 'Engine: Reference' if type == 'Engine: reference' | 51 | type.sub! 'CLI reference', 'CLI' |
| 33 | type | 52 | type |
| 34 | end | 53 | end |
| 35 | 54 | ||
| @@ -9,34 +9,39 @@ module Docs · 8 unmodified lines | |||
| 9 | options[:trailing_slash] = true | 9 | options[:trailing_slash] = true |
| 10 | 10 | ||
| 11 | options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//] | 11 | options[:only_patterns] = [/\Aengine\//, /\Acompose\//, /\Amachine\//] |
| 12 | 12 | options[:skip_patterns] = [/\Aengine\/api\/v/, /\Aengine\/installation/] | |
| 13 | options[:skip] = %w( | 13 | options[:skip] = %w( |
| 14 | swarm/scheduler/ | 14 | / |
| 15 | swarm/swarm_at_scale/ | ||
| 16 | swarm/reference/ | ||
| 17 | engine/installation/linux/ | ||
| 18 | engine/installation/cloud/ | ||
| 19 | engine/installation/ | ||
| 20 | engine/tutorials/ | ||
| 21 | engine/userguide/ | 15 | engine/userguide/ |
| 22 | engine/extend/ | ||
| 23 | engine/examples/ | 16 | engine/examples/ |
| 24 | engine/reference/ | 17 | engine/reference/ |
| 25 | engine/reference/api/ | 18 | engine/reference/api/ |
| 26 | engine/security/ | 19 | engine/reference/api/docker_remote_api_v1.24/ |
| 27 | engine/security/trust/ | ||
| 28 | engine/getstarted/linux_install_help/ | 20 | engine/getstarted/linux_install_help/ |
| 29 | machine/reference/ | 21 | machine/reference/ |
| 30 | machine/drivers/ | 22 | machine/drivers/ |
| 31 | machine/examples/ | 23 | machine/examples/ |
| 32 | compose/reference/ | 24 | compose/reference/ |
| 33 | ) # index pages | 25 | ) |
| 26 | |||
| 27 | options[:fix_urls] = ->(url) do | ||
| 28 | url.sub! %r{\.md/?(?=#|\z)}, '/' | ||
| 29 | url.sub! '/index/', '/' | ||
| 30 | url | ||
| 31 | end | ||
| 34 | 32 | ||
| 35 | options[:replace_paths] = { | 33 | options[:replace_paths] = { |
| 36 | 'engine/installation/ubuntulinux/' => 'engine/installation/linux/ubuntulinux/', | ||
| 37 | 'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/', | 34 | 'engine/userguide/networking/dockernetworks/' => 'engine/userguide/networking/', |
| 35 | 'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/', | ||
| 38 | 'engine/reference/logging/overview/' => 'engine/admin/logging/overview/', | 36 | 'engine/reference/logging/overview/' => 'engine/admin/logging/overview/', |
| 39 | 'engine/userguide/dockervolumes/' => 'engine/tutorials/dockervolumes/' | 37 | 'engine/reference/commandline/daemon/' => 'engine/reference/commandline/dockerd/', |
| 38 | 'engine/reference/commandline/' => 'engine/reference/commandline/docker/', | ||
| 39 | 'engine/reference/api/docker_remote_api/' => 'engine/api/', | ||
| 40 | 'engine/swarm/how-swarm-mode-works/' => 'engine/swarm/how-swarm-mode-works/nodes/', | ||
| 41 | 'engine/tutorials/dockerizing/' => 'engine/getstarted/step_one/', | ||
| 42 | 'engine/tutorials/usingdocker/' => 'engine/getstarted/step_three/', | ||
| 43 | 'engine/tutorials/dockerimages/' => 'engine/getstarted/step_four/', | ||
| 44 | 'engine/tutorials/dockerrepos/' => 'engine/getstarted/step_six/' | ||
| 40 | } | 45 | } |
| 41 | 46 | ||
| 42 | options[:attribution] = <<-HTML | 47 | options[:attribution] = <<-HTML |
| @@ -46,9 +51,18 @@ module Docs · 3 unmodified lines | |||
| 46 | Docker, Inc. and other parties may also have trademark rights in other terms used herein. | 51 | Docker, Inc. and other parties may also have trademark rights in other terms used herein. |
| 47 | HTML | 52 | HTML |
| 48 | 53 | ||
| 54 | version '1.13' do | ||
| 55 | self.release = '1.13' | ||
| 56 | self.base_url = 'https://docs.docker.com/' | ||
| 57 | |||
| 58 | html_filters.push 'docker/entries', 'docker/clean_html' | ||
| 59 | |||
| 60 | options[:container] = '.container-fluid .row' | ||
| 61 | end | ||
| 62 | |||
| 49 | version '1.12' do | 63 | version '1.12' do |
| 50 | self.release = '1.12' | 64 | self.release = '1.12' |
| 51 | self.base_url = 'https://docs.docker.com/' | 65 | # self.base_url = 'https://docs.docker.com/' |
| 52 | 66 | ||
| 53 | html_filters.push 'docker/entries', 'docker/clean_html' | 67 | html_filters.push 'docker/entries', 'docker/clean_html' |
| 54 | 68 | ||