govuk_tech_docs 2.0.11 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '085237b7227769188a60eeaf92b6dc4b8c46a2bb0c94f50daff3da0725dbe162'
4
- data.tar.gz: 7bdf01e0d6901791ca227d26a98ef1845afb713040aba2ff463c0bb1b509bddb
3
+ metadata.gz: 4adec245cbbc73fe2a14f73eb4a0eb2f9acf4d8d751f0786271c59f479c8b244
4
+ data.tar.gz: 9017c133a8dace561bf56b4e2ec852b4dcdc15a341501b8784659f229f2f183a
5
5
  SHA512:
6
- metadata.gz: 5a072be727fceaaab66ff8f78c70ab0a8901caf284a112761750c1d2668195d0d83c616b4bc75ecb89d600a37ec3c35309d255c3bd31b5641825067f71d04bf2
7
- data.tar.gz: 3e810980b8f5c57a850e3e5c7c841981e3bcf579056c88cdafaceab0b3c540a37050efb54bb6f14c1c39b6a4e01667738f17a6cdb7f152ba41fd09f54bde69fc
6
+ metadata.gz: 3da0c05902288480bf1953b7d5ad275742707cb8324cebe68a1f970cb9dda1b2c70a6538aa9af7a6272973e4b08b3a10108ad6591cbb78bae5aa4e46d436357d
7
+ data.tar.gz: 1ca0540c1625e80f25d89426f893d15368da0c13b84e5824c4808abd62bfed7bf1e4b93738c2ecd76fe43d70fd23b5517494078ab94367f062f4a73f8c0cec8f
@@ -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/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_gem:
2
2
  rubocop-govuk:
3
3
  - config/default.yml
4
4
 
5
- Layout/IndentHeredoc:
5
+ Layout/HeredocIndentation:
6
6
  Enabled: false
7
7
 
8
8
  Naming/HeredocDelimiterNaming:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.7.2
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+ cache:
3
+ bundler: true
4
+ npm: true
2
5
  before_install:
3
6
  - gem update --system
4
7
  - gem install bundler
