govuk_tech_docs 6.0.1 → 6.2.0

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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug.yaml +69 -0
  3. data/.github/ISSUE_TEMPLATE/config.yaml +6 -0
  4. data/.github/ISSUE_TEMPLATE/enhancement.yaml +25 -0
  5. data/.github/pull_request_template.md +22 -8
  6. data/.github/workflows/dependency-review.yaml +17 -0
  7. data/.github/workflows/test.yaml +1 -1
  8. data/.nvmrc +1 -1
  9. data/.ruby-version +1 -1
  10. data/CHANGELOG.md +18 -2
  11. data/README.md +3 -2
  12. data/example/.ruby-version +1 -1
  13. data/example/config/tech-docs.yml +4 -0
  14. data/example/config.rb +15 -0
  15. data/example/source/active-pages/index.html.md.erb +7 -0
  16. data/example/source/active-pages/sub-section/index.html.md.erb +7 -0
  17. data/example/source/index.html.md.erb +6 -1
  18. data/govuk_tech_docs.gemspec +21 -19
  19. data/lib/govuk_tech_docs/custom_method_missing_handler.rb +30 -0
  20. data/lib/govuk_tech_docs/govuk_nunjuck_componenet_renderer.rb +43 -0
  21. data/lib/govuk_tech_docs/version.rb +1 -1
  22. data/lib/govuk_tech_docs.rb +35 -5
  23. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +1 -1
  24. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +1 -1
  25. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  26. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_accordion.scss +4 -1
  27. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +3 -1
  28. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_back-link.scss +4 -1
  29. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +7 -3
  30. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_breadcrumbs.scss +4 -1
  31. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +8 -4
  32. data/node_modules/govuk-frontend/dist/govuk/components/button/_button.scss +4 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +3 -1
  34. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_character-count.scss +4 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -0
  36. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_checkboxes.scss +4 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +10 -6
  38. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_cookie-banner.scss +4 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -0
  40. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_date-input.scss +4 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -0
  42. data/node_modules/govuk-frontend/dist/govuk/components/details/_details.scss +4 -1
  43. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +3 -1
  44. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_error-message.scss +4 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +2 -0
  46. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_error-summary.scss +4 -1
  47. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +3 -1
  48. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_exit-this-page.scss +4 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +3 -1
  50. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_fieldset.scss +4 -1
  51. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -1
  52. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_file-upload.scss +4 -1
  53. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +4 -1
  54. data/node_modules/govuk-frontend/dist/govuk/components/footer/_footer.scss +4 -1
  55. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +2 -0
  56. data/node_modules/govuk-frontend/dist/govuk/components/header/_header.scss +4 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +2 -0
  58. data/node_modules/govuk-frontend/dist/govuk/components/hint/_hint.scss +4 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +2 -0
  60. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +2 -0
  61. data/node_modules/govuk-frontend/dist/govuk/components/input/_input.scss +4 -1
  62. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +5 -1
  63. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_inset-text.scss +4 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/label/_index.scss +3 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/label/_label.scss +4 -1
  66. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +6 -2
  67. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_notification-banner.scss +4 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +2 -0
  69. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_pagination.scss +4 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +3 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/panel/_panel.scss +4 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_password-input.scss +4 -1
  74. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +3 -1
  75. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_phase-banner.scss +4 -1
  76. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +14 -10
  77. data/node_modules/govuk-frontend/dist/govuk/components/radios/_radios.scss +4 -1
  78. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +2 -0
  79. data/node_modules/govuk-frontend/dist/govuk/components/select/_select.scss +4 -1
  80. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +5 -1
  81. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -1
  82. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -3
  83. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_skip-link.scss +4 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +15 -2
  85. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_summary-list.scss +4 -1
  86. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +4 -1
  87. data/node_modules/govuk-frontend/dist/govuk/components/table/_table.scss +4 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +5 -2
  89. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_tabs.scss +4 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +4 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/tag/_tag.scss +4 -1
  92. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +6 -2
  93. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_task-list.scss +4 -1
  94. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +2 -0
  95. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_textarea.scss +4 -1
  96. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +3 -1
  97. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_warning-text.scss +4 -1
  98. data/node_modules/govuk-frontend/dist/govuk/core/_global-styles.scss +4 -0
  99. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +4 -0
  100. data/node_modules/govuk-frontend/dist/govuk/core/_links.scss +8 -0
  101. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +10 -1
  102. data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +5 -0
  103. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +14 -13
  104. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +1 -1
  105. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +5 -0
  106. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +38 -70
  108. data/node_modules/govuk-frontend/dist/govuk/helpers/_device-pixels.scss +2 -0
  109. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +1 -1
  110. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +3 -2
  111. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +4 -4
  112. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +17 -15
  113. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +2 -2
  114. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +19 -13
  115. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +48 -26
  116. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +13 -11
  117. data/node_modules/govuk-frontend/dist/govuk/objects/_grid.scss +4 -2
  118. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +10 -9
  119. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +2 -0
  120. data/node_modules/govuk-frontend/dist/govuk/overrides/_index.scss +3 -0
  121. data/node_modules/govuk-frontend/dist/govuk/overrides/_spacing.scss +5 -1
  122. data/node_modules/govuk-frontend/dist/govuk/overrides/_text-align.scss +2 -0
  123. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +7 -2
  124. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +3 -0
  125. data/node_modules/govuk-frontend/dist/govuk/settings/_assets.scss +18 -0
  126. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +28 -4
  127. data/node_modules/govuk-frontend/dist/govuk/settings/_links.scss +3 -2
  128. data/node_modules/govuk-frontend/dist/govuk/settings/_measurements.scss +8 -16
  129. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-font.scss +4 -1
  130. data/node_modules/govuk-frontend/dist/govuk/settings/_warnings.scss +15 -2
  131. data/node_modules/govuk-frontend/dist/govuk/tools/_exports.scss +3 -2
  132. data/node_modules/govuk-frontend/dist/govuk/tools/_font-url.scss +13 -5
  133. data/node_modules/govuk-frontend/dist/govuk/tools/_if.scss +24 -0
  134. data/node_modules/govuk-frontend/dist/govuk/tools/_image-url.scss +13 -5
  135. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  136. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +5 -3
  137. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +4 -2
  138. data/node_modules/govuk-frontend/dist/govuk/utilities/_clearfix.scss +3 -0
  139. data/node_modules/govuk-frontend/dist/govuk/utilities/_index.scss +1 -0
  140. data/node_modules/govuk-frontend/dist/govuk/utilities/_visually-hidden.scss +3 -0
  141. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +3 -1
  142. data/package-lock.json +1302 -4959
  143. data/package.json +5 -4
  144. metadata +74 -80
  145. data/.github/ISSUE_TEMPLATE.md +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e490b72c74aec01a8e39fa25446e74c7b85cdb81b8e95902d823fc6619ffeabe
