govuk_tech_docs 1.8.0 → 1.8.1

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: 8b9d4a186f0bd8cc5f21f4af532c4af40a8151ba
4
- data.tar.gz: 5ca815110a5ffe5dcf14e51a230d47745f2c14b2
3
+ metadata.gz: 3cf2bab991925ed0fabb60ab0476495ab90c800d
4
+ data.tar.gz: dc103fe59f818f8a4e8409428bd5c10c3868c885
5
5
  SHA512:
6
- metadata.gz: 8c055c974e0b83cb30347a310ce3eeaaf646b5ab421fb1f8572d5b7edc1bb26f6051c21943966cb287ce68ec5a03ab754c915516ec3f818b1f38bbfd5d3fb957
7
- data.tar.gz: c4a41a135993f461faddf1ef0f09513a0c7672f9e78213a0b34cc3ceec903fe47bb49b7572522041960b292fad553850c4f2d47528aa321691f50e953c58d4da
6
+ metadata.gz: f93a374fb0a35604b6832a3935a86f9dc9c4a1afc2663cd0ac5a20a7e5aa66cd7b10052c721a15c6eca1f956bad104b8de125f80a3f3b20368855ec0eac050e5
7
+ data.tar.gz: 970bfd4b026cce535b52bf7602fc9086e02e993875c99b11a37f2c94abd2f7fba82e0120f36965eaa3b757a93f07629fc16a4792c8a8b8895f165f399bc13ebe
data/.travis.yml CHANGED
@@ -1,11 +1,4 @@
1
1
  language: ruby
2
- rvm:
3
- - 2.4.2
4
- script:
5
- - bundle exec rake
6
- before_install:
7
- - rvm @global do gem uninstall bundler -a -x
8
- - rvm @global do gem install bundler -v 1.17.3
9
2
  deploy:
10
3
  provider: rubygems