data/CHANGELOG.md CHANGED
@@ -1,6 +1,58 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 2.2.0
4
+
5
+ ### Accessibility Fixes
6
+
7
+ - [#205: Improve table of contents accessibility](https://github.com/alphagov/tech-docs-gem/pull/205)
8
+ - [#209: Some search and keyboard navigation updates](https://github.com/alphagov/tech-docs-gem/pull/209)
9
+ - [#210: Stop linking images to new tabs](https://github.com/alphagov/tech-docs-gem/pull/210)
10
+ - [#214: Implement row level table headings to allow accessible tables with row headings](https://github.com/alphagov/tech-docs-gem/pull/214)
11
+ - [#215: Add tabindex and focus states to code blocks](https://github.com/alphagov/tech-docs-gem/pull/215)
12
+
13
+ ### Docs
14
+
15
+ - [#206: Remove tdt docs content from readme file](https://github.com/alphagov/tech-docs-gem/pull/206)
16
+
17
+ ## 2.1.1
18
+
19
+ ### Fixes
20
+
21
+ We’ve made fixes in the following pull requests:
22
+
23
+ - [#199: Fix page expiry box link colours (hover and focus) ](https://github.com/alphagov/tech-docs-gem/pull/199)
24
+
25
+ ### Ruby version bump
26
+
27
+ We've updated the Ruby version supported:
28
+
29
+ - [#201: Bump ruby to 2.7.2](https://github.com/alphagov/tech-docs-gem/pull/201)
30
+
31
+ ## 2.1.0
32
+
33
+ ### New features
34
+
35
+ #### Exclude pages from search engine results
36
+
37
+ You can now exclude a page from search engine results by including `prevent_indexing: true` in the page's frontmatter.
38
+
39
+ This was added in [pull request #192: Fixes and improvements to meta tags](https://github.com/alphagov/tech-docs-gem/pull/192).
40
+
41
+ ### Fixes
42
+
43
+ We’ve made fixes in the following pull requests:
44
+
45
+ - [#192: Fixes and improvements to meta tags](https://github.com/alphagov/tech-docs-gem/pull/192)
46
+
47
+ ## 2.0.13
48
+
49
+ - [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)
50
+
51
+ ## 2.0.12
52
+
53
+ - [Pull request #179: Use current markup for header and footer](https://github.com/alphagov/tech-docs-gem/pull/179)
54
+ - [Pull request #178: Update dependencies and fix tests](https://github.com/alphagov/tech-docs-gem/pull/178) – includes updating GOV.UK Frontend to v3.6.0.
55
+ - [Pull request #176: Use correct separator for page titles](https://github.com/alphagov/tech-docs-gem/pull/176)
4
56
 
5
57
  ## 2.0.11
6
58
 
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
- 👉 Find out more about the template and its features from the [Tech Docs Template documentation][tdt-docs].
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
- 👉 [See CONTRIBUTING.md](CONTRIBUTING.md) for guidance on making changes.
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
- If you want to see how your changes to the gem affect your website, you have to point your site's Gemfile to your local checkout:
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 view your changes locally run:
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
- The repository contains automated JavaScript tests that use [Jasmine][jas] test framework.
53
+ This repository contains automated JavaScript tests that use the [Jasmine test framework][jas].
62
54
 
63
- To run the tests and see the results in your browser:
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 Pull Request that updates [version.rb](lib/govuk_tech_docs/version.rb) and [CHANGELOG.md](CHANGELOG.md). Don't mix this in with other changes - this makes it easier to find out what was released when. See [this PR to release a new version as an example](https://github.com/alphagov/tech-docs-gem/pull/15).
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/Rakefile CHANGED
@@ -6,6 +6,7 @@ RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  load "jasmine/tasks/jasmine.rake"
8
8
 
9
+ desc "Lint Ruby and JavaScript"
9
10
  task :lint do
10
11
  sh "rubocop example lib spec Rakefile"
11
12
  sh "npm run lint --silent"
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.7.2
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: GOV.UK Documentation Example
3
+ description: Example of a documentation homepage
3
4
  old_paths:
4
5
  - /something/old-as-well.html
5
6
  ---
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Un-indexed Page
3
+ prevent_indexing: true
4
+ hide_in_navigation: true
5
+ ---
6
+
7
+ # Un-indexed page
8
+
9
+ This page should not be indexed by search engines, because it contains a
10
+ `<meta name="robots" content="noindex">` tag.
@@ -35,25 +35,25 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency "activesupport"
36
36
  spec.add_dependency "chronic", "~> 0.10.2"
37
37
  spec.add_dependency "middleman", "~> 4.0"
38
- spec.add_dependency "middleman-autoprefixer", "~> 2.7.0"
38
+ spec.add_dependency "middleman-autoprefixer", "~> 2.10.0"
39
39
  spec.add_dependency "middleman-compass", ">= 4.0.0"
40
40
  spec.add_dependency "middleman-livereload"
41
- spec.add_dependency "middleman-sprockets", "~> 4.0.0"
42
- spec.add_dependency "sprockets", "4.0.0.beta10"
43
- spec.add_dependency "sass"
44
- spec.add_dependency "middleman-syntax", "~> 3.0.0"
45
41
  spec.add_dependency "middleman-search-gds"
42
+ spec.add_dependency "middleman-sprockets", "~> 4.0.0"
43
+ spec.add_dependency "middleman-syntax", "~> 3.2.0"
46
44
  spec.add_dependency "nokogiri"
47
- spec.add_dependency "redcarpet", "~> 3.3.2"
48
45
  spec.add_dependency "openapi3_parser", "~> 0.5.0"
49
46
  spec.add_dependency "pry"
47
+ spec.add_dependency "redcarpet", "~> 3.5.0"
48
+ spec.add_dependency "sass"
49
+ spec.add_dependency "sprockets", "~> 4.0.0"
50
50
 
51
51
 
52
- spec.add_development_dependency "bundler", "~> 2.0.1"
53
- spec.add_development_dependency "rake", "~> 10.0"
54
- spec.add_development_dependency "capybara", "~> 2.18.0"
55
- spec.add_development_dependency "rubocop-govuk", "~> 1.0.0"
56
- spec.add_development_dependency "jasmine", "~> 3.1.0"
57
- spec.add_development_dependency "rspec", "~> 3.7.0"
52
+ spec.add_development_dependency "bundler", "~> 2.2.0"
58
53
  spec.add_development_dependency "byebug"
54
+ spec.add_development_dependency "capybara", "~> 3.32"
55
+ spec.add_development_dependency "jasmine", "~> 3.5.0"
56
+ spec.add_development_dependency "rake", "~> 13.0"
57
+ spec.add_development_dependency "rspec", "~> 3.9.0"
58
+ spec.add_development_dependency "rubocop-govuk", "~> 3.5.0"
59
59
  end
@@ -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().focus()
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 $openLink
11
- var $closeLink
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
- $openLink = $html.find('.js-toc-show')
19
- $closeLink = $toc.find('.js-toc-close')
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
- $openLink.on('click.toc', preventingScrolling(openNavigation))
26
- $closeLink.on('click.toc', preventingScrolling(closeNavigation))
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
- $($openLink).add($closeLink)
85
+ $($openButton).add($closeButton)
91
86
  .attr('aria-expanded', tocIsVisible ? 'true' : 'false')
92
87
 
93
88
  $toc.attr('aria-hidden', tocIsVisible ? 'false' : 'true')
@@ -13,11 +13,9 @@
13
13
 
14
14
  a:link,
15
15
  a:visited {
16
- color: inherit;
17
- }
18
-
19
- a:hover {
20
- color: $govuk-link-hover-colour;
16
+ &:not(:focus) {
17
+ color: inherit;
18
+ }
21
19
  }
22
20
 
23
21
  a:active {
@@ -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,6 +12,46 @@
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 {
@@ -47,6 +80,7 @@ html.has-search-results-open {
47
80
  top: 0;
48
81
  // The width of the sidebar
49
82
  left: 330px;
83
+ min-height: auto;
50
84
  }
51
85
 
52
86
  a:link, a:visited {