govuk_tech_docs 2.2.2 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of govuk_tech_docs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.nvmrc +1 -1
- data/.travis.yml +2 -0
- data/CHANGELOG.md +24 -0
- data/example/config/tech-docs.yml +1 -0
- data/example/source/single-page-nav.html.md +13 -0
- data/govuk_tech_docs.gemspec +2 -1
- data/lib/assets/javascripts/_modules/collapsible-navigation.js +7 -7
- data/lib/assets/javascripts/_modules/in-page-navigation.js +2 -4
- data/lib/assets/stylesheets/_govuk_tech_docs.scss +9 -10
- data/lib/assets/stylesheets/modules/_search.scss +4 -25
- data/lib/assets/stylesheets/modules/_technical-documentation.scss +1 -1
- data/lib/assets/stylesheets/modules/_toc.scss +11 -11
- data/lib/govuk_tech_docs/table_of_contents/heading.rb +5 -1
- data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +2 -2
- data/lib/govuk_tech_docs/table_of_contents/helpers.rb +22 -11
- data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +1 -1
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/source/layouts/_header.erb +1 -2
- data/lib/source/layouts/layout.erb +3 -1
- data/node_modules/govuk-frontend/govuk/_base.scss +3 -0
- data/node_modules/govuk-frontend/govuk/all.js +306 -94
- data/node_modules/govuk-frontend/govuk/all.scss +1 -3
- data/node_modules/govuk-frontend/govuk/components/_all.scss +33 -29
- data/node_modules/govuk-frontend/govuk/components/accordion/_accordion.scss +2 -208
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +197 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/_back-link.scss +2 -65
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +99 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_breadcrumbs.scss +2 -118
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +138 -0
- data/node_modules/govuk-frontend/govuk/components/button/_button.scss +2 -284
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +288 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/_character-count.scss +2 -31
- data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +25 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +17 -9
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_checkboxes.scss +2 -308
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +320 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +129 -24
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/_cookie-banner.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +51 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/_date-input.scss +2 -30
- data/node_modules/govuk-frontend/govuk/components/date-input/_index.scss +26 -0
- data/node_modules/govuk-frontend/govuk/components/details/_details.scss +2 -88
- data/node_modules/govuk-frontend/govuk/components/details/_index.scss +87 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/_error-message.scss +2 -15
- data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +11 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/_error-summary.scss +2 -59
- data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +43 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/_fieldset.scss +2 -68
- data/node_modules/govuk-frontend/govuk/components/fieldset/_index.scss +64 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/_file-upload.scss +2 -81
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +49 -0
- data/node_modules/govuk-frontend/govuk/components/footer/_footer.scss +2 -244
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +241 -0
- data/node_modules/govuk-frontend/govuk/components/header/_header.scss +2 -318
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +331 -0
- data/node_modules/govuk-frontend/govuk/components/header/header.js +665 -316
- data/node_modules/govuk-frontend/govuk/components/hint/_hint.scss +2 -50
- data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +44 -0
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +191 -0
- data/node_modules/govuk-frontend/govuk/components/input/_input.scss +2 -103
- data/node_modules/govuk-frontend/govuk/components/inset-text/_index.scss +24 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/_inset-text.scss +2 -28
- data/node_modules/govuk-frontend/govuk/components/label/_index.scss +41 -0
- data/node_modules/govuk-frontend/govuk/components/label/_label.scss +2 -45
- data/node_modules/govuk-frontend/govuk/components/notification-banner/_index.scss +89 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/_notification-banner.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +61 -0
- data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +44 -0
- data/node_modules/govuk-frontend/govuk/components/panel/_panel.scss +2 -44
- data/node_modules/govuk-frontend/govuk/components/phase-banner/_index.scss +27 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/_phase-banner.scss +2 -31
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +342 -0
- data/node_modules/govuk-frontend/govuk/components/radios/_radios.scss +2 -346
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +49 -0
- data/node_modules/govuk-frontend/govuk/components/select/_select.scss +2 -57
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +36 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/_skip-link.scss +2 -37
- data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +145 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/_summary-list.scss +2 -157
- data/node_modules/govuk-frontend/govuk/components/table/_index.scss +71 -0
- data/node_modules/govuk-frontend/govuk/components/table/_table.scss +2 -54
- data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +130 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/_tabs.scss +2 -142
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +86 -0
- data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +2 -91
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +47 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_textarea.scss +2 -55
- data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +66 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/_warning-text.scss +2 -60
- data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +5 -3
- data/node_modules/govuk-frontend/govuk/core/_links.scss +13 -3
- data/node_modules/govuk-frontend/govuk/core/_lists.scss +17 -3
- data/node_modules/govuk-frontend/govuk/core/_section-break.scss +5 -3
- data/node_modules/govuk-frontend/govuk/core/_template.scss +5 -4
- data/node_modules/govuk-frontend/govuk/core/_typography.scss +5 -3
- data/node_modules/govuk-frontend/govuk/helpers/_clearfix.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss +3 -3
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +9 -11
- data/node_modules/govuk-frontend/govuk/helpers/_grid.scss +2 -1
- data/node_modules/govuk-frontend/govuk/helpers/_links.scss +246 -33
- data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -6
- data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -2
- data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +8 -7
- data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +1 -1
- data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +101 -0
- data/node_modules/govuk-frontend/govuk/objects/_form-group.scss +1 -4
- data/node_modules/govuk-frontend/govuk/objects/_grid.scss +3 -6
- data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +5 -4
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +6 -4
- data/node_modules/govuk-frontend/govuk/overrides/_display.scss +6 -4
- data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +5 -3
- data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +5 -3
- data/node_modules/govuk-frontend/govuk/overrides/_width.scss +6 -3
- data/node_modules/govuk-frontend/govuk/settings/_all.scss +2 -0
- data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +11 -5
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
- data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +42 -35
- data/node_modules/govuk-frontend/govuk/settings/_compatibility.scss +0 -1
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_links.scss +62 -0
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -5
- data/node_modules/govuk-frontend/govuk/settings/_typography-font-families.scss +2 -2
- data/node_modules/govuk-frontend/govuk/settings/_typography-font.scss +14 -5
- data/node_modules/govuk-frontend/govuk/settings/_typography-responsive.scss +6 -2
- data/node_modules/govuk-frontend/govuk/tools/_compatibility.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -4
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -4
- data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
- data/node_modules/govuk-frontend/govuk/utilities/_visually-hidden.scss +0 -1
- data/node_modules/govuk-frontend/govuk/vendor/_sass-mq.scss +0 -4
- data/package-lock.json +358 -288
- data/package.json +2 -2
- metadata +56 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b52d6e8aa198588eb1483b68997af30d2ead1179addc62110cfdab7d1d117920
|
4
|
+
data.tar.gz: ae9fb52fb1ca0929cc5be15f74ca32d6acd159eb248f397b976f963d8a00ca76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0b288f32a3adf1c974d525186efd8839b71372eed7425a1e31dc13f6a27b840e00536d481dca6218d303bdfea281299672b409080a53ab40c7b483968cfda84
|
7
|
+
data.tar.gz: 18de4113f809ff2c8ef69f399d20e0781241242eaf0660cd2668d023d3e136114abada7e783087b4bf8e19149c4d1ba570fe161fb7798ec33ff49e8bbc1de6dc
|
data/.gitignore
CHANGED
data/.nvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10
|
1
|
+
10
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 2.4.2
|
6
|
+
|
7
|
+
- [#251 Fix missing `<ul>` in single page navigation](https://github.com/alphagov/tech-docs-gem/pull/251)
|
8
|
+
|
9
|
+
## 2.4.1
|
10
|
+
|
11
|
+
- [#248: Remove IE8 fallback PNG with broken image reference](https://github.com/alphagov/tech-docs-gem/pull/248)
|
12
|
+
|
13
|
+
## 2.4.0
|
14
|
+
|
15
|
+
- [Bump redcarpet to 3.5.1 to fix CVE-2020-26298](https://github.com/alphagov/tech-docs-gem/pull/226)
|
16
|
+
- [#238: Move the aria-expanded attribute to the correct element](https://github.com/alphagov/tech-docs-gem/pull/238)
|
17
|
+
- [#240: Update menu html structure so it's one single hierarchical list](https://github.com/alphagov/tech-docs-gem/pull/240)
|
18
|
+
- [#244: Don't change the focus of the page on initial load](https://github.com/alphagov/tech-docs-gem/pull/244)
|
19
|
+
- [#243: Fix focus state for links containing inline code](https://github.com/alphagov/tech-docs-gem/pull/243)
|
20
|
+
- [#245: Fix focus state for search results ‘Close’ button](https://github.com/alphagov/tech-docs-gem/pull/245)
|
21
|
+
- [#246: Update GOV.UK Frontend to v3.13.0](https://github.com/alphagov/tech-docs-gem/pull/246)
|
22
|
+
|
23
|
+
## 2.3.0
|
24
|
+
|
25
|
+
- [#232: Update GOV.UK Frontend and use new link styles](https://github.com/alphagov/tech-docs-gem/pull/232)
|
26
|
+
|
3
27
|
## 2.2.2
|
4
28
|
|
5
29
|
- [#223: Remove unnecessary CSS class on the search submit button](https://github.com/alphagov/tech-docs-gem/pull/223)
|
data/govuk_tech_docs.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
+
spec.add_dependency "autoprefixer-rails", "~> 10.2"
|
35
36
|
spec.add_dependency "chronic", "~> 0.10.2"
|
36
37
|
spec.add_dependency "middleman", "~> 4.0"
|
37
38
|
spec.add_dependency "middleman-autoprefixer", "~> 2.10.0"
|
@@ -42,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
42
43
|
spec.add_dependency "middleman-syntax", "~> 3.2.0"
|
43
44
|
spec.add_dependency "nokogiri"
|
44
45
|
spec.add_dependency "openapi3_parser", "~> 0.9.0"
|
45
|
-
spec.add_dependency "redcarpet", "~> 3.5.
|
46
|
+
spec.add_dependency "redcarpet", "~> 3.5.1"
|
46
47
|
|
47
48
|
spec.add_development_dependency "byebug"
|
48
49
|
spec.add_development_dependency "capybara", "~> 3.32"
|
@@ -34,10 +34,9 @@
|
|
34
34
|
arrayOfIds.push(uniqueId)
|
35
35
|
$(this).addClass('collapsible__body')
|
36
36
|
.attr('id', uniqueId)
|
37
|
-
.attr('aria-expanded', 'false')
|
38
37
|
})
|
39
38
|
$heading.addClass('collapsible__heading')
|
40
|
-
.after('<button class="collapsible__toggle" aria-controls="' + arrayOfIds.join(' ') + '"><span class="collapsible__toggle-label">Expand ' + $heading.text() + '</span><span class="collapsible__toggle-icon" aria-hidden="true"></button>')
|
39
|
+
.after('<button class="collapsible__toggle" aria-expanded="false" aria-controls="' + arrayOfIds.join(' ') + '"><span class="collapsible__toggle-label">Expand ' + $heading.text() + '</span><span class="collapsible__toggle-icon" aria-hidden="true"></button>')
|
41
40
|
$topLevelItem.on('click', '.collapsible__toggle', function (e) {
|
42
41
|
e.preventDefault()
|
43
42
|
var $parent = $(this).parent()
|
@@ -47,14 +46,15 @@
|
|
47
46
|
}
|
48
47
|
|
49
48
|
function toggleHeading ($topLevelItem) {
|
50
|
-
var
|
49
|
+
var setOpen = !$topLevelItem.hasClass('is-open')
|
50
|
+
|
51
51
|
var $heading = $topLevelItem.find('> a')
|
52
|
-
var $
|
52
|
+
var $button = $topLevelItem.find('.collapsible__toggle')
|
53
53
|
var $toggleLabel = $topLevelItem.find('.collapsible__toggle-label')
|
54
54
|
|
55
|
-
$topLevelItem.toggleClass('is-open',
|
56
|
-
$
|
57
|
-
$toggleLabel.text(
|
55
|
+
$topLevelItem.toggleClass('is-open', setOpen)
|
56
|
+
$button.attr('aria-expanded', setOpen ? 'true' : 'false')
|
57
|
+
$toggleLabel.text(setOpen ? 'Collapse ' + $heading.text() : 'Expand ' + $heading.text())
|
58
58
|
}
|
59
59
|
|
60
60
|
function openActiveHeading () {
|
@@ -47,14 +47,12 @@
|
|
47
47
|
fragment = fragmentForFirstElementInView()
|
48
48
|
}
|
49
49
|
|
50
|
-
|
50
|
+
highlightActiveItemInToc(fragment)
|
51
51
|
}
|
52
52
|
|
53
53
|
function handleScrollEvent () {
|
54
|
-
|
55
|
-
}
|
54
|
+
var fragment = fragmentForFirstElementInView()
|
56
55
|
|
57
|
-
function handleChangeInActiveItem (fragment) {
|
58
56
|
storeCurrentPositionInHistoryApi(fragment)
|
59
57
|
highlightActiveItemInToc(fragment)
|
60
58
|
}
|
@@ -1,20 +1,19 @@
|
|
1
1
|
$govuk-assets-path: "/assets/govuk/assets/";
|
2
2
|
|
3
3
|
// Include only the bits of GOV.UK Frontend we need
|
4
|
-
|
5
|
-
@import "govuk/
|
6
|
-
@import "govuk/helpers/all";
|
4
|
+
$govuk-new-link-styles: true;
|
5
|
+
@import "govuk/base";
|
7
6
|
|
8
7
|
@import "govuk/core/all";
|
9
8
|
@import "govuk/objects/all";
|
10
9
|
|
11
|
-
@import "govuk/components/footer/
|
12
|
-
@import "govuk/components/header/
|
13
|
-
@import "govuk/components/inset-text/
|
14
|
-
@import "govuk/components/input/
|
15
|
-
@import "govuk/components/tag/
|
16
|
-
@import "govuk/components/skip-link/
|
17
|
-
@import "govuk/components/warning-text/
|
10
|
+
@import "govuk/components/footer/index";
|
11
|
+
@import "govuk/components/header/index";
|
12
|
+
@import "govuk/components/inset-text/index";
|
13
|
+
@import "govuk/components/input/index";
|
14
|
+
@import "govuk/components/tag/index";
|
15
|
+
@import "govuk/components/skip-link/index";
|
16
|
+
@import "govuk/components/warning-text/index";
|
18
17
|
|
19
18
|
@import "govuk/utilities/all";
|
20
19
|
@import "govuk/overrides/all";
|
@@ -87,21 +87,9 @@ html.has-search-results-open {
|
|
87
87
|
min-height: auto;
|
88
88
|
}
|
89
89
|
|
90
|
-
a
|
91
|
-
|
92
|
-
|
93
|
-
}
|
94
|
-
|
95
|
-
a:hover {
|
96
|
-
text-decoration: underline;
|
97
|
-
|
98
|
-
&:focus {
|
99
|
-
text-decoration: none;
|
100
|
-
}
|
101
|
-
}
|
102
|
-
a:focus {
|
103
|
-
outline: none;
|
104
|
-
@include govuk-focused-text;
|
90
|
+
a {
|
91
|
+
@include govuk-link-common;
|
92
|
+
@include govuk-link-style-no-visited-state;
|
105
93
|
}
|
106
94
|
}
|
107
95
|
.search-results__inner {
|
@@ -142,16 +130,7 @@ html.has-search-results-open {
|
|
142
130
|
cursor: pointer;
|
143
131
|
|
144
132
|
&:focus {
|
145
|
-
|
146
|
-
outline: $govuk-focus-width solid transparent;
|
147
|
-
box-shadow: inset 0 0 0 1px $govuk-focus-colour;
|
148
|
-
}
|
149
|
-
|
150
|
-
&:focus:not(:active):not(:hover) {
|
151
|
-
border-color: $govuk-focus-colour;
|
152
|
-
color: $govuk-focus-text-colour;
|
153
|
-
background-color: $govuk-focus-colour;
|
154
|
-
box-shadow: 0 2px 0 $govuk-focus-text-colour;
|
133
|
+
@include govuk-focused-text;
|
155
134
|
}
|
156
135
|
|
157
136
|
&::after {
|
@@ -15,14 +15,18 @@
|
|
15
15
|
|
16
16
|
&__list {
|
17
17
|
li {
|
18
|
+
a {
|
19
|
+
@include govuk-link-decoration;
|
20
|
+
@include govuk-link-style-no-visited-state;
|
21
|
+
@include govuk-link-style-no-underline;
|
22
|
+
}
|
23
|
+
|
18
24
|
a:link, a:visited {
|
19
25
|
display: block;
|
20
26
|
position: relative;
|
21
27
|
padding: 8px govuk-spacing(6) 8px govuk-spacing(2);
|
22
28
|
margin: 0 -1 * govuk-spacing(3);
|
23
29
|
border-left: 5px solid transparent;
|
24
|
-
text-decoration: none;
|
25
|
-
color: $govuk-link-colour;
|
26
30
|
|
27
31
|
@include govuk-media-query(tablet) {
|
28
32
|
&.toc-link--in-view {
|
@@ -33,21 +37,17 @@
|
|
33
37
|
}
|
34
38
|
}
|
35
39
|
|
40
|
+
a:hover {
|
41
|
+
@include govuk-link-hover-decoration;
|
42
|
+
}
|
43
|
+
|
36
44
|
a:focus {
|
37
|
-
|
45
|
+
text-decoration: none;
|
38
46
|
|
39
47
|
span {
|
40
48
|
@include govuk-focused-text;
|
41
49
|
}
|
42
50
|
}
|
43
|
-
|
44
|
-
a:hover {
|
45
|
-
text-decoration: underline;
|
46
|
-
|
47
|
-
&:focus {
|
48
|
-
text-decoration: none;
|
49
|
-
}
|
50
|
-
}
|
51
51
|
}
|
52
52
|
|
53
53
|
// Top level
|
@@ -24,7 +24,7 @@ module GovukTechDocs
|
|
24
24
|
end
|
25
25
|
|
26
26
|
if tree.children.any? && level < @max_level
|
27
|
-
output += indentation + "<ul>\n"
|
27
|
+
output += indentation + "<ul>\n" unless level.zero?
|
28
28
|
|
29
29
|
tree.children.each do |child|
|
30
30
|
output += indentation + INDENTATION_INCREMENT + "<li>\n"
|
@@ -36,7 +36,7 @@ module GovukTechDocs
|
|
36
36
|
output += indentation + INDENTATION_INCREMENT + "</li>\n"
|
37
37
|
end
|
38
38
|
|
39
|
-
output += indentation + "</ul>\n"
|
39
|
+
output += indentation + "</ul>\n" unless level.zero?
|
40
40
|
end
|
41
41
|
|
42
42
|
output
|
@@ -8,14 +8,11 @@ module GovukTechDocs
|
|
8
8
|
module TableOfContents
|
9
9
|
module Helpers
|
10
10
|
def single_page_table_of_contents(html, url: "", max_level: nil)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
raise "No H1 tag found. You have to at least add one H1 heading to the page: " + url
|
15
|
-
end
|
11
|
+
output = "<ul>\n"
|
12
|
+
output += list_items_from_headings(html, url: url, max_level: max_level)
|
13
|
+
output += "</ul>\n"
|
16
14
|
|
17
|
-
|
18
|
-
HeadingTreeRenderer.new(tree, max_level: max_level).html
|
15
|
+
output
|
19
16
|
end
|
20
17
|
|
21
18
|
def multi_page_table_of_contents(resources, current_page, config, current_page_html = nil)
|
@@ -28,11 +25,23 @@ module GovukTechDocs
|
|
28
25
|
render_page_tree(resources, current_page, config, current_page_html)
|
29
26
|
end
|
30
27
|
|
28
|
+
def list_items_from_headings(html, url: "", max_level: nil)
|
29
|
+
headings = HeadingsBuilder.new(html, url).headings
|
30
|
+
|
31
|
+
if headings.none? { |heading| heading.size == 1 }
|
32
|
+
raise "No H1 tag found. You have to at least add one H1 heading to the page: " + url
|
33
|
+
end
|
34
|
+
|
35
|
+
tree = HeadingTreeBuilder.new(headings).tree
|
36
|
+
HeadingTreeRenderer.new(tree, max_level: max_level).html
|
37
|
+
end
|
38
|
+
|
31
39
|
def render_page_tree(resources, current_page, config, current_page_html)
|
32
40
|
# Sort by weight frontmatter
|
33
41
|
resources = resources
|
34
42
|
.sort_by { |r| [r.data.weight ? 0 : 1, r.data.weight || 0] }
|
35
|
-
|
43
|
+
|
44
|
+
output = "<ul>\n"
|
36
45
|
resources.each do |resource|
|
37
46
|
# Skip from page tree if hide_in_navigation:true frontmatter
|
38
47
|
next if resource.data.hide_in_navigation
|
@@ -63,18 +72,20 @@ module GovukTechDocs
|
|
63
72
|
end
|
64
73
|
|
65
74
|
if resource.children.any? && resource.url != home_url
|
66
|
-
output += %{<
|
75
|
+
output += %{<li><a href="#{resource.url}"><span>#{resource.data.title}</span></a>\n}
|
67
76
|
output += render_page_tree(resource.children, current_page, config, current_page_html)
|
68
|
-
output += "</li
|
77
|
+
output += "</li>\n"
|
69
78
|
else
|
70
79
|
output +=
|
71
|
-
|
80
|
+
list_items_from_headings(
|
72
81
|
content,
|
73
82
|
url: resource.url,
|
74
83
|
max_level: config[:tech_docs][:max_toc_heading_level],
|
75
84
|
)
|
76
85
|
end
|
77
86
|
end
|
87
|
+
output += "</ul>\n"
|
88
|
+
|
78
89
|
output
|
79
90
|
end
|
80
91
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
focusable="false"
|
14
14
|
class="govuk-header__logotype-crown"
|
15
15
|
xmlns="http://www.w3.org/2000/svg"
|
16
|
-
|
16
|
+
viewBox="0 0 132 97"
|
17
17
|
height="30"
|
18
18
|
width="36"
|
19
19
|
>
|
@@ -21,7 +21,6 @@
|
|
21
21
|
fill="currentColor" fill-rule="evenodd"
|
22
22
|
d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.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
23
|
></path>
|
24
|
-
<image src="/assets/images/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
|
25
24
|
</svg>
|
26
25
|
<span class="govuk-header__logotype-text">
|
27
26
|
GOV.UK
|
@@ -4,8 +4,10 @@ wrap_layout :core do
|
|
4
4
|
|
5
5
|
content_for(:toc_module, "in-page-navigation")
|
6
6
|
|
7
|
+
use_multipage_nav = current_page.data.fetch(:multipage_nav, config[:tech_docs][:multipage_nav])
|
8
|
+
|
7
9
|
content_for :sidebar do
|
8
|
-
if
|
10
|
+
if use_multipage_nav %>
|
9
11
|
<%= multi_page_table_of_contents(sitemap.resources, current_page, config, html) %>
|
10
12
|
<% else %>
|
11
13
|
<%= single_page_table_of_contents(html, max_level: config[:tech_docs][:max_toc_heading_level]) %>
|