govuk_tech_docs 2.0.13 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of govuk_tech_docs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +3 -0
- data/CHANGELOG.md +54 -1
- data/README.md +15 -22
- data/example/.ruby-version +1 -1
- data/example/source/index.html.md.erb +1 -0
- data/example/source/prevent-index-page.html.md +10 -0
- data/govuk_tech_docs.gemspec +1 -7
- data/lib/assets/javascripts/_modules/search.js +13 -2
- data/lib/assets/javascripts/_modules/table-of-contents.js +9 -14
- data/lib/assets/stylesheets/modules/_page-review.scss +3 -5
- data/lib/assets/stylesheets/modules/_search.scss +47 -9
- data/lib/assets/stylesheets/modules/_technical-documentation.scss +11 -2
- data/lib/assets/stylesheets/modules/_toc.scss +12 -2
- data/lib/govuk_tech_docs/api_reference/api_reference_extension.rb +0 -1
- data/lib/govuk_tech_docs/api_reference/api_reference_renderer.rb +70 -186
- data/lib/govuk_tech_docs/api_reference/templates/api_reference_full.html.erb +3 -2
- data/lib/govuk_tech_docs/api_reference/templates/operation.html.erb +1 -1
- data/lib/govuk_tech_docs/api_reference/templates/parameters.html.erb +1 -1
- data/lib/govuk_tech_docs/api_reference/templates/responses.html.erb +1 -1
- data/lib/govuk_tech_docs/api_reference/templates/schema.html.erb +12 -12
- data/lib/govuk_tech_docs/meta_tags.rb +27 -8
- data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +75 -1
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/source/images/search-button.png +0 -0
- data/lib/source/layouts/_search.erb +10 -4
- data/lib/source/layouts/core.erb +7 -10
- data/package-lock.json +3 -3
- metadata +7 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ebb7068421c3f7bc160f08cc145763a4d85df044700f794193403de1774bde5
|
4
|
+
data.tar.gz: 2ac84d99205129b273d153bfba9223bfb03933f4ca0a9202f0074e68869e267d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8893b47757fcd32d00e863c58a0ca96d1dbc96d6eb139db9d7a6c56a852322040a737b56c64e0b6871a25bfdc84bfcd217e3786cd7d21afc66dbae24c770617
|
7
|
+
data.tar.gz: 05e1d0c02f4cf4a912afdb86e560e1cb31c5f74f67962baf392002e26c78d8567df5c51396b1546a71ae7e2476c30df5175f2e6aeea4ec0b9214ed3ff0695a67
|
@@ -0,0 +1 @@
|
|
1
|
+
⚠️ Don't forget to update the gem version in the [CHANGELOG](https://github.com/alphagov/tech-docs-gem/blob/master/CHANGELOG.md) before merging! When you're ready to release bump [version file](https://github.com/alphagov/tech-docs-gem/blob/master/lib/govuk_tech_docs/version.rb) and generate a tag. ⚠️
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,59 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.2.2
|
4
|
+
|
5
|
+
- [#223: Remove unnecessary CSS class on the search submit button](https://github.com/alphagov/tech-docs-gem/pull/223)
|
6
|
+
- [#224: Accessibility fix: Hide the 'table of contents close' button when search results are open](https://github.com/alphagov/tech-docs-gem/pull/224)
|
7
|
+
|
8
|
+
## 2.2.1
|
9
|
+
|
10
|
+
- [#218: Remove unnecessary explicit dependencies: sprockets, activesupport, sass and pry](https://github.com/alphagov/tech-docs-gem/pull/218)
|
11
|
+
- [#125: Fix API docs showing required properties as optional](https://github.com/alphagov/tech-docs-gem/pull/125)
|
12
|
+
|
13
|
+
## 2.2.0
|
14
|
+
|
15
|
+
### Accessibility Fixes
|
16
|
+
|
17
|
+
- [#205: Improve table of contents accessibility](https://github.com/alphagov/tech-docs-gem/pull/205)
|
18
|
+
- [#209: Some search and keyboard navigation updates](https://github.com/alphagov/tech-docs-gem/pull/209)
|
19
|
+
- [#210: Stop linking images to new tabs](https://github.com/alphagov/tech-docs-gem/pull/210)
|
20
|
+
- [#214: Implement row level table headings to allow accessible tables with row headings](https://github.com/alphagov/tech-docs-gem/pull/214)
|
21
|
+
- [#215: Add tabindex and focus states to code blocks](https://github.com/alphagov/tech-docs-gem/pull/215)
|
22
|
+
|
23
|
+
### Docs
|
24
|
+
|
25
|
+
- [#206: Remove tdt docs content from readme file](https://github.com/alphagov/tech-docs-gem/pull/206)
|
26
|
+
|
27
|
+
## 2.1.1
|
28
|
+
|
29
|
+
### Fixes
|
30
|
+
|
31
|
+
We’ve made fixes in the following pull requests:
|
32
|
+
|
33
|
+
- [#199: Fix page expiry box link colours (hover and focus) ](https://github.com/alphagov/tech-docs-gem/pull/199)
|
34
|
+
|
35
|
+
### Ruby version bump
|
36
|
+
|
37
|
+
We've updated the Ruby version supported:
|
38
|
+
|
39
|
+
- [#201: Bump ruby to 2.7.2](https://github.com/alphagov/tech-docs-gem/pull/201)
|
40
|
+
|
41
|
+
## 2.1.0
|
42
|
+
|
43
|
+
### New features
|
44
|
+
|
45
|
+
#### Exclude pages from search engine results
|
46
|
+
|
47
|
+
You can now exclude a page from search engine results by including `prevent_indexing: true` in the page's frontmatter.
|
48
|
+
|
49
|
+
This was added in [pull request #192: Fixes and improvements to meta tags](https://github.com/alphagov/tech-docs-gem/pull/192).
|
50
|
+
|
51
|
+
### Fixes
|
52
|
+
|
53
|
+
We’ve made fixes in the following pull requests:
|
54
|
+
|
55
|
+
- [#192: Fixes and improvements to meta tags](https://github.com/alphagov/tech-docs-gem/pull/192)
|
56
|
+
|
3
57
|
## 2.0.13
|
4
58
|
|
5
59
|
- [Pull request #189: Update orange code highlight colour to meet minimum AA colour contrast ratio criterion](https://github.com/alphagov/tech-docs-gem/pull/189)
|
@@ -56,7 +110,6 @@ You can look at the [2.0.6 milestone](https://github.com/alphagov/tech-docs-gem/
|
|
56
110
|
|
57
111
|
## 2.0.5
|
58
112
|
|
59
|
-
|
60
113
|
Adds [new global configuration option](https://github.com/alphagov/tech-docs-gem/pull/122) that controls whether review banners appear or not at the bottom of pages when expiry dates are set in the frontmatter.
|
61
114
|
|
62
115
|
[Fixes the hard-coded service link](https://github.com/alphagov/tech-docs-gem/pull/119) in the header.
|
data/README.md
CHANGED
@@ -3,23 +3,19 @@
|
|
3
3
|
This repo contains the Ruby gem that distributes the [Tech Docs Template][tdt-template]. The Tech Docs Template is a [middleman template][mmt] that
|
4
4
|
you can use to build technical documentation using a GOV.UK style.
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
## Usage
|
9
|
-
|
10
|
-
👉 Find out how to [generate a new website with the Tech Docs Template][tdt-readme].
|
6
|
+
To find out more about setting up and managing content for a website using this template, see the [Tech Docs Template documentation][tdt-docs].
|
11
7
|
|
12
8
|
## Contributing
|
13
9
|
|
14
10
|
Everybody who uses this project is encouraged to contribute.
|
15
11
|
|
16
|
-
|
12
|
+
You can find out more about contributing to this project from the[CONTRIBUTING.md file](CONTRIBUTING.md).
|
17
13
|
|
18
14
|
## GOV.UK frontend
|
19
15
|
|
20
16
|
This gem uses [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend), part of the [GOV.UK Design System](https://design-system.service.gov.uk/).
|
21
17
|
|
22
|
-
We use `npm` to download the govuk-frontend package. To update to a new version, change the version in [package.json](blob/master/package.json) and run `npm update`.
|
18
|
+
We use `npm` to download the govuk-frontend package. To update to a new version, change the version in the [package.json file](blob/master/package.json) and run `npm update`.
|
23
19
|
|
24
20
|
## Developing locally
|
25
21
|
|
@@ -30,19 +26,13 @@ There are 2 ways to develop with this gem. You can see your changes on either:
|
|
30
26
|
|
31
27
|
### Use your own Tech Docs Template website
|
32
28
|
|
33
|
-
|
29
|
+
To see how your changes to the gem affect your website, point your website's Gemfile to your local checkout:
|
34
30
|
|
35
31
|
```rb
|
36
32
|
gem 'govuk_tech_docs', path: '../tech-docs-gem'
|
37
33
|
```
|
38
34
|
|
39
|
-
To
|
40
|
-
|
41
|
-
```sh
|
42
|
-
bundle exec middleman server
|
43
|
-
```
|
44
|
-
|
45
|
-
See your website on `http://localhost:4567` in your browser.
|
35
|
+
To preview your documentation changes locally, see the [Tech Docs Template documentation on previewing your documentation](https://tdt-documentation.london.cloudapps.digital/create_project/preview/#preview-your-documentation).
|
46
36
|
|
47
37
|
### Use the example in this repo
|
48
38
|
|
@@ -56,14 +46,16 @@ bundle exec middleman server
|
|
56
46
|
|
57
47
|
See your website on `http://localhost:4567` in your browser.
|
58
48
|
|
49
|
+
For more information on previewing your documentation locally, see the [Tech Docs template documentation on previewing your documentation](https://tdt-documentation.london.cloudapps.digital/create_project/preview/#preview-your-documentation).
|
50
|
+
|
59
51
|
## Tests
|
60
52
|
|
61
|
-
|
53
|
+
This repository contains automated JavaScript tests that use the [Jasmine test framework][jas].
|
62
54
|
|
63
|
-
|
55
|
+
You can run these tests and see the results in your browser.
|
64
56
|
|
65
|
-
1. Run `bundle exec rake jasmine
|
66
|
-
2. Go to `http://localhost:8888` in your browser
|
57
|
+
1. Run `bundle exec rake jasmine`.
|
58
|
+
2. Go to `http://localhost:8888` in your browser.
|
67
59
|
|
68
60
|
To run the tests and see the results in your terminal, run:
|
69
61
|
|
@@ -73,14 +65,15 @@ bundle exec rake jasmine:ci
|
|
73
65
|
|
74
66
|
## Releasing new versions
|
75
67
|
|
76
|
-
To release a new version, create a new
|
68
|
+
To release a new version, create a new pull request (PR) that updates [version.rb](lib/govuk_tech_docs/version.rb) and [CHANGELOG.md](CHANGELOG.md).
|
69
|
+
|
70
|
+
Do not include other changes in your pull request, as this makes it easier to find out what was released when. See an example of a [PR for releasing a new version](https://github.com/alphagov/tech-docs-gem/pull/15).
|
77
71
|
|
78
72
|
Travis will automatically release a [new version to Rubygems.org](https://rubygems.org/gems/govuk_tech_docs).
|
79
73
|
|
80
74
|
## Licence
|
81
75
|
|
82
|
-
Unless stated otherwise, the codebase is released under [the MIT License][mit].
|
83
|
-
This covers both the codebase and any sample code in the documentation.
|
76
|
+
Unless stated otherwise, the codebase is released under [the MIT License][mit]. This covers both the codebase and any sample code in the documentation.
|
84
77
|
|
85
78
|
The documentation is [© Crown copyright][copyright] and available under the terms of the [Open Government 3.0][ogl] licence.
|
86
79
|
|
data/example/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/govuk_tech_docs.gemspec
CHANGED
@@ -32,7 +32,6 @@ 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 "activesupport"
|
36
35
|
spec.add_dependency "chronic", "~> 0.10.2"
|
37
36
|
spec.add_dependency "middleman", "~> 4.0"
|
38
37
|
spec.add_dependency "middleman-autoprefixer", "~> 2.10.0"
|
@@ -42,14 +41,9 @@ Gem::Specification.new do |spec|
|
|
42
41
|
spec.add_dependency "middleman-sprockets", "~> 4.0.0"
|
43
42
|
spec.add_dependency "middleman-syntax", "~> 3.2.0"
|
44
43
|
spec.add_dependency "nokogiri"
|
45
|
-
spec.add_dependency "openapi3_parser", "~> 0.
|
46
|
-
spec.add_dependency "pry"
|
44
|
+
spec.add_dependency "openapi3_parser", "~> 0.9.0"
|
47
45
|
spec.add_dependency "redcarpet", "~> 3.5.0"
|
48
|
-
spec.add_dependency "sass"
|
49
|
-
spec.add_dependency "sprockets", "~> 4.0.0"
|
50
46
|
|
51
|
-
|
52
|
-
spec.add_development_dependency "bundler", "~> 2.1.4"
|
53
47
|
spec.add_development_dependency "byebug"
|
54
48
|
spec.add_development_dependency "capybara", "~> 3.32"
|
55
49
|
spec.add_development_dependency "jasmine", "~> 3.5.0"
|
@@ -6,6 +6,7 @@
|
|
6
6
|
Modules.Search = function Search () {
|
7
7
|
var s = this
|
8
8
|
var $html = $('html')
|
9
|
+
var $tocNav
|
9
10
|
var $searchForm
|
10
11
|
var $searchLabel
|
11
12
|
var $searchInput
|
@@ -26,6 +27,7 @@
|
|
26
27
|
$searchResults = $searchResultsWrapper.find('.search-results__content')
|
27
28
|
$searchResultsTitle = $searchResultsWrapper.find('.search-results__title')
|
28
29
|
$searchResultsClose = $searchResultsWrapper.find('.search-results__close')
|
30
|
+
$tocNav = $('#toc')
|
29
31
|
s.downloadSearchIndex()
|
30
32
|
attach()
|
31
33
|
changeSearchLabel()
|
@@ -67,7 +69,14 @@
|
|
67
69
|
$searchForm.on('submit', function (e) {
|
68
70
|
e.preventDefault()
|
69
71
|
showResults()
|
70
|
-
$searchResults.find('.search-result__title a').first()
|
72
|
+
var $firstResult = $searchResults.find('.search-result__title a').first()
|
73
|
+
if ($firstResult.length) {
|
74
|
+
$firstResult.focus()
|
75
|
+
} else {
|
76
|
+
// if there are no results, show the "0 results" state
|
77
|
+
results = []
|
78
|
+
updateTitle()
|
79
|
+
}
|
71
80
|
})
|
72
81
|
|
73
82
|
// Closing the search results, move focus back to the search input
|
@@ -98,7 +107,7 @@
|
|
98
107
|
}
|
99
108
|
|
100
109
|
function changeSearchLabel () {
|
101
|
-
$searchLabel.text('Search')
|
110
|
+
$searchLabel.text('Search this documentation')
|
102
111
|
}
|
103
112
|
|
104
113
|
function getResults (query) {
|
@@ -192,12 +201,14 @@
|
|
192
201
|
$searchResultsWrapper.addClass('is-open')
|
193
202
|
.attr('aria-hidden', 'false')
|
194
203
|
$html.addClass('has-search-results-open')
|
204
|
+
$tocNav.addClass('search-results-open')
|
195
205
|
}
|
196
206
|
|
197
207
|
function hideResults () {
|
198
208
|
$searchResultsWrapper.removeClass('is-open')
|
199
209
|
.attr('aria-hidden', 'true')
|
200
210
|
$html.removeClass('has-search-results-open')
|
211
|
+
$tocNav.removeClass('search-results-open')
|
201
212
|
}
|
202
213
|
|
203
214
|
function sendQueryToAnalytics () {
|
@@ -7,23 +7,22 @@
|
|
7
7
|
var $toc
|
8
8
|
var $tocList
|
9
9
|
|
10
|
-
var $
|
11
|
-
var $
|
10
|
+
var $openButton
|
11
|
+
var $closeButton
|
12
12
|
|
13
13
|
this.start = function ($element) {
|
14
14
|
$toc = $element
|
15
15
|
$tocList = $toc.find('.js-toc-list')
|
16
|
-
|
17
16
|
// Open link is not inside the module
|
18
|
-
$
|
19
|
-
$
|
17
|
+
$openButton = $html.find('.js-toc-show')
|
18
|
+
$closeButton = $toc.find('.js-toc-close')
|
20
19
|
|
21
20
|
fixRubberBandingInIOS()
|
22
21
|
updateAriaAttributes()
|
23
22
|
|
24
23
|
// Need delegated handler for show link as sticky polyfill recreates element
|
25
|
-
$
|
26
|
-
$
|
24
|
+
$openButton.on('click.toc', preventingScrolling(openNavigation))
|
25
|
+
$closeButton.on('click.toc', preventingScrolling(closeNavigation))
|
27
26
|
$tocList.on('click.toc', 'a', closeNavigation)
|
28
27
|
|
29
28
|
// Allow aria hidden to be updated when resizing from mobile to desktop or
|
@@ -65,21 +64,17 @@
|
|
65
64
|
|
66
65
|
toggleBackgroundVisiblity(false)
|
67
66
|
updateAriaAttributes()
|
68
|
-
|
69
|
-
focusFirstLinkInToc()
|
67
|
+
$toc.focus()
|
70
68
|
}
|
71
69
|
|
72
70
|
function closeNavigation () {
|
73
71
|
$html.removeClass('toc-open')
|
72
|
+
$html.removeClass('has-search-results-open')
|
74
73
|
|
75
74
|
toggleBackgroundVisiblity(true)
|
76
75
|
updateAriaAttributes()
|
77
76
|
}
|
78
77
|
|
79
|
-
function focusFirstLinkInToc () {
|
80
|
-
$('a', $tocList).first().focus()
|
81
|
-
}
|
82
|
-
|
83
78
|
function toggleBackgroundVisiblity (visibility) {
|
84
79
|
$('.toc-open-disabled').attr('aria-hidden', visibility ? '' : 'true')
|
85
80
|
}
|
@@ -87,7 +82,7 @@
|
|
87
82
|
function updateAriaAttributes () {
|
88
83
|
var tocIsVisible = $toc.is(':visible')
|
89
84
|
|
90
|
-
$($
|
85
|
+
$($openButton).add($closeButton)
|
91
86
|
.attr('aria-expanded', tocIsVisible ? 'true' : 'false')
|
92
87
|
|
93
88
|
$toc.attr('aria-hidden', tocIsVisible ? 'false' : 'true')
|
@@ -1,16 +1,9 @@
|
|
1
|
+
$input-size: 40px;
|
2
|
+
|
1
3
|
@include govuk-media-query($media-type: screen) {
|
2
4
|
.page-title + .search {
|
3
5
|
margin-top: govuk-spacing(6);
|
4
6
|
}
|
5
|
-
|
6
|
-
.js .search__label {
|
7
|
-
position: absolute;
|
8
|
-
left: -9999em;
|
9
|
-
top: auto;
|
10
|
-
width: 1px;
|
11
|
-
height: 1px;
|
12
|
-
overflow: hidden;
|
13
|
-
}
|
14
7
|
}
|
15
8
|
|
16
9
|
@include govuk-media-query($media-type: print) {
|
@@ -19,11 +12,55 @@
|
|
19
12
|
}
|
20
13
|
}
|
21
14
|
|
15
|
+
.js .search__label {
|
16
|
+
@extend .govuk-visually-hidden;
|
17
|
+
}
|
18
|
+
|
19
|
+
.search__form {
|
20
|
+
position: relative;
|
21
|
+
}
|
22
|
+
|
23
|
+
.search__input {
|
24
|
+
width: 230px;
|
25
|
+
width: calc(100% - #{$input-size});
|
26
|
+
}
|
27
|
+
|
28
|
+
.search__button {
|
29
|
+
position: absolute;
|
30
|
+
bottom: 0;
|
31
|
+
right: 0;
|
32
|
+
border: 0;
|
33
|
+
background-color: govuk-colour('blue');
|
34
|
+
color: #fff;
|
35
|
+
cursor: pointer;
|
36
|
+
padding: 0;
|
37
|
+
width: $input-size;
|
38
|
+
height: 100%;
|
39
|
+
background-image: url('/images/search-button.png');
|
40
|
+
background-repeat: no-repeat;
|
41
|
+
background-position: 2px 50%;
|
42
|
+
text-indent: -5000px;
|
43
|
+
overflow: hidden;
|
44
|
+
&:focus {
|
45
|
+
outline: $govuk-focus-width solid $govuk-focus-colour;
|
46
|
+
outline-offset: 0;
|
47
|
+
box-shadow: inset 0 0 0 $govuk-border-width-form-element * 2 govuk-colour("black");
|
48
|
+
|
49
|
+
@include govuk-if-ie8 {
|
50
|
+
border-width: $govuk-border-width-form-element * 2;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
22
55
|
html.has-search-results-open {
|
23
56
|
overflow: hidden;
|
24
57
|
.app-pane__content {
|
25
58
|
overflow: hidden;
|
26
59
|
}
|
60
|
+
|
61
|
+
.toc__close{
|
62
|
+
display: none;
|
63
|
+
}
|
27
64
|
}
|
28
65
|
.search-results {
|
29
66
|
display: none;
|
@@ -47,6 +84,7 @@ html.has-search-results-open {
|
|
47
84
|
top: 0;
|
48
85
|
// The width of the sidebar
|
49
86
|
left: 330px;
|
87
|
+
min-height: auto;
|
50
88
|
}
|
51
89
|
|
52
90
|
a:link, a:visited {
|