govuk_tech_docs 3.3.1 → 3.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish.yaml +10 -7
  3. data/.github/workflows/test.yaml +8 -3
  4. data/.nvmrc +1 -1
  5. data/.rubocop.yml +3 -0
  6. data/CHANGELOG.md +21 -1
  7. data/Gemfile +1 -1
  8. data/govuk_tech_docs.gemspec +13 -9
  9. data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -0
  10. data/lib/govuk_tech_docs/api_reference/api_reference_extension.rb +1 -1
  11. data/lib/govuk_tech_docs/api_reference/api_reference_renderer.rb +10 -10
  12. data/lib/govuk_tech_docs/path_helpers.rb +40 -10
  13. data/lib/govuk_tech_docs/redirects.rb +2 -2
  14. data/lib/govuk_tech_docs/table_of_contents/heading.rb +2 -2
  15. data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +5 -5
  16. data/lib/govuk_tech_docs/table_of_contents/helpers.rb +3 -3
  17. data/lib/govuk_tech_docs/version.rb +1 -1
  18. data/lib/govuk_tech_docs.rb +4 -4
  19. data/lib/source/favicon.ico +0 -0
  20. data/lib/source/layouts/_footer.erb +1 -1
  21. data/lib/source/layouts/_header.erb +15 -17
  22. data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
  23. data/node_modules/govuk-frontend/govuk/all.js +4918 -3796
  24. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +54 -49
  25. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
  26. data/node_modules/govuk-frontend/govuk/common/index.js +172 -152
  27. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +334 -321
  28. data/node_modules/govuk-frontend/govuk/common.js +171 -151
  29. data/node_modules/govuk-frontend/govuk/components/_all.scss +3 -2
  30. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +26 -7
  31. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +2203 -1650
  32. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +24 -16
  33. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +34 -11
  34. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +49 -9
  35. data/node_modules/govuk-frontend/govuk/components/button/button.js +961 -916
  36. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +2142 -2038
  37. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
  38. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1204 -1145
  39. data/node_modules/govuk-frontend/govuk/components/details/details.js +826 -799
  40. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1097 -1044
  41. data/node_modules/govuk-frontend/govuk/components/exit-this-page/_exit-this-page.scss +2 -0
  42. data/node_modules/govuk-frontend/govuk/components/exit-this-page/_index.scss +97 -0
  43. data/node_modules/govuk-frontend/govuk/components/exit-this-page/exit-this-page.js +2120 -0
  44. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
  45. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
  46. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +6 -0
  47. data/node_modules/govuk-frontend/govuk/components/header/header.js +683 -1003
  48. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
  49. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +786 -751
  50. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
  51. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1151 -1105
  52. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
  53. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1045 -1014
  54. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +107 -0
  55. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1514 -1268
  56. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
  57. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
  58. data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
  59. data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
  60. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
  61. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  62. data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
  63. data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +12 -0
  64. data/node_modules/govuk-frontend/govuk/i18n.js +371 -364
  65. data/node_modules/govuk-frontend/govuk/objects/_template.scss +20 -0
  66. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
  67. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
  68. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
  69. data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
  70. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +5 -5
  71. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
  72. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +243 -241
  73. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +14 -12
  74. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +18 -16
  75. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +553 -545
  76. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +40 -36
  77. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +257 -250
  78. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +22 -20
  79. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +204 -197
  80. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +204 -197
  81. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +109 -105
  82. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +407 -399
  83. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +242 -238
  84. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +73 -71
  85. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +15 -13
  86. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +18 -16
  87. data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
  88. data/package-lock.json +2708 -8
  89. data/package.json +1 -1
  90. metadata +25 -7
  91. data/.ruby-version +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e56428dbc592284d70ca0c9880c6c99fd10cd72da62a7008bbc11237e49c486c