11
4
  gem: govuk_tech_docs
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.1
4
+
5
+ This release fixes a bug (#79 - reported in
6
+ [alphagov/tech-docs-template#183][tdt-183]) which prevented a multipage site
7
+ from being generated when a custom `http_prefix` was configured.
8
+
9
+ [tdt-183]: https://github.com/alphagov/tech-docs-template/issues/183
10
+
3
11
  ## 1.8.0
4
12
 
5
13
  🎉 Our first contributor from outside of GDS. Thanks [@timja](https://github.com/timja) from [HMCTS](https://hmcts.github.io)! 🤝
data/CONTRIBUTING.md CHANGED
@@ -4,6 +4,6 @@ Everybody who uses this project is encouraged to contribute to this project. If
4
4
 
5
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
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)
7
+ - If you add a new option to the page frontmatter, make sure you [document the option in docs/frontmatter.md](docs/frontmatter.md)
8
8
  - You can test your contribution using [unit tests](spec/govuk_tech_docs), [javascript tests](spec/javascripts) or [integration tests](spec/features)
9
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.
File without changes
data/README.md CHANGED
@@ -1,50 +1,69 @@
1
1
  # Tech Docs Template - gem
2
2
 
3
- This repo is part of the GOV.UK Tech docs project. This repo contains the Ruby
4
- gem that is used to distribute most of code that is used to generate the site.
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
+ you can use to build technical documentation using a GOV.UK style.
5
5
 
6
- 👉 [See alphagov.github.io/tech-docs-manual](https://alphagov.github.io/tech-docs-manual)
6
+ 👉 Find out more about the template and its features from the [Tech Docs Template documentation][tdt-docs].
7
7
 
8
8
  ## Usage
9
9
 
10
- To [generate a new site with the template](https://alphagov.github.io/tech-docs-manual/#create-a-new-site), see the manual.
10
+ 👉 Find out how to [generate a new website with the Tech Docs Template][tdt-readme].
11
11
 
12
12
  ## Contributing
13
13
 
14
- 👉 [See CONTRIBUTING.md](CONTRIBUTING.md)
14
+ Everybody who uses this project is encouraged to contribute.
15
+
16
+ 👉 [See CONTRIBUTING.md](CONTRIBUTING.md) for guidance on making changes.
15
17
 
16
18
  ## Developing locally
17
19
 
18
- There are 2 ways to develop with this gem.
20
+ There are 2 ways to develop with this gem. You can see your changes on either:
21
+
22
+ - your own Tech Docs Template website
23
+ - the example in this repository
24
+
25
+ ### Use your own Tech Docs Template website
19
26
 
20
- The first is to point your site's Gemfile to your local checkout, and use it normally. This is good for if you want to see what effect your changes have to the actual site.
27
+ 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:
21
28
 
22
29
  ```rb
23
30
  gem 'govuk_tech_docs', path: '../tech-docs-gem'
24
31
  ```
25
32
 
26
- The second is to use the example app in this repo. You can start it by
33
+ To view your changes locally run:
27
34
 
35
+ ```sh
36
+ bundle exec middleman server
28
37
  ```
38
+
39
+ See your website on `http://localhost:4567` in your browser.
40
+
41
+ ### Use the example in this repo
42
+
43
+ To start the example in this repo, run:
44
+
45
+ ```sh
29
46
  cd example
30
47
  bundle install
31
- bundle exec middleman serve
48
+ bundle exec middleman server
32
49
  ```
33
50
 
34
- Your site will appear on <http://localhost:4567>.
51
+ See your website on `http://localhost:4567` in your browser.
35
52
 
36
53
  ## Tests
37
54
 
38
- We have some automated JavaScript tests that use [Jasmine][jas] as a test
39
- framework.
55
+ The repository contains automated JavaScript tests that use [Jasmine][jas] test framework.
56
+
57
+ To run the tests and see the results in your browser:
40
58
 
41
- To run the tests on your machine:
59
+ 1. Run `bundle exec rake jasmine`
60
+ 2. Go to `http://localhost:8888` in your browser
42
61
 
43
- - Run `bundle exec rake jasmine`
44
- - Navigate to `http://localhost:8888` in a browser of your choosing
45
- - Peruse the output of your tests
62
+ To run the tests and see the results in your terminal, run:
46
63
 
47
- Or, on the command line, run `bundle exec rake jasmine:ci`.
64
+ ```
65
+ bundle exec rake jasmine:ci
66
+ ```
48
67
 
49
68
  ## Releasing new versions
50
69
 
@@ -52,8 +71,19 @@ To release a new version, create a new Pull Request that updates [version.rb](li
52
71
 
53
72
  Travis will automatically release a [new version to Rubygems.org](https://rubygems.org/gems/govuk_tech_docs).
54
73
 
55
- ## License
74
+ ## Licence
75
+
76
+ Unless stated otherwise, the codebase is released under [the MIT License][mit].
77
+ This covers both the codebase and any sample code in the documentation.
78
+
79
+ The documentation is [© Crown copyright][copyright] and available under the terms of the [Open Government 3.0][ogl] licence.
56
80
 
57
- The gem is available as open source under the terms of the [MIT License](LICENSE).
81
+ [mit]: LICENCE
82
+ [copyright]: http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/
83
+ [ogl]: http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
84
+ [tdt-docs]: https://tdt-documentation.london.cloudapps.digital
85
+ [tdt-template]: https://github.com/alphagov/tech-docs-template
86
+ [tdt-readme]: https://github.com/alphagov/tech-docs-template/blob/master/README.md
87
+ [mmt]: https://middlemanapp.com/advanced/project_templates/
58
88
 
59
89
  [jas]: https://jasmine.github.io/
@@ -157,6 +157,18 @@ show_contribution_banner: true
157
157
  github_repo: alphagov/example-repo
158
158
  ```
159
159
 
160
+ ## `source_urls`
161
+
162
+ Customise the URLs that the contribution banner links to. Only useful if
163
+ [show_contribution_banner](#show_contribution_banner) is turned on. By default, "Report issue" links
164
+ to raising a GitHub issue but by modifying the `report_issue_url` it can link to an email address
165
+ or another page.
166
+
167
+ ```yaml
168
+ source_urls:
169
+ report_issue_url: mailto:support@example.com
170
+ ```
171
+
160
172
  ## `show_govuk_logo`
161
173
 
162
174
  Whether to show the GOV.UK crown logo.
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "pry"
37
37
 
38
38
 
39
- spec.add_development_dependency "bundler", "~> 1.15"
39
+ spec.add_development_dependency "bundler", "~> 2.0.1"
40
40
  spec.add_development_dependency "rake", "~> 10.0"
41
41
  spec.add_development_dependency "capybara", "~> 2.18.0"
42
42
  spec.add_development_dependency "govuk-lint", "~> 3.7.0"
@@ -31,6 +31,7 @@ $desktop-breakpoint: 992px !default;
31
31
  @import "modules/contribution-banner";
32
32
  @import "modules/technical-documentation";
33
33
  @import "modules/toc";
34
+ @import "modules/warning-text";
34
35
  @import "modules/collapsible";
35
36
 
36
37
  @import "accessibility";
@@ -0,0 +1,73 @@
1
+ .govuk-warning-text {
2
+ font-family: nta,Arial,sans-serif;
3
+ -webkit-font-smoothing: antialiased;
4
+ -moz-osx-font-smoothing: grayscale;
5
+ font-weight: 400;
6
+ font-size: 16px;
7
+ font-size: 1rem;
8
+ line-height: 1.25;
9
+ color: #0b0c0c;
10
+ position: relative;
11
+ margin-bottom: 20px;
12
+ padding: 10px 0; }
13
+
14
+ @media print {
15
+ .govuk-warning-text {
16
+ font-family: sans-serif; } }
17
+ @media (min-width: 40.0625em) {
18
+ .govuk-warning-text {
19
+ font-size: 19px;
20
+ font-size: 1.1875rem;
21
+ line-height: 1.31579; } }
22
+ @media print {
23
+ .govuk-warning-text {
24
+ font-size: 14pt;
25
+ line-height: 1.15;
26
+ color: #000; } }
27
+ @media (min-width: 40.0625em) {
28
+ .govuk-warning-text {
29
+ margin-bottom: 30px; } }
30
+ .govuk-warning-text__assistive {
31
+ position: absolute !important;
32
+ width: 1px !important;
33
+ height: 1px !important;
34
+ margin: 0 !important;
35
+ padding: 0 !important;
36
+ overflow: hidden !important;
37
+ clip: rect(0 0 0 0) !important;
38
+ -webkit-clip-path: inset(50%) !important;
39
+ clip-path: inset(50%) !important;
40
+ border: 0 !important;
41
+ white-space: nowrap !important; }
42
+
43
+ .govuk-warning-text__icon {
44
+ font-family: nta,Arial,sans-serif;
45
+ -webkit-font-smoothing: antialiased;
46
+ -moz-osx-font-smoothing: grayscale;
47
+ font-weight: 700;
48
+ display: inline-block;
49
+ position: absolute;
50
+ top: 50%;
51
+ left: 0;
52
+ min-width: 32px;
53
+ min-height: 29px;
54
+ margin-top: -20px;
55
+ padding-top: 3px;
56
+ border: 3px solid #0b0c0c;
57
+ border-radius: 50%;
58
+ color: #fff;
59
+ background: #0b0c0c;
60
+ font-size: 1.6em;
61
+ line-height: 29px;
62
+ text-align: center;
63
+ -webkit-user-select: none;
64
+ -moz-user-select: none;
65
+ -ms-user-select: none;
66
+ user-select: none; }
67
+
68
+ @media print {
69
+ .govuk-warning-text__icon {
70
+ font-family: sans-serif; } }
71
+ .govuk-warning-text__text {
72
+ display: block;
73
+ padding-left: 50px; }
@@ -20,6 +20,7 @@ require 'govuk_tech_docs/pages'
20
20
  require 'govuk_tech_docs/tech_docs_html_renderer'
21
21
  require 'govuk_tech_docs/unique_identifier_extension'
22
22
  require 'govuk_tech_docs/unique_identifier_generator'
23
+ require 'govuk_tech_docs/warning_text_extension'
23
24
  require 'govuk_tech_docs/api_reference/api_reference_extension'
24
25
 
25
26
  module GovukTechDocs
@@ -58,7 +59,7 @@ module GovukTechDocs
58
59
 
59
60
  context.config[:tech_docs] = YAML.load_file('config/tech-docs.yml').with_indifferent_access
60
61
  context.activate :unique_identifier
61
-
62
+ context.activate :warning_text
62
63
  context.activate :api_reference
63
64
 
64
65
  context.helpers do
@@ -19,7 +19,13 @@ module GovukTechDocs
19
19
  end
20
20
 
21
21
  def report_issue_url
22
- "#{repo_url}/issues/new?labels=bug&title=Re: '#{current_page.data.title}'&body=Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})"
22
+ url = config[:source_urls]&.[](:report_issue_url)
23
+
24
+ if url.nil?
25
+ "#{repo_url}/issues/new?labels=bug&title=Re: '#{current_page.data.title}'&body=Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})"
26
+ else
27
+ "#{url}?subject=Re: '#{current_page.data.title}'&body=Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})"
28
+ end
23
29
  end
24
30
 
25
31
  def repo_url
@@ -45,11 +45,21 @@ module GovukTechDocs
45
45
  # Avoid redirect pages
46
46
  next if content.include? "http-equiv=refresh"
47
47
  # If this page has children, just print the title and recursively
48
- # render the children.
49
- # If not, print the heading structure.
48
+ # render the children. If not, print the heading structure.
49
+
50
50
  # We avoid printing the children of the root index.html as it is the
51
- # parent of every other top level file.
52
- if resource.children.any? && resource.url != "/"
51
+ # parent of every other top level file. We need to take any custom
52
+ # prefix in to consideration when checking for the root index.html.
53
+ # The prefix may be set with or without a trailing slash: make sure
54
+ # it has one for this comparison check.
55
+ home_url =
56
+ if config[:http_prefix].end_with?("/")
57
+ config[:http_prefix]
58
+ else
59
+ config[:http_prefix] + "/"
60
+ end
61
+
62
+ if resource.children.any? && resource.url != home_url
53
63
  output += %{<ul><li><a href="#{resource.url}">#{resource.data.title}</a>\n}
54
64
  output += render_page_tree(resource.children, current_page, config, current_page_html)
55
65
  output += '</li></ul>'
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "1.8.0".freeze
2
+ VERSION = "1.8.1".freeze
3
3
  end
@@ -0,0 +1,23 @@
1
+ module GovukTechDocs
2
+ class WarningTextExtension < Middleman::Extension
3
+ def initialize(app, options_hash = {}, &block)
4
+ super
5
+ end
6
+
7
+ helpers do
8
+ def warning_text(text)
9
+ <<~EOS
10
+ <div class="govuk-warning-text">
11
+ <span class="govuk-warning-text__icon" aria-hidden="true">!</span>
12
+ <strong class="govuk-warning-text__text">
13
+ <span class="govuk-warning-text__assistive">Warning</span>
14
+ #{text}
15
+ </strong>
16
+ </div>
17
+ EOS
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ ::Middleman::Extensions.register(:warning_text, GovukTechDocs::WarningTextExtension)
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.8.0
4
+ version: 1.8.1
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: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '1.15'
201
+ version: 2.0.1
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '1.15'
208
+ version: 2.0.1
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: rake
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -307,7 +307,7 @@ files:
307
307
  - CHANGELOG.md
308
308
  - CONTRIBUTING.md
309
309
  - Gemfile
310
- - LICENSE
310
+ - LICENCE
311
311
  - README.md
312
312
  - Rakefile
313
313
  - docs/configuration.md
@@ -390,6 +390,7 @@ files:
390
390
  - lib/assets/stylesheets/modules/_skip-link.scss
391
391
  - lib/assets/stylesheets/modules/_technical-documentation.scss
392
392
  - lib/assets/stylesheets/modules/_toc.scss
393
+ - lib/assets/stylesheets/modules/_warning-text.scss
393
394
  - lib/assets/stylesheets/palette/_syntax-highlighting.scss
394
395
  - lib/assets/stylesheets/utilities/_fonts.scss
395
396
  - lib/assets/stylesheets/utilities/_printable.scss
@@ -418,6 +419,7 @@ files:
418
419
  - lib/govuk_tech_docs/unique_identifier_extension.rb
419
420
  - lib/govuk_tech_docs/unique_identifier_generator.rb
420
421
  - lib/govuk_tech_docs/version.rb
422
+ - lib/govuk_tech_docs/warning_text_extension.rb
421
423
  - lib/source/api/pages.json.erb
422
424
  - lib/source/favicon.ico
423
425
  - lib/source/images/anchored-heading-icon-2x.png