govuk_tech_docs 4.0.0 → 4.1.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b899e5d1bbaa64b7a22b7438f61483a08db695b46a131584c62155d4b657fe71
|
4
|
+
data.tar.gz: 7151e7e22a7b3005d5134ea18b52bc884415922a0b86b383af628550fa9c641f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06ec23191e7de7bbf5587cd5aeaa2236b30735829a0dbf12cb9e784ab8397164d5e220d0e32e51f4c57dfe61f95214b2f0cd393c5cd18f53edb274236a7d9e01
|
7
|
+
data.tar.gz: 28c2edc113a32a82fa5aade7b7190c38ced2ea8610adb7d19fc9f72e0ef185b2cedd649a5bdd8a991085dba71309aeece7a5d5336fbf2d6001c9c3a9dd042476
|
data/CHANGELOG.md
CHANGED
data/govuk_tech_docs.gemspec
CHANGED
@@ -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
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
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|
|
@@ -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.
|
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
|