4
- data.tar.gz: b328aa30ba2a6fc8666abf3c9ede2a7a93639604ef0a1705626632479400f117
3
+ metadata.gz: bdff5c798ed637478cc6766be492aca1626164c8f3b15b1d92ea2dcde1a29e9a
4
+ data.tar.gz: 023d8b73d834bda792283199b10bb6d8bb38e7579e842bb63cfea66019dd12d9
5
5
  SHA512:
6
- metadata.gz: c7aad01df604f63f875ecd96a9ace7f003e7a34eb6eb71c176e36cb1a11a8bf61af50231561338d8853c2c853e8d0aa5d69388f8ef7e5e83cf3355fc3b7cc9aa
7
- data.tar.gz: c0f2915a6922e499f4ed1eb39262c7176bc64df8467a0be1ba1579af8cdea0fc6bef3c1415822f1aff6f80c679ed0d9fedce4a4ccd9799932bf0aabb196a4747
6
+ metadata.gz: 5f5d4fe151e48175f51503a19fe79cf742d62aa1197d3252b826dbaaa4e1b625209f7b64d3be5ce3de67ef4f463f6e93a45bd181671c47745aa2fba92dd10dc7
7
+ data.tar.gz: eb1b46715802e3e22fa5387f0e77ab49e62c669386be52cd8d541c505b87c3835ff45f0fb84a3f895da3788eb2eb25a4ccd0e17d924742246c5d6ba4bd2292be
@@ -16,22 +16,24 @@ jobs:
16
16
  go: ${{ steps.gem_version.outputs.new_version }}
17
17
 
18
18
  steps:
19
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v3
20
20
 
21
21
  - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '3'
22
24
 
23
25
  - name: Check if new version to release
24
26
  id: gem_version
25
27
  run: |
26
28
  gem_version=$(ruby -r rubygems -e "puts Gem::Specification::load('govuk_tech_docs.gemspec').version")
27
- echo "::set-output name=gem_version::$gem_version"
29
+ echo "gem_version=$gem_version" >> "$GITHUB_OUTPUT"
28
30
 
29
31
  if git fetch origin "refs/tags/v$gem_version" >/dev/null 2>&1
30
32
  then
31
33
  echo "Tag 'v$gem_version' already exists"
32
- echo "::set-output name=new_version::false"
34
+ echo "new_version=false" >> "$GITHUB_OUTPUT"
33
35
  else
34
- echo "::set-output name=new_version::true"
36
+ echo "new_version=true" >> "$GITHUB_OUTPUT"
35
37
  fi
36
38
 
37
39
  deploy:
@@ -44,15 +46,16 @@ jobs:
44
46
  if: ${{ needs.pre.outputs.go == 'true' }}
45
47
 
46
48
  steps:
47
- - uses: actions/checkout@v2
49
+ - uses: actions/checkout@v3
48
50
 
49
- - uses: actions/setup-node@v2
51
+ - uses: actions/setup-node@v3
50
52
  with:
53
+ node-version-file: '.nvmrc'
51
54
  cache: 'npm'
52
- node-version: '14'
53
55
 
54
56
  - uses: ruby/setup-ruby@v1
55
57
  with:
58
+ ruby-version: '3'
56
59
  bundler-cache: true
57
60
 
58
61
  - name: Publish
@@ -7,16 +7,21 @@ jobs:
7
7
  name: Test
8
8
  runs-on: ubuntu-latest
9
9
 
10
+ strategy:
11
+ matrix:
12
+ ruby: ['2.7', '3.2']
13
+
10
14
  steps:
11
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
12
16
 
13
- - uses: actions/setup-node@v2
17
+ - uses: actions/setup-node@v3
14
18
  with:
15
- node-version: '14'
19
+ node-version-file: '.nvmrc'
16
20
  cache: 'npm'
17
21
 
18
22
  - uses: ruby/setup-ruby@v1
19
23
  with:
24
+ ruby-version: ${{ matrix.ruby }}
20
25
  bundler-cache: true
21
26
 
22
27
  - name: Run tests
data/.nvmrc CHANGED
@@ -1 +1 @@
1
- 14
1
+ 18
data/.rubocop.yml CHANGED
@@ -2,6 +2,9 @@ inherit_gem:
2
2
  rubocop-govuk:
3
3
  - config/default.yml
4
4
 
5
+ AllCops:
6
+ TargetRubyVersion: 2.7
7
+
5
8
  Layout/HeredocIndentation:
6
9
  Enabled: false
7
10
 
data/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 3.5.0
4
+
5
+ ### New features
6
+
7
+ - Update the Crown logo and govuk-frontend
8
+
9
+ See [pull request #344: Upgrade govuk-frontend and the crown logo](https://github.com/alphagov/tech-docs-gem/pull/344) for more details.
10
+
11
+ https://github.com/alphagov/tech-docs-gem/pull/344
12
+
13
+ ## 3.4.0
14
+
15
+ ### New features
16
+
17
+ - Footer and header links now work with relative links. Thanks to [@eddgrant](https://github.com/eddgrant) for contributing this feature.
18
+
19
+ See [pull request #325: Support sites deployed on a path other than "/" when generating header and footer links](https://github.com/alphagov/tech-docs-gem/pull/325) for more details.
20
+
21
+ ### Fixes
22
+
23
+ - You no longer need to downgrade Haml yourself, `bundle install` will now make sure Haml 6 is not installed (see issue [#318: Error: Filters is not a module](https://github.com/alphagov/tech-docs/gem/issues/318)).
4
24
 
5
25
  ## 3.3.1
6
26
 
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in govuk_tech_docs.gemspec
4
4
  gemspec
@@ -1,13 +1,14 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ require "English"
2
+
3
+ lib = File.expand_path("lib", __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require "govuk_tech_docs/version"
5
6
 
6
7
  `npm install`
7
- abort 'npm install failed' unless $?.success?
8
+ abort "npm install failed" unless $CHILD_STATUS.success?
8
9
 
9
- unless File.exist?('node_modules/govuk-frontend/govuk/all.scss')
10
- abort 'govuk-frontend npm package not installed'
10
+ unless File.exist?("node_modules/govuk-frontend/govuk/all.scss")
11
+ abort "govuk-frontend npm package not installed"
11
12
  end
12
13
 
13
14
  Gem::Specification.new do |spec|
@@ -16,8 +17,8 @@ Gem::Specification.new do |spec|
16
17
  spec.authors = ["Government Digital Service"]
17
18
  spec.email = ["govuk-dev@digital.cabinet-office.gov.uk"]
18
19
 
19
- spec.summary = %q{Gem to distribute the GOV.UK Tech Docs Template}
20
- spec.description = %q{Gem to distribute the GOV.UK Tech Docs Template. See https://github.com/alphagov/tech-docs-gem for the project.}
20
+ spec.summary = "Gem to distribute the GOV.UK Tech Docs Template"
21
+ spec.description = "Gem to distribute the GOV.UK Tech Docs Template. See https://github.com/alphagov/tech-docs-gem for the project."
21
22
  spec.homepage = "https://github.com/alphagov/tech-docs-gem"
22
23
  spec.license = "MIT"
23
24
 
@@ -30,10 +31,13 @@ Gem::Specification.new do |spec|
30
31
 
31
32
  spec.bindir = "exe"
32
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
- spec.require_paths = ["lib"]
34
+ spec.require_paths = %w[lib]
35
+
36
+ spec.required_ruby_version = ">= 2.7.0"
34
37
 
35
38
  spec.add_dependency "autoprefixer-rails", "~> 10.2"
36
39
  spec.add_dependency "chronic", "~> 0.10.2"
40
+ spec.add_dependency "haml", "< 6.0.0"
37
41
  spec.add_dependency "middleman", "~> 4.0"
38
42
  spec.add_dependency "middleman-autoprefixer", "~> 2.10.0"
39
43
  spec.add_dependency "middleman-compass", ">= 4.0.0"
@@ -50,5 +54,5 @@ Gem::Specification.new do |spec|
50
54
  spec.add_development_dependency "jasmine", "~> 3.5.0"
51
55
  spec.add_development_dependency "rake", "~> 13.0"
52
56
  spec.add_development_dependency "rspec", "~> 3.9.0"
53
- spec.add_development_dependency "rubocop-govuk", "~> 3.5.0"
57
+ spec.add_development_dependency "rubocop-govuk", "~> 4.10.0"
54
58
  end
@@ -1,3 +1,10 @@
1
+ // IE8 support is removed in govuk-frontend v5
2
+ // but as we still use IE8 mixin and generate a
3
+ // separate stylesheet, we'll supress the warning for now
4
+ // https://frontend.design-system.service.gov.uk/sass-api-reference/#govuk-suppressed-warnings
5
+ $govuk-suppressed-warnings: (
6
+ ie8
7
+ );
1
8
  $govuk-assets-path: "/assets/govuk/assets/" !default;
2
9
 
3
10
  // Include only the bits of GOV.UK Frontend we need
@@ -20,3 +27,9 @@ $govuk-new-link-styles: true;
20
27
 
21
28
  @import "core";
22
29
  @import "vendor/fixedsticky";
30
+
31
+ // manual Tudor Crown spacing adjustment from govuk-frontend 4.8
32
+ .govuk-header__logotype-crown[width="32"] {
33
+ top: -3px;
34
+ margin-right: 2px;
35
+ }
@@ -37,7 +37,7 @@ module GovukTechDocs
37
37
 
38
38
  def uri?(string)
39
39
  uri = URI.parse(string)
40
- %w(http https).include?(uri.scheme)
40
+ %w[http https].include?(uri.scheme)
41
41
  rescue URI::BadURIError
42
42
  false
43
43
  rescue URI::InvalidURIError
@@ -124,15 +124,15 @@ module GovukTechDocs
124
124
  properties.merge!(all_of_schema.properties.to_h)
125
125
  end
126
126
 
127
- properties.each_with_object({}) do |(name, schema), memo|
128
- memo[name] = case schema.type
129
- when "object"
130
- schema_properties(schema.items || schema)
131
- when "array"
132
- schema.items ? [schema_properties(schema.items)] : []
133
- else
134
- schema.example || schema.type
135
- end
127
+ properties.transform_values do |schema|
128
+ case schema.type
129
+ when "object"
130
+ schema_properties(schema.items || schema)
131
+ when "array"
132
+ schema.items ? [schema_properties(schema.items)] : []
133
+ else
134
+ schema.example || schema.type
135
+ end
136
136
  end
137
137
  end
138
138
 
@@ -144,7 +144,7 @@ module GovukTechDocs
144
144
  end
145
145
 
146
146
  def get_renderer(file)
147
- template_path = File.join(File.dirname(__FILE__), "templates/" + file)
147
+ template_path = File.join(File.dirname(__FILE__), "templates/#{file}")
148
148
  template = File.open(template_path, "r").read
149
149
  ERB.new(template)
150
150
  end
@@ -1,18 +1,29 @@
1
+ require "uri"
1
2
  module GovukTechDocs
2
3
  module PathHelpers
3
- def get_path_to_resource(config, resource, current_page)
4
- if config[:relative_links]
5
- resource_path_segments = resource.path.split("/").reject(&:empty?)[0..-2]
6
- resource_file_name = resource.path.split("/")[-1]
4
+ # Some useful notes from https://www.rubydoc.info/github/middleman/middleman/Middleman/Sitemap/Resource#url-instance_method :
5
+ # 'resource.path' is "The source path of this resource (relative to the source directory, without template extensions)."
6
+ # 'resource.destination_path', which is: "The output path in the build directory for this resource."
7
+ # 'resource.url' is based on 'resource.destination_path', but is further tweaked to optionally strip the index file and prefixed with any :http_prefix.
7
8
 
8
- path_to_site_root = path_to_site_root config, current_page.path
9
- resource_path = path_to_site_root + resource_path_segments
10
- .push(resource_file_name)
11
- .join("/")
9
+ # Calculates the path to the sought resource, taking in to account whether the site has been configured
10
+ # to generate relative or absolute links.
11
+ # Identifies whether the sought resource is an internal or external target: External targets are returned untouched. Path calculation is performed for internal targets.
12
+ # Works for both "Middleman::Sitemap::Resource" resources and plain strings (which may be passed from the site configuration when generating header links).
13
+ #
14
+ # @param [Object] config
15
+ # @param [Object] resource
16
+ # @param [Object] current_page
17
+ def get_path_to_resource(config, resource, current_page)
18
+ if resource.is_a?(Middleman::Sitemap::Resource)
19
+ config[:relative_links] ? get_resource_path_relative_to_current_page(config, current_page.path, resource.path) : resource.url
20
+ elsif external_url?(resource)
21
+ resource
22
+ elsif config[:relative_links]
23
+ get_resource_path_relative_to_current_page(config, current_page.path, resource)
12
24
  else
13
- resource_path = resource.url
25
+ resource
14
26
  end
15
- resource_path
16
27
  end
17
28
 
18
29
  def path_to_site_root(config, page_path)
@@ -26,5 +37,24 @@ module GovukTechDocs
26
37
  end
27
38
  path_to_site_root
28
39
  end
40
+
41
+ private
42
+
43
+ # Calculates the path to the sought resource, relative to the current page.
44
+ # @param [Object] config Middleman config.
45
+ # @param [String] current_page path of the current page, from the site root.
46
+ # @param [String] resource_path_from_site_root path of the sought resource, from the site root.
47
+ def get_resource_path_relative_to_current_page(config, current_page, resource_path_from_site_root)
48
+ path_segments = resource_path_from_site_root.split("/").reject(&:empty?)[0..-2]
49
+ path_file_name = resource_path_from_site_root.split("/")[-1]
50
+
51
+ path_to_site_root = path_to_site_root config, current_page
52
+ path_to_site_root + path_segments.push(path_file_name).join("/")
53
+ end
54
+
55
+ def external_url?(url)
56
+ uri = URI.parse(url)
57
+ uri.scheme || uri.to_s.split("/")[0]&.include?(".")
58
+ end
29
59
  end
30
60
  end
@@ -1,6 +1,6 @@
1
1
  module GovukTechDocs
2
2
  class Redirects
3
- LEADING_SLASH = %r[\A\/].freeze
3
+ LEADING_SLASH = %r{\A/}.freeze
4
4
 
5
5
  def initialize(context)
6
6
  @context = context
@@ -11,7 +11,7 @@ module GovukTechDocs
11
11
 
12
12
  all_redirects.map do |from, to|
13
13
  # Middleman needs paths without leading slashes
14
- [from.sub(LEADING_SLASH, ""), to: to.sub(LEADING_SLASH, "")]
14
+ [from.sub(LEADING_SLASH, ""), { to: to.sub(LEADING_SLASH, "") }]
15
15
  end
16
16
  end
17
17
 
@@ -9,14 +9,14 @@ module GovukTechDocs
9
9
  end
10
10
 
11
11
  def size
12
- @element_name.scan(/h(\d)/) && $1 && Integer($1)
12
+ @element_name.scan(/h(\d)/) && ::Regexp.last_match(1) && Integer(::Regexp.last_match(1))
13
13
  end
14
14
 
15
15
  def href
16
16
  if @page_url != "" && size == 1
17
17
  @page_url
18
18
  else
19
- @page_url + "#" + @attributes["id"]
19
+ "#{@page_url}##{@attributes['id']}"
20
20
  end
21
21
  end
22
22
 
@@ -20,23 +20,23 @@ module GovukTechDocs
20
20
  output = ""
21
21
 
22
22
  if tree.heading
23
- output += indentation + %{<a href="#{tree.heading.href}"><span>#{tree.heading.title}</span></a>\n}
23
+ output += indentation + %(<a href="#{tree.heading.href}"><span>#{tree.heading.title}</span></a>\n)
24
24
  end
25
25
 
26
26
  if tree.children.any? && level < @max_level
27
- output += indentation + "<ul>\n" unless level.zero?
27
+ output += "#{indentation}<ul>\n" unless level.zero?
28
28
 
29
29
  tree.children.each do |child|
30
- output += indentation + INDENTATION_INCREMENT + "<li>\n"
30
+ output += "#{indentation}#{INDENTATION_INCREMENT}<li>\n"
31
31
  output += render_tree(
32
32
  child,
33
33
  indentation: indentation + INDENTATION_INCREMENT * 2,
34
34
  level: level + 1,
35
35
  )
36
- output += indentation + INDENTATION_INCREMENT + "</li>\n"
36
+ output += "#{indentation}#{INDENTATION_INCREMENT}</li>\n"
37
37
  end
38
38
 
39
- output += indentation + "</ul>\n" unless level.zero?
39
+ output += "#{indentation}</ul>\n" unless level.zero?
40
40
  end
41
41
 
42
42
  output
@@ -32,7 +32,7 @@ module GovukTechDocs
32
32
  headings = HeadingsBuilder.new(html, url).headings
33
33
 
34
34
  if headings.none? { |heading| heading.size == 1 }
35
- raise "No H1 tag found. You have to at least add one H1 heading to the page: " + url
35
+ raise "No H1 tag found. You have to at least add one H1 heading to the page: #{url}"
36
36
  end
37
37
 
38
38
  tree = HeadingTreeBuilder.new(headings).tree
@@ -67,12 +67,12 @@ module GovukTechDocs
67
67
  if config[:http_prefix].end_with?("/")
68
68
  config[:http_prefix]
69
69
  else
70
- config[:http_prefix] + "/"
70
+ "#{config[:http_prefix]}/"
71
71
  end
72
72
 
73
73
  link_value = get_path_to_resource(config, resource, current_page)
74
74
  if resource.children.any? && resource.url != home_url
75
- output += %{<li><a href="#{link_value}"><span>#{resource.data.title}</span></a>\n}
75
+ output += %(<li><a href="#{link_value}"><span>#{resource.data.title}</span></a>\n)
76
76
  output += render_page_tree(resource.children, current_page, config, current_page_html)
77
77
  output += "</li>\n"
78
78
  else
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "3.3.1".freeze
2
+ VERSION = "3.4.5".freeze
3
3
  end
@@ -86,8 +86,8 @@ module GovukTechDocs
86
86
  def active_page(page_path)
87
87
  [
88
88
  page_path == "/" && current_page.path == "index.html",
89
- ("/" + current_page.path) == page_path,
90
- current_page.data.parent != nil && current_page.data.parent.to_s == page_path,
89
+ "/#{current_page.path}" == page_path,
90
+ !current_page.data.parent.nil? && current_page.data.parent.to_s == page_path,
91
91
  ].any?
92
92
  end
93
93
  end
@@ -109,9 +109,9 @@ module GovukTechDocs
109
109
  search.resources = [""]
110
110
 
111
111
  search.fields = {
112
- title: { boost: 100, store: true, required: true },
112
+ title: { boost: 100, store: true, required: true },
113
113
  content: { boost: 50, store: true },
114
- url: { index: false, store: true },
114
+ url: { index: false, store: true },
115
115
  }
116
116
 
117
117
  search.pipeline_remove = %w[stemmer stopWordFilter]
Binary file
@@ -6,7 +6,7 @@
6
6
  <ul class="govuk-footer__inline-list">
7
7
  <% config[:tech_docs][:footer_links].each do |title, path| %>
8
8
  <li class="govuk-footer__inline-list-item">
9
- <a class="govuk-footer__link" href="<%= url_for path %>"><%= title %></a>
9
+ <a class="govuk-footer__link" href="<%= get_path_to_resource config, path, current_page %>"><%= title %></a>
10
10
  </li>
11
11
  <% end %>
12
12
  </ul>
@@ -2,26 +2,24 @@
2
2
  <div class="govuk-header__container govuk-header__container--full-width">
3
3
  <div class="govuk-header__logo">
4
4
  <% if config[:tech_docs][:service_link] %>
5
- <a href="<%= url_for config[:tech_docs][:service_link] %>" class="govuk-header__link govuk-header__link--homepage">
5
+ <a href="<%= get_path_to_resource config, config[:tech_docs][:service_link], current_page %>" class="govuk-header__link govuk-header__link--homepage">
6
6
  <% else %>
7
7
  <span class="govuk-header__link govuk-header__link--homepage">
8
8
  <% end %>
9
9
  <% if config[:tech_docs][:show_govuk_logo] %>
10
- <span class="govuk-header__logotype">
11
- <svg
12
- aria-hidden="true"
13
- focusable="false"
14
- class="govuk-header__logotype-crown"
15
- xmlns="http://www.w3.org/2000/svg"
16
- viewBox="0 0 132 97"
17
- height="30"
18
- width="36"
19
- >
20
- <path
21
- fill="currentColor" fill-rule="evenodd"
22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4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"
23
- ></path>
24
- </svg>
10
+ <svg
11
+ aria-hidden="true"
12
+ focusable="false"
13
+ class="govuk-header__logotype-crown"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ viewBox="0 0 32 30"
16
+ height="30"
17
+ width="32"
18
+ >
19
+ <path
20
+ fill="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.9-2.1-2.9-3.6.7-.1 1.9.5 2.9 1.9l.4-4.3c-1.1 1.1-2.1 1.4-3.2 1.4.4-1.2 2.1-3 2.1-3h-5.4s1.7 1.9 2.1 3c-1.1 0-2.1-.2-3.2-1.4l.4 4.3c1-1.4 2.2-2 2.9-1.9-.1 1.5-.2 3.4-2.9 3.6-1.9.2-3.4-.8-3.5-1.9-.2-1.3 1-2.2 1.9-.8.7-2.3-1.2-3-2.5-1.6.9-2.2.9-3.9-1.2-5.5-1.5 2-1.3 3.7.6 5.6-1.2-.7-3.1 0-2 2.3.6-1.4 1.8-1.1 2.1.1.2.9-.3 1.9-1.5 2.1-.9.2-2.4-.5-3.5-3 .6 0 1.2.3 2 .9l-1.2-4c-.3 1.1-.7 1.9-1.1 2.3-.3-.8-.2-1.4 0-2.7l-2.9.9C1.3 23 2.6 25.5 3.7 30c3.7-.5 7.9-.8 12.3-.8"></path>
22
+ </svg>
25
23
  <span class="govuk-header__logotype-text">
26
24
  GOV.UK
27
25
  </span>
@@ -46,7 +44,7 @@
46
44
  <ul id="navigation" class="govuk-header__navigation-list">
47
45
  <% config[:tech_docs][:header_links].each do |title, path| %>
48
46
  <li class="govuk-header__navigation-item<% if active_page(path) %> govuk-header__navigation-item--active<% end %>">
49
- <a class="govuk-header__link" href="<%= url_for path %>"><%= title %></a>
47
+ <a class="govuk-header__link" href="<%= get_path_to_resource config, path, current_page %>"><%= title %></a>
50
48
  </li>
51
49
  <% end %>
52
50
  </ul>
@@ -1,3 +1,11 @@
1
+ // Ignore IE8 related warnings whilst we continue to generate IE8 specific
2
+ // stylesheets for the review app or dist versions of GOV.UK Frontend
3
+ $govuk-suppressed-warnings: if(
4
+ variable-exists(govuk-suppressed-warnings),
5
+ append($govuk-suppressed-warnings, "ie8"),
6
+ ("ie8")
7
+ );
8
+
1
9
  // By setting $govuk-is-ie8 to true, we create a version of the stylesheet that
2
10
  // targets IE8 – e.g. conditionally including or excluding styles, and
3
11
  // rasterizing media queries.