4
- data.tar.gz: a0a7fee77936966f916c0c6351a5614bdf33e6086ee1a0eeab19dca60deb518b
3
+ metadata.gz: 5b63d996648a19346b3271b19f10e30b6e81338617ee36fe348ec7060ecc7635
4
+ data.tar.gz: 790a7e766bf65ab9ab5a7b45dbff30bfa85d03761275938f8517808869cb940c
5
5
  SHA512:
6
- metadata.gz: 5df8899a2930b154ed270903e47523eb1c4246c074bab40681872d89ecbff9e0ce6510817547d4a3b1120a68510fe29ae9d6a399835706fd6ab3420c3a20c326
7
- data.tar.gz: e7bb22be432a4f76a8fa265d09a62747d5ad4be4fae6d85638f2085e96e10665aa311b708a644e2923eda2afdcc1f31f852d538372083d574a2477d88c2b87dc
6
+ metadata.gz: 31c6547961ed29eb9e56b4c2f761257900d18429e4fd7c73fa151a7fc21e7751c78a8d1c9ccf5c57a4d8f13e6f471384e8900307179b9f82115491f4349d3275
7
+ data.tar.gz: c0f8a093d245c3ba9ea5c9933eb4eb5f38d1a90fbc4a7dd74ef6b83531b2b3b51d773d7457ad760ab3f214a9b38b1734be839f73709a29decc33ed2a53da2083
@@ -0,0 +1,69 @@
1
+ name: 🐛 Bug report
2
+ description: Something is broken or not working as expected
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for reporting a bug in `tech-docs-gem`
10
+ Please include as much detail as you can. This will help us prioritise this issue correctly.
11
+
12
+ - type: textarea
13
+ id: tech-docs-gem-version
14
+ attributes:
15
+ label: tech-docs-gem version
16
+ description: Which version of the tech docs gem are you using
17
+ validations:
18
+ required: true
19
+
20
+ - type: textarea
21
+ id: ruby-version
22
+ attributes:
23
+ label: ruby version
24
+ description: Which version of the ruby are you using (if known)
25
+ validations:
26
+ required: false
27
+
28
+ - type: textarea
29
+ id: description
30
+ attributes:
31
+ label: What happened?
32
+ description: Describe the problem and what you expected to happen.
33
+ validations:
34
+ required: true
35
+
36
+ - type: textarea
37
+ id: reproduction
38
+ attributes:
39
+ label: Steps to reproduce
40
+ description: |
41
+ Tell us how to reproduce the issue.
42
+ Example:
43
+ 1. Run `bundle exec middleman serve`
44
+ 2. Visit `/guides/setup`
45
+ 3. See white screen of death
46
+ placeholder: Step-by-step instructions
47
+ validations:
48
+ required: true
49
+
50
+
51
+ - type: textarea
52
+ id: logs
53
+ attributes:
54
+ label: Logs or error output
55
+ description: Any error messages or logs if available
56
+ validations:
57
+ required: false
58
+
59
+ - type: checkboxes
60
+ id: checks
61
+ attributes:
62
+ label: Checks
63
+ options:
64
+ - label: I have searched for existing issues
65
+ required: true
66
+ - label: I have checked other users also have this issue
67
+ required: true
68
+ - label: I have checked that I am not using a local or forked repository with untested changes
69
+ required: true
@@ -0,0 +1,6 @@
1
+
2
+ blank_issues_enabled: false
3
+ contact_links:
4
+ - name: Ask a question or get help
5
+ url: https://ukgovernmentdigital.slack.com/archives/C1ZM2T0SG
6
+ about: Uk Government digital slack channel for Technical Writers
@@ -0,0 +1,25 @@
1
+ name: ✨ New or updated feature
2
+ description: Suggest a new feature or improvement
3
+ title: "[Enhancement]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: textarea
7
+ id: problem
8
+ attributes:
9
+ label: What should change?
10
+ description: What would fix the issue? Is this something you think should behave differently, or something that you currently cannot do?
11
+ validations:
12
+ required: true
13
+
14
+ - type: textarea
15
+ id: user-need
16
+ attributes:
17
+ label: User need
18
+ description: Do you have evidence that the change will meet the needs of users? Let us know about any user research or testing you’ve done
19
+
20
+ - type: textarea
21
+ id: proposal
22
+ attributes:
23
+ label: Proposed solution
24
+ description: Optional — describe how you think this could work or a solution you have in mind
25
+
@@ -1,14 +1,28 @@
1
- <!--
2
- ## Please fill in the sections below
1
+ ## Proposed changes
3
2
 
