govuk_tech_docs 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5e6745794ab18eb8c628384b868c10edaecfe5a
4
- data.tar.gz: 6d93cae1fd2a09c0addc299fa7b43bceecd6208f
3
+ metadata.gz: eaca63877550e5756571d4f83ced3aceaf75ffcd
4
+ data.tar.gz: 5a71ac6ab0aae9c7c543fd7636dfde0c3731a9cf
5
5
  SHA512:
6
- metadata.gz: c9a3f2c71458829e25e27d0cf79cea3d19e125bafb8e3c2c28827312e2a6d6a4d28cd9b0e01aa999f051f3b0881a081d1b14dbe250e47d6d055ba48765ec1e02
7
- data.tar.gz: b77c6acc475897e7423b3067abcc41f339539bd6cd5b4eb85c219fafc6a0cf8de60eec81ce55df3e7469c6a2fecedd0088261edf0c003c860f3935cd03905233
6
+ metadata.gz: 556dd03f8c48c4430916f3abfb5c404ccd922a2eaf7f88ebe9a50bba738c6414e4a2edac4d3773a8a58f1ff796d1d273fcc755864b0640eb6e50d902f8fab6d0
7
+ data.tar.gz: 393990c7b091850721339f07663e602e590a81c4582e931a8662f04ce41ee6e4437afac8ca5e6be4b6720a5822960ff6c868a7740b14890b842d0aa8b6e8651c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0
4
+
5
+ Version 1.3.0 contains accessibility fixes (#20) and a fix to make the
6
+ site more robust when certain options aren't set in the configs (#17).
7
+
8
+ ### New feature: passing options to `GovukTechDocs.configure`
9
+
10
+ You can now pass options into `GovukTechDocs.configure` for the `livereload`
11
+ extension.
12
+
13
+ ```rb
14
+ GovukTechDocs.configure(self, livereload: { js_host: 'localhost' })
15
+ ```
16
+
17
+ See PR #18.
18
+
19
+ ### New feature: page parents
20
+
21
+ You can now specify a page’s parent in its frontmatter. This affects
22
+ which item is selected in the navigation.
23
+
24
+ More info:
25
+
26
+ - https://github.com/alphagov/tech-docs-gem/pull/19
27
+ - https://github.com/alphagov/tech-docs-gem/blob/master/docs/frontmatter.md#parent
28
+
3
29
  ## 1.2.0
4
30
 
5
31
  ### New feature: redirects
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,9 @@
1
+ ## Contributing to this project
2
+
3
+ Everybody who uses this project is encouraged to contribute to this project. If you're part of the [alphagov GitHub organisation](https://www.github.com/alphagov) you probably have write access to this repo. If you don't, ask a GitHub admin or #tech-docs-format on Slack.
4
+
5
+ - Before adding your feature, [check the backlog to see if someone is already talking about it](https://github.com/alphagov/tech-docs-template/issues)
6
+ - If you add a new option to `config/tech-docs.yml`, make sure you [document the option in docs/configuration.md](docs/configuration.md)
7
+ - If you add a new option to the page frontmatter, make sure you [document the option in docs/frontmatter.md](docs/configuration.md)
8
+ - You can test your contribution using [unit tests](spec/govuk_tech_docs), [javascript tests](spec/javascripts) or [integration tests](spec/features)
9
+ - If your change is relevant to the users of the gem, add something to [CHANGELOG](CHANGELOG.md). You don't have to do this if it's just refactoring. Make sure that you include any upgrade instructions.
data/README.md CHANGED
@@ -6,6 +6,10 @@ This repo is part of the [tech-docs-template](https://github.com/alphagov/tech-d
6
6
 
7
7
  To [generate a new site with the template](https://github.com/alphagov/tech-docs-template#creating-a-new-documentation-project), see the tech-docs-template repo.
8
8
 
9
+ ## Contributing
10
+
11
+ 👉 [See CONTRIBUTING.md](CONTRIBUTING.md)
12
+
9
13
  ## Developing locally
10
14
 
11
15
  There are 2 ways to develop with this gem.
@@ -19,8 +23,7 @@ gem 'govuk_tech_docs', path: '../tech-docs-gem'
19
23
  The second is to use the example app in this repo. You can start it by
20
24
 
21
25
  ```
22
- git clone git@github.com:alphagov/tech-docs-gem.git
23
- cd tech-docs-gem/example
26
+ cd example
24
27
  bundle install
25
28
  bundle exec middleman serve
26
29
  ```
@@ -40,6 +43,14 @@ To run the tests on your machine:
40
43
 
41
44
  Or, on the command line, run `bundle exec rake jasmine:ci`.
42
45
 
46
+ ## Releasing new versions
47
+
48
+ At the moment this gem has to be released manually. There's a [story on the Reliability Engineering backlog](https://trello.com/c/gRQ8OnBl) to automate this.
49
+
50
+ 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).
51
+
52
+ [Owners of the Rubygem](https://rubygems.org/gems/govuk_tech_docs#gem__owners) can then run `rake release` to release a new version.
53
+
43
54
  ## License
44
55
 
45
56
  The gem is available as open source under the terms of the [MIT License](LICENSE).
data/docs/frontmatter.md CHANGED
@@ -110,4 +110,14 @@ title: My beautiful page
110
110
  ---
111
111
  ```
112
112
 
113
+ ## `parent`
114
+
115
+ The page that should be highlighted as ‘active’ in the navigation.
116
+
117
+ ```yaml
118
+ ---
119
+ parent: shaving-yaks.html
120
+ ---
121
+ ```
122
+
113
123
  [mm]: https://middlemanapp.com/basics/frontmatter
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: This is a child of expired page
3
+ parent: /expired-page.html
4
+ ---
5
+
6
+ # This is a child of expired page
7
+
8
+ Expired page should highlight in the navigation.
@@ -34,6 +34,8 @@ $desktop-breakpoint: 992px !default;
34
34
  @import "accessibility";
35
35
 
36
36
  html, body {
37
+ color: $text-colour;
38
+ background-color: $page-colour;
37
39
  margin: 0;
38
40
  -webkit-font-smoothing: antialiased;
39
41
  -moz-osx-font-smoothing: grayscale;
@@ -21,7 +21,12 @@ require 'govuk_tech_docs/unique_identifier_extension'
21
21
  require 'govuk_tech_docs/unique_identifier_generator'
22
22
 
23
23
  module GovukTechDocs
24
- def self.configure(context)
24
+ # Configure the tech docs template
25
+ #
26
+ # @param options [Hash]
27
+ # @option options [Hash] livereload Options to pass to the `livereload`
28
+ # extension. Hash with symbols as keys.
29
+ def self.configure(context, options = {})
25
30
  context.activate :autoprefixer
26
31
  context.activate :sprockets
27
32
  context.activate :syntax
@@ -39,7 +44,7 @@ module GovukTechDocs
39
44
 
40
45
  # Reload the browser automatically whenever files change
41
46
  context.configure :development do
42
- activate :livereload
47
+ activate :livereload, options[:livereload].to_h
43
48
  end
44
49
 
45
50
  context.configure :build do
@@ -65,6 +70,14 @@ module GovukTechDocs
65
70
  def format_date(date)
66
71
  date.strftime('%-e %B %Y')
67
72
  end
73
+
74
+ def active_page(page_path)
75
+ [
76
+ page_path == "/" && current_page.path == "index.html",
77
+ ("/" + current_page.path) == page_path,
78
+ current_page.data.parent != nil && current_page.data.parent.to_s == page_path,
79
+ ].any?
80
+ end
68
81
  end
69
82
 
70
83
  context.page '/*.xml', layout: false
@@ -53,7 +53,7 @@ module GovukTechDocs
53
53
  end
54
54
 
55
55
  def host
56
- config[:tech_docs][:host]
56
+ config[:tech_docs][:host].to_s
57
57
  end
58
58
 
59
59
  def locals
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
@@ -31,9 +31,9 @@
31
31
 
32
32
  <nav id="navigation" class="header__navigation js-nav" aria-label="Top Level Navigation" aria-hidden="true">
33
33
  <ul>
34
- <% config[:tech_docs][:header_links].each do |title, url| %>
35
- <li<% if url == current_page.url %> class="active"<% end %>>
36
- <a href="<%= url %>">
34
+ <% config[:tech_docs][:header_links].each do |title, path| %>
35
+ <li<% if active_page(path) %> class="active"<% end %>>
36
+ <a href="<%= path %>">
37
37
  <%= title %>
38
38
  </a>
39
39
  </li>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_tech_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-06 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -249,6 +249,7 @@ files:
249
249
  - ".ruby-version"
250
250
  - ".travis.yml"
251
251
  - CHANGELOG.md
252
+ - CONTRIBUTING.md
252
253
  - Gemfile
253
254
  - LICENSE
254
255
  - README.md
@@ -263,6 +264,7 @@ files:
263
264
  - example/Gemfile
264
265
  - example/config.rb
265
266
  - example/config/tech-docs.yml
267
+ - example/source/child-of-expired-page.html.md
266
268
  - example/source/core-layout.html.md.erb
267
269
  - example/source/expired-page-with-owner.html.md
268
270
  - example/source/expired-page.html.md