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.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yaml +10 -7
- data/.github/workflows/test.yaml +8 -3
- data/.nvmrc +1 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +21 -1
- data/Gemfile +1 -1
- data/govuk_tech_docs.gemspec +13 -9
- data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -0
- data/lib/govuk_tech_docs/api_reference/api_reference_extension.rb +1 -1
- data/lib/govuk_tech_docs/api_reference/api_reference_renderer.rb +10 -10
- data/lib/govuk_tech_docs/path_helpers.rb +40 -10
- data/lib/govuk_tech_docs/redirects.rb +2 -2
- data/lib/govuk_tech_docs/table_of_contents/heading.rb +2 -2
- data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +5 -5
- data/lib/govuk_tech_docs/table_of_contents/helpers.rb +3 -3
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/govuk_tech_docs.rb +4 -4
- data/lib/source/favicon.ico +0 -0
- data/lib/source/layouts/_footer.erb +1 -1
- data/lib/source/layouts/_header.erb +15 -17
- data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
- data/node_modules/govuk-frontend/govuk/all.js +4918 -3796
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +54 -49
- data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
- data/node_modules/govuk-frontend/govuk/common/index.js +172 -152
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +334 -321
- data/node_modules/govuk-frontend/govuk/common.js +171 -151
- data/node_modules/govuk-frontend/govuk/components/_all.scss +3 -2
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +26 -7
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +2203 -1650
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +24 -16
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +34 -11
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +49 -9
- data/node_modules/govuk-frontend/govuk/components/button/button.js +961 -916
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +2142 -2038
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1204 -1145
- data/node_modules/govuk-frontend/govuk/components/details/details.js +826 -799
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1097 -1044
- data/node_modules/govuk-frontend/govuk/components/exit-this-page/_exit-this-page.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/exit-this-page/_index.scss +97 -0
- data/node_modules/govuk-frontend/govuk/components/exit-this-page/exit-this-page.js +2120 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +6 -0
- data/node_modules/govuk-frontend/govuk/components/header/header.js +683 -1003
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +786 -751
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1151 -1105
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1045 -1014
- data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +107 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1514 -1268
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
- data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +12 -0
- data/node_modules/govuk-frontend/govuk/i18n.js +371 -364
- data/node_modules/govuk-frontend/govuk/objects/_template.scss +20 -0
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
- data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +5 -5
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +243 -241
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +14 -12
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +18 -16
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +553 -545
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +40 -36
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +257 -250
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +22 -20
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +204 -197
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +204 -197
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +109 -105
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +407 -399
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +242 -238
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +73 -71
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +15 -13
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +18 -16
- data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
- data/package-lock.json +2708 -8
- data/package.json +1 -1
- metadata +25 -7
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdff5c798ed637478cc6766be492aca1626164c8f3b15b1d92ea2dcde1a29e9a
|
4
|
+
data.tar.gz: 023d8b73d834bda792283199b10bb6d8bb38e7579e842bb63cfea66019dd12d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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@
|
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 "
|
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 "
|
34
|
+
echo "new_version=false" >> "$GITHUB_OUTPUT"
|
33
35
|
else
|
34
|
-
echo "
|
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@
|
49
|
+
- uses: actions/checkout@v3
|
48
50
|
|
49
|
-
- uses: actions/setup-node@
|
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
|
data/.github/workflows/test.yaml
CHANGED
@@ -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@
|
15
|
+
- uses: actions/checkout@v3
|
12
16
|
|
13
|
-
- uses: actions/setup-node@
|
17
|
+
- uses: actions/setup-node@v3
|
14
18
|
with:
|
15
|
-
node-version: '
|
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
|
-
|
1
|
+
18
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
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
data/govuk_tech_docs.gemspec
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
|
2
|
-
|
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
|
8
|
+
abort "npm install failed" unless $CHILD_STATUS.success?
|
8
9
|
|
9
|
-
unless File.exist?(
|
10
|
-
abort
|
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 =
|
20
|
-
spec.description =
|
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 = [
|
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", "~>
|
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
|
+
}
|
@@ -124,15 +124,15 @@ module GovukTechDocs
|
|
124
124
|
properties.merge!(all_of_schema.properties.to_h)
|
125
125
|
end
|
126
126
|
|
127
|
-
properties.
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
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
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
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
|
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)/) &&
|
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
|
-
|
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 + %
|
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
|
27
|
+
output += "#{indentation}<ul>\n" unless level.zero?
|
28
28
|
|
29
29
|
tree.children.each do |child|
|
30
|
-
output += indentation
|
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
|
36
|
+
output += "#{indentation}#{INDENTATION_INCREMENT}</li>\n"
|
37
37
|
end
|
38
38
|
|
39
|
-
output += indentation
|
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: "
|
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 += %
|
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
|
data/lib/govuk_tech_docs.rb
CHANGED
@@ -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
|
-
|
90
|
-
current_page.data.parent
|
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:
|
112
|
+
title: { boost: 100, store: true, required: true },
|
113
113
|
content: { boost: 50, store: true },
|
114
|
-
url:
|
114
|
+
url: { index: false, store: true },
|
115
115
|
}
|
116
116
|
|
117
117
|
search.pipeline_remove = %w[stemmer stopWordFilter]
|
data/lib/source/favicon.ico
CHANGED
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="<%=
|
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="<%=
|
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
|
-
<
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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="currentColor" fill-rule="evenodd"
|
21
|
+
d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5 3-1.1-.2-1.7-1.2-1.5-2.1.3-1.2 1.5-1.5 2.1-.1 1.1-2.3-.8-3-2-2.3 1.9-1.9 2.1-3.5.6-5.6-2.1 1.6-2.1 3.2-1.2 5.5-1.2-1.4-3.2-.6-2.5 1.6.9-1.4 2.1-.5 1.9.8-.2 1.1-1.7 2.1-3.5 1.9-2.7-.2-2.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="<%=
|
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.
|