4
- After you submit your pull request, the technical writing team from the Central Digital and Data Office (CDDO) will discuss and prioritise it at our fortnightly triage meeting. We’ll then let you know if and when we’ll move it forward.
5
- -->
3
+ ### What changed
6
4
 
7
- ## What’s changed
5
+ Describe the changes made and the impact the changes have.
8
6
 
9
- <!-- What are you trying to do? Is this something that changes how the Tech Docs Template behaves, or is it fixing a bug? -->
7
+ ## Related issue or tracking reference
10
8
 
9
+ You should have an open GitHub issue that this PR will fix.
11
10
 
12
- ## Identifying a user need
11
+ - Fixes #
12
+ - Relates to #
13
13
 
14
- <!-- Do you have evidence that this meets the needs of users? Let us know about any user research or testing you’ve done. -->
14
+ > If there is no issue, please open one or please explain why one is not needed (for example small maintenance change, routine dependency update).
15
+
16
+ ## Screenshots or examples (if relevant)
17
+
18
+ Include screenshots, logs, or rendered output if this change affects layout or behaviour.
19
+
20
+ ## Checklist
21
+
22
+ Before you request approval you should confirm that:
23
+
24
+ - [ ] the pull request has a clear title with a short description about the update in the documentation
25
+ - [ ] GitHub actions all pass
26
+ - [ ] you have tested the changes with a fresh build against the latest version of the `tech-docs-gem`
27
+ - [ ] you have linked this PR to an issue (or explained why none exists)
28
+ - [ ] you have updated documentation if needed
@@ -0,0 +1,17 @@
1
+ name: 'Dependency Review'
2
+ on: [pull_request]
3
+
4
+ permissions:
5
+ contents: read
6
+
7
+ jobs:
8
+ dependency-review:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: 'Checkout Repository'
12
+ uses: actions/checkout@v6
13
+ - name: 'Dependency Review'
14
+ uses: actions/dependency-review-action@v4
15
+ with:
16
+ fail-on-severity: high
17
+ show-patched-versions: true
@@ -14,7 +14,7 @@ jobs:
14
14
 
