govuk_tech_docs 4.0.0 → 4.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4dc850d9644bdfb68d0604fb1a6b9710e677d10efcb3ad7107b4ac592924931d
4
- data.tar.gz: c6cf243d37b9e353ce4400dc2b9a5b521753ff3a56338fcb406f063205a01b55
3
+ metadata.gz: b899e5d1bbaa64b7a22b7438f61483a08db695b46a131584c62155d4b657fe71
4
+ data.tar.gz: 7151e7e22a7b3005d5134ea18b52bc884415922a0b86b383af628550fa9c641f
5
5
  SHA512:
6
- metadata.gz: 9b270f50021512617508ed2204b67b87a5b329baf833ea6c3446eee3918d889c1553c2854faf0fcf250183c1b75d59125c7f325497215a5fd3ebd4670b0acdc6
7
- data.tar.gz: 257a1b7a1d73f43ae716986ae98eea6bb8843eb06100a870691d6c3a0e7c26eecba849aef97d8b93c08a899724e8176384f0470b96c77b58b3c1bd8ff099cd2e
6
+ metadata.gz: 06ec23191e7de7bbf5587cd5aeaa2236b30735829a0dbf12cb9e784ab8397164d5e220d0e32e51f4c57dfe61f95214b2f0cd393c5cd18f53edb274236a7d9e01
7
+ data.tar.gz: 28c2edc113a32a82fa5aade7b7190c38ced2ea8610adb7d19fc9f72e0ef185b2cedd649a5bdd8a991085dba71309aeece7a5d5336fbf2d6001c9c3a9dd042476
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 4.1.0
4
+
5
+ - [Fix missing manifest.json from govuk-frontend](https://github.com/alphagov/tech-docs-gem/pull/376)
6
+ - [Stable soft for left navigation](https://github.com/alphagov/tech-docs-gem/pull/374)
7
+
3
8
  ## 4.0.0
4
9
 
5
10
  ### Breaking
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  files_in_git = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
26
 
27
27
  # Include assets from GOV.UK Frontend library in the distributed gem
28
- govuk_frontend_assets = Dir["node_modules/govuk-frontend/**/*.{scss,js,mjs,woff,woff2,png,svg,ico}"]
28
+ govuk_frontend_assets = Dir["node_modules/govuk-frontend/**/*.{scss,js,mjs,woff,woff2,png,svg,ico}", "node_modules/govuk-frontend/dist/govuk/assets/manifest.json"]
29
29
 
30
30
  spec.files = files_in_git + govuk_frontend_assets
31
31
 
@@ -18,12 +18,27 @@ module GovukTechDocs
18
18
  output
19
19
  end
20
20
 
21
+ # Items with a weight appear first, in weight order
22
+ # if items have equal weight, they stay in the order they appeared (stable sort)
23
+ # Items without a weight appear after, sorted stably in the order that they are
24
+ # present in the resource list
25
+ def sort_resources_stably(resources)
26
+ resources
27
+ .each.with_index
28
+ .sort_by { |r, index| [r.data.weight ? 0 : 1, r.data.weight || 0, index] }
29
+ .map(&:first)
30
+ .to_a
31
+ end
32
+
33
+ def select_top_level_html_files(resources)
34
+ resources
35
+ .select { |r| r.path.end_with?(".html") && (r.parent.nil? || r.parent.url == "/") }
36
+ end
37
+
21
38
  def multi_page_table_of_contents(resources, current_page, config, current_page_html = nil)
22
- # Only parse top level html files
23
- # Sorted by weight frontmatter
24
- resources = resources
25
- .select { |r| r.path.end_with?(".html") && (r.parent.nil? || r.parent.url == "/") }
26
- .sort_by { |r| [r.data.weight ? 0 : 1, r.data.weight || 0] }
39
+ resources = sort_resources_stably(
40
+ select_top_level_html_files(resources),
41
+ )
27
42
 
28
43
  render_page_tree(resources, current_page, config, current_page_html)
29
44
  end
@@ -40,9 +55,7 @@ module GovukTechDocs
40
55
  end
41
56
 
42
57
  def render_page_tree(resources, current_page, config, current_page_html)
43
- # Sort by weight frontmatter
44
- resources = resources
45
- .sort_by { |r| [r.data.weight ? 0 : 1, r.data.weight || 0] }
58
+ resources = sort_resources_stably(resources)
46
59
 
47
60
  output = "<ul>\n"
48
61
  resources.each do |resource|
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "4.0.0".freeze
2
+ VERSION = "4.1.0".freeze
3
3
  end
@@ -0,0 +1,39 @@
1
+ {
2
+ "icons": [
3
+ {
4
+ "src": "images/favicon.ico",
5
+ "type": "image/x-icon",
6
+ "sizes": "48x48"
7
+ },
8
+ {
9
+ "src": "images/favicon.svg",
10
+ "type": "image/svg+xml",
11
+ "sizes": "150x150",
12
+ "purpose": "any"
13
+ },
14
+ {
15
+ "src": "images/govuk-icon-180.png",
16
+ "type": "image/png",
17
+ "sizes": "180x180",
18
+ "purpose": "maskable"
19
+ },
20
+ {
21
+ "src": "images/govuk-icon-192.png",
22
+ "type": "image/png",
23
+ "sizes": "192x192",
24
+ "purpose": "maskable"
25
+ },
26
+ {
27
+ "src": "images/govuk-icon-512.png",
28
+ "type": "image/png",
29
+ "sizes": "512x512",
30
+ "purpose": "maskable"
31
+ },
32
+ {
33
+ "src": "images/govuk-icon-mask.svg",
34
+ "type": "image/svg+xml",
35
+ "sizes": "150x150",
36
+ "purpose": "monochrome"
37
+ }
38
+ ]
39
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_tech_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
@@ -509,6 +509,7 @@ files:
509
509
  - node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-512.png
510
510
  - node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-mask.svg
511
511
  - node_modules/govuk-frontend/dist/govuk/assets/images/govuk-opengraph-image.png
512
+ - node_modules/govuk-frontend/dist/govuk/assets/manifest.json
512
513
  - node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs
513
514
  - node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs
514
515
  - node_modules/govuk-frontend/dist/govuk/common/index.mjs