15
15
  strategy:
16
16
  matrix:
17
- ruby: ['3.2', '3.3', '3.4', '4.0']
17
+ ruby: ['3.3', '3.4', '4.0']
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v6
data/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18
1
+ 22
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.6
1
+ 3.3.11
data/CHANGELOG.md CHANGED
@@ -1,8 +1,25 @@
1
+ ## 6.2.0
2
+
3
+ - Remove support for Ruby 3.2, by updating `required_ruby_version` to `>= 3.3.0`
4
+ - Unpin ruby gem versions
5
+ - Bump `.nvmrc` to use npm version 22
6
+ - Updates `package.json` and `package-lock.json` to patch security vulnerabilities
7
+
8
+ ## 6.1.0
9
+
10
+ - [Add custom extensions to render GOV.UK Design System nunjucks components](https://github.com/alphagov/tech-docs-gem/pull/443/changes)
11
+ - [Fix inconsistent active tab behaviour](https://github.com/alphagov/tech-docs-gem/pull/452)
12
+
1
13
  ## 6.0.1
2
14
 
3
15
  - Update version of `openapi3_parser` allowing support for Ruby 4.0.
4
16
 
5
- ## 6.0.0
17
+ > Note:
18
+ > openapi3_parser ~> 0.10.1 has a delcares a depndancy on commonmarker >= 1.0
19
+ > commonmarker >= 1.0 declares required_ruby_version >= 3.3.22
20
+ > If you are using an older ruby verion this may cause issues in your environment. We recommend upgrading to a version >= 3.
21
+
22
+ ## 6.0.0.beta
6
23
 
7
24
  - [Bump Design System to V6](https://github.com/alphagov/tech-docs-gem/pull/442), which brings in:
8
25
  - changes to the colour palette
@@ -20,7 +37,6 @@ ability, we're marking it as a major bump.
20
37
  - [Bump jasmine-core from 5.5.0 to 5.13.0 #448](https://github.com/alphagov/tech-docs-gem/pull/448)
21
38
  - [Ban pre|post-install NPM scripts #453](https://github.com/alphagov/tech-docs-gem/pull/453)
22
39
 
23
-
24
40
  ## 5.2.1
25
41
 
26
42
  - [Add option to not render child resources when creating a table of contents](https://github.com/alphagov/tech-docs-gem/pull/439/changes)
data/README.md CHANGED
@@ -15,6 +15,8 @@ Find out how to [contribute](https://tdt-documentation.london.cloudapps.digital/
15
15
 
16
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/).
17
17
 
18
+ This gem can also use [GOV.UK Design System nunjucks components](https://design-system.service.gov.uk/components/). It is recommended that you use these as they are user researched and accessibility tested. An example using the `govukButton` component is available in the [example site in this gem](./example/source/index.html.md.erb).
19
+
18
20
  We use `npm` to download the govuk-frontend package. To update to a new version, change the version in the [package.json file](package.json) and run `npm update`.
19
21
 
20
22
  ## Table of contents helper functions
@@ -158,9 +160,8 @@ The documentation is [© Crown copyright][copyright] and available under the ter
158
160
  [mit]: LICENCE
159
161
  [copyright]: http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/
160
162
  [ogl]: http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
161
- [tdt-docs]: https://tdt-documentation.london.cloudapps.digital
163
+ [tdt-docs]: https://github.com/alphagov/tdt-documentation/
162
164
  [tdt-template]: https://github.com/alphagov/tech-docs-template
163
- [tdt-readme]: https://github.com/alphagov/tech-docs-template/blob/main/README.md
164
165
  [mmt]: https://middlemanapp.com/advanced/project_templates/
165
166
 
166
167
  [jas]: https://jasmine.github.io/
@@ -1 +1 @@
1
- 3.3.0
1
+ 3.2.6
@@ -1,6 +1,9 @@
1
1
  # Host to use for canonical URL generation (without trailing slash)
2
2
  host: https://docs.example.com
3
3
 
4
+ # Enable GOV.UK Design System nunjucks components (https://design-system.service.gov.uk/components)
5
+ enable_govuk_components: true
6
+
4
7
  # Header-related options
5
8
  show_govuk_logo: true
6
9
  service_name: My First Service
@@ -14,6 +17,7 @@ header_links:
14
17
  Expired with owner: /expired-page-with-owner.html
15
18
  Not expired page: /not-expired-page.html
16
19
  Single page nav: /single-page-nav.html
20
+ Active pages: /active-pages/
17
21
 
18
22
  footer_links:
19
23
  Accessibility: /hidden-page.html
data/example/config.rb CHANGED
@@ -7,3 +7,18 @@ ignore "templates/*"
7
7
  proxy "/a-proxied-page.html", "templates/proxy_template.html", locals: {
8
8
  title: "I am a title",
9
9
  }
10
+
11
+ gem_root = File.expand_path("..", __dir__)
12
+ files.watch :reload, path: File.join(gem_root, "lib")
13
+
14
+ configure :development do
15
+ ready do
16
+ files.on_change :reload do |changed|
17
+ changed.each do |file|
18
+ next unless file.full_path.extname == ".rb"
19
+
20
+ load file.full_path.to_s
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: Active page section root
3
+ ---
4
+
5
+ # This is a section landing page, under the "Active pages" navigation link.
6
+
7
+ The "Active pages" navigation link should be active.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: Active page sub section root
3
+ ---
4
+
5
+ # This is a section sub section, under the "Active pages" navigation link.
6
+
7
+ The "Active pages" navigation link should STILL BE active.
@@ -18,5 +18,10 @@ To change the title of the page or include additional files you'll need to edit
18
18
  If you want slightly more control, you can always use <strong>HTML</strong>.
19
19
 
20
20
  For more detail and troubleshooting, take a look at the `README.md` file in the root of this project.
21
+ <% if config[:tech_docs][:enable_govuk_components] %>
21
22
 
22
- <%= warning_text "Look out! A warning!" %>
23
+ <%= govukButton({
24
+ text: "Click me!"
25
+ }) %>
26
+
27
+ <% end %>
@@ -33,34 +33,36 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
34
  spec.require_paths = %w[lib]
35
35
 
36
- spec.required_ruby_version = ">= 3.1.0"
36
+ spec.required_ruby_version = ">= 3.3.0"
37
37
 
38
- spec.add_dependency "autoprefixer-rails", "~> 10.2"
39
- spec.add_dependency "base64" # TODO: remove once middleman-sprockets declares this itself.
40
- spec.add_dependency "bigdecimal" # TODO: remove once activesupport declares this itself.
41
- spec.add_dependency "chronic", "~> 0.10.2"
42
- spec.add_dependency "concurrent-ruby", "1.3.4" # 1.3.5 introduced a change that breaks activesupport, and so middleman
38
+ spec.add_dependency "autoprefixer-rails"
39
+ spec.add_dependency "chronic"
40
+ spec.add_dependency "concurrent-ruby"
43
41
  spec.add_dependency "csv" # TODO: remove once tilt declares this itself.
44
- spec.add_dependency "haml", "~> 6.0"
45
- spec.add_dependency "middleman", "~> 4.6.1"
46
- spec.add_dependency "middleman-autoprefixer", "~> 2.10"
47
- spec.add_dependency "middleman-compass", "~> 4.0"
42
+ spec.add_dependency "haml", "~> 6.0" # middleman-core (4.6.3) depends on haml (>= 4.0.5, < 7)
43
+ spec.add_dependency "middleman"
44
+ spec.add_dependency "middleman-autoprefixer"
45
+ spec.add_dependency "middleman-compass"
48
46
  spec.add_dependency "middleman-livereload"
49
47
  spec.add_dependency "middleman-search-gds"
50
- spec.add_dependency "middleman-sprockets", "~> 4.0.0"
51
- spec.add_dependency "middleman-syntax", "~> 3.6"
48
+ =begin
49
+ middleman-sprockets is very old and out of date. V4.1.0 has a breaking change. Will look to replace with gem "dartsass-sprockets" or uses sass in the package.json
50
+ =end
51
+ spec.add_dependency "middleman-sprockets", "4.0.0"
52
+ spec.add_dependency "middleman-syntax"
52
53
  spec.add_dependency "mutex_m" # TODO: remove once activesupport declares this itself.
53
54
  spec.add_dependency "nokogiri"
54
- spec.add_dependency "openapi3_parser", "~> 0.10.1"
55
- spec.add_dependency "redcarpet", "~> 3.6"
56
- spec.add_dependency "sassc-embedded", "~> 1.78.0"
55
+ spec.add_dependency "openapi3_parser"
56
+ spec.add_dependency "redcarpet"
57
+ spec.add_dependency "sassc-embedded"
58
+ spec.add_dependency "schmooze", "~> 0.2.0"
57
59
  spec.add_dependency "terser", "~> 1.2.3"
58
60
 
59
61
  spec.add_development_dependency "benchmark"
60
62
  spec.add_development_dependency "byebug"
61
- spec.add_development_dependency "capybara", "~> 3.32"
63
+ spec.add_development_dependency "capybara"
62
64
  spec.add_development_dependency "ostruct"
63
- spec.add_development_dependency "rake", "~> 13.0"
64
- spec.add_development_dependency "rspec", "~> 3.9"
65
- spec.add_development_dependency "rubocop-govuk", "~> 4.10"
65
+ spec.add_development_dependency "rake"
66
+ spec.add_development_dependency "rspec"
67
+ spec.add_development_dependency "rubocop-govuk"
66
68
  end
@@ -0,0 +1,30 @@
1
+ require "middleman-core"
2
+
3
+ module GovukTechDocs
4
+ class CustomMethodMissingHandler < Middleman::Extension
5
+ def initialize(app, options_hash = {}, &block)
6
+ super
7
+ end
8
+
9
+ helpers do
10
+ def method_missing(method_name, *args, &block)
11
+ if method_name.to_s.start_with?("govuk")
12
+ begin
13
+ data = args.first || {}
14
+ @renderer ||= GovukTechDocs::GovukNunjuckComponenetRenderer.new(File.expand_path("../../", __dir__))
15
+ @renderer.render_govuk_component(method_name, data).html_safe
16
+ rescue StandardError => e
17
+ raise e
18
+ end
19
+ else
20
+ super
21
+ end
22
+ end
23
+
24
+ def respond_to_missing?(method_name, include_private = false)
25
+ method_name.to_s.start_with?("govuk") || super
26
+ end
27
+ end
28
+ end
29
+ end
30
+ ::Middleman::Extensions.register(:custom_method_missing_handler, GovukTechDocs::CustomMethodMissingHandler)
@@ -0,0 +1,43 @@
1
+ require "schmooze"
2
+
3
+ module GovukTechDocs
4
+ class GovukNunjuckComponenetRenderer < Schmooze::Base
5
+ dependencies nunjucks: "nunjucks"
6
+
7
+ def initialize(gem_root)
8
+ super(gem_root) # Pass it up to Schmooze so it finds node_modules
9
+ @gem_root = gem_root
10
+ end
11
+
12
+ method :render_nunjucks_template, <<~JS
13
+ (templateString, templateData, searchPaths) => {
14
+ const env = nunjucks.configure(searchPaths, { autoescape: true });
15
+ return env.renderString(templateString, templateData);
16
+ }
17
+ JS
18
+
19
+ def get_component_template_name(component_name)
20
+ component_name.to_s.delete_prefix("govuk")
21
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1-\2') # Handle acronyms like "JSONData"
22
+ .gsub(/([a-z\d])([A-Z])/, '\1-\2') # Handle standard "CamelCase"
23
+ .downcase
24
+ end
25
+
26
+ def render_govuk_component(component_name, template_data)
27
+ # 1. Logic for search paths belongs here now
28
+
29
+ search_paths = [File.join(@gem_root, "node_modules/govuk-frontend/dist")]
30
+ component_template_name = get_component_template_name(component_name)
31
+ # 2. Call the JS method defined above
32
+ nunjucks_template_string = <<~NJK
33
+ {% from "govuk/components/#{component_template_name}/macro.njk" import #{component_name} %}
34
+ {{ #{component_name}(template_data) }}
35
+ NJK
36
+ render_nunjucks_template(nunjucks_template_string, { "template_data" => template_data }, search_paths)
37
+ # rubocop:disable Lint/UselessAssignment
38
+ rescue StandardError => e
39
+ raise "Could not load GOV.UK component #{component_name} with data #{template_data}."
40
+ end
41
+ # rubocop:enable Lint/UselessAssignment
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "6.0.1".freeze
2
+ VERSION = "6.2.0".freeze
3
3
  end
@@ -24,6 +24,8 @@ require "govuk_tech_docs/unique_identifier_extension"
24
24
  require "govuk_tech_docs/unique_identifier_generator"
25
25
  require "govuk_tech_docs/warning_text_extension"
26
26
  require "govuk_tech_docs/api_reference/api_reference_extension"
27
+ require "govuk_tech_docs/custom_method_missing_handler"
28
+ require "govuk_tech_docs/govuk_nunjuck_componenet_renderer"
27
29
 
28
30
  module SassWarningSupressor
29
31
  def warn(message)
@@ -101,11 +103,35 @@ module GovukTechDocs
101
103
  end
102
104
 
103
105
  def active_page(page_path)
104
- [
105
- page_path == "/" && current_page.path == "index.html",
106
- "/#{current_page.path}" == page_path,
107
- !current_page.data.parent.nil? && current_page.data.parent.to_s == page_path,
108
- ].any?
106
+ # if we are on the homepage e.g Documentation: /
107
+ if page_path == "/" && current_page.url == "/"
108
+ return true
109
+ end
110
+
111
+ # if we are on a single page the header links point to e.g Expired page: /expired-page.html
112
+ if "/#{current_page.path}" == page_path
113
+ return true
114
+ end
115
+
116
+ # If the doc maintainer has set the parent data in the frontmatter for the current page,
117
+ # and it matches the value in the config e.g
118
+ # Expired page: /expired-page.html (config) and parent: /expired-page.html (child-of-expired-page.html)
119
+ if !current_page.data.parent.nil? && current_page.data.parent.to_s == page_path
120
+ return true
121
+ end
122
+
123
+ # If we have a nested directory structure that matches a navigation link e.g Active pages: /active-pages/
124
+ if current_page.url.start_with?(page_path)
125
+ # feels like a weird check, but stops false positive where "/" for root is also the start of "/active-pages"
126
+ if page_path == "/"
127
+ return current_page.url == "/"
128
+ end
129
+
130
+ # safe to return true, since we aren't in the situation above
131
+ return true
132
+ end
133
+ # no other reason to believe we're active
134
+ false
109
135
  end
110
136
  end
111
137
 
@@ -138,5 +164,9 @@ module GovukTechDocs
138
164
  else
139
165
  context.ignore "search/*"
140
166
  end
167
+
168
+ if context.config[:tech_docs][:enable_govuk_components]
169
+ context.activate :custom_method_missing_handler
170
+ end
141
171
  end
142
172
  end
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- const version = '6.0.0';
7
+ const version = '6.1.0';
8
8
 
9
9
  function getBreakpoint(name) {
10
10
  const property = `--govuk-breakpoint-${name}`;
@@ -1,4 +1,4 @@
1
- const version = '6.0.0';
1
+ const version = '6.1.0';
2
2
 
3
3
  function getBreakpoint(name) {
4
4
  const property = `--govuk-breakpoint-${name}`;
@@ -1,4 +1,4 @@
1
- const version = '6.0.0';
1
+ const version = '6.1.0';
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=govuk-frontend-version.mjs.map
@@ -1,4 +1,7 @@
1
- @import "../../base";
1
+ @import "../../settings/warnings";
2
+
3
+ @include _component-scss-file-warning("accordion");
4
+
2
5
  @import "./index";
3
6
 
4
7
  /*# sourceMappingURL=_accordion.scss.map */
@@ -1,3 +1,5 @@
1
+ @import "../../base";
2
+
1
3
  @include govuk-exports("govuk/component/accordion") {
2
4
  $govuk-accordion-base-colour: govuk-colour("black");
3
5
  $govuk-accordion-hover-colour: govuk-colour("black", $variant: "tint-95");
@@ -23,11 +25,11 @@
23
25
 
24
26
  .govuk-accordion__section-button {
25
27
  @include govuk-font($size: 24, $weight: bold);
26
- @include govuk-text-colour;
27
28
 
28
29
  display: block;
29
30
  margin-bottom: 0;
30
31
  padding-top: govuk-spacing(3);
32
+ color: govuk-functional-colour(text);
31
33
  }
32
34
 
33
35
  // Remove the bottom margin from the last item inside the content
@@ -1,4 +1,7 @@
1
- @import "../../base";
1
+ @import "../../settings/warnings";
2
+
3
+ @include _component-scss-file-warning("back-link");
4
+
2
5
  @import "./index";
3
6
 
4
7
  /*# sourceMappingURL=_back-link.scss.map */
@@ -1,3 +1,7 @@
1
+ @use "sass:string";
2
+
3
+ @import "../../base";
4
+
1
5
  @include govuk-exports("govuk/component/back-link") {
2
6
  // Component font-size on the Frontend (used for calculations)
3
7
  $font-size: 16;
@@ -49,12 +53,12 @@
49
53
  border-width: $chevron-border-min-width $chevron-border-min-width 0 0;
50
54
  border-color: $chevron-border-colour;
51
55
 
52
- @supports (border-width: unquote("max(0px)")) {
56
+ @supports (border-width: string.unquote("max(0px)")) {
53
57
  $border-width-eval: "max(#{$chevron-border-min-width}, #{$chevron-border-width})";
54
58
 
55
59
  // Ensure that the chevron never gets smaller than 16px
56
- border-width: unquote($border-width-eval) unquote($border-width-eval) 0 0;
57
- font-size: unquote("max(#{$font-size * 1px}, 1em)");
60
+ border-width: string.unquote($border-width-eval) string.unquote($border-width-eval) 0 0;
61
+ font-size: string.unquote("max(#{$font-size * 1px}, 1em)");
58
62
  }
59
63
  }
60
64
 
@@ -1,4 +1,7 @@
1
- @import "../../base";
1
+ @import "../../settings/warnings";
2
+
3
+ @include _component-scss-file-warning("breadcrumbs");
4
+
2
5
  @import "./index";
3
6
 
4
7
  /*# sourceMappingURL=_breadcrumbs.scss.map */
@@ -1,3 +1,7 @@
1
+ @use "sass:string";
2
+
3
+ @import "../../base";
4
+
1
5
  @include govuk-exports("govuk/component/breadcrumbs") {
2
6
  // Component font-size on the Frontend (used for calculations)
3
7
  $font-size: 16;
@@ -20,10 +24,10 @@
20
24
 
21
25
  .govuk-breadcrumbs {
22
26
  @include govuk-font($size: $font-size);
23
- @include govuk-text-colour;
24
27
 
25
28
  margin-top: govuk-spacing(3);
26
29
  margin-bottom: govuk-spacing(2);
30
+ color: govuk-functional-colour(text);
27
31
  }
28
32
 
29
33
  .govuk-breadcrumbs__list {
@@ -71,12 +75,12 @@
71
75
  border-width: $chevron-border-min-width $chevron-border-min-width 0 0;
72
76
  border-color: $chevron-border-colour;
73
77
 
74
- @supports (border-width: unquote("max(0px)")) {
78
+ @supports (border-width: string.unquote("max(0px)")) {
75
79
  $border-width-eval: "max(#{$chevron-border-min-width}, #{$chevron-border-width})";
76
80
 
77
81
  // Ensure that the chevron never gets smaller than 16px
78
- border-width: unquote($border-width-eval) unquote($border-width-eval) 0 0;
79
- font-size: unquote("max(#{$font-size * 1px}, 1em)");
82
+ border-width: string.unquote($border-width-eval) string.unquote($border-width-eval) 0 0;
83
+ font-size: string.unquote("max(#{$font-size * 1px}, 1em)");
80
84
  }
81
85
  }
82
86