govuk_tech_docs 2.4.2 → 3.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 +4 -4
- data/.github/ISSUE_TEMPLATE.md +13 -0
- data/.github/pull_request_template.md +14 -1
- data/.github/workflows/publish.yaml +76 -0
- data/.github/workflows/test.yaml +23 -0
- data/.nvmrc +1 -1
- data/CHANGELOG.md +39 -0
- data/README.md +15 -1
- data/lib/assets/javascripts/_modules/search.js +59 -66
- data/lib/assets/javascripts/_modules/table-of-contents.js +0 -1
- data/lib/assets/javascripts/_vendor/jquery.js +2 -5
- data/lib/assets/javascripts/_vendor/lodash.js +5 -3
- data/lib/assets/stylesheets/modules/_search.scss +51 -73
- data/lib/assets/stylesheets/modules/_technical-documentation.scss +0 -4
- data/lib/assets/stylesheets/modules/_toc.scss +0 -3
- data/lib/govuk_tech_docs/api_reference/api_reference_renderer.rb +10 -0
- data/lib/govuk_tech_docs/api_reference/templates/api_reference_full.html.erb +2 -2
- data/lib/govuk_tech_docs/api_reference/templates/operation.html.erb +1 -1
- data/lib/govuk_tech_docs/api_reference/templates/parameters.html.erb +1 -1
- data/lib/govuk_tech_docs/api_reference/templates/responses.html.erb +1 -1
- data/lib/govuk_tech_docs/api_reference/templates/schema.html.erb +2 -2
- data/lib/govuk_tech_docs/contribution_banner.rb +8 -2
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/govuk_tech_docs.rb +3 -1
- data/lib/source/layouts/_header.erb +3 -3
- data/lib/source/layouts/_search.erb +0 -7
- data/lib/source/layouts/core.erb +1 -1
- data/lib/source/search/index.html.erb +31 -0
- data/node_modules/govuk-frontend/govuk/all.js +272 -75
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +275 -98
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +169 -65
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +3 -4
- data/node_modules/govuk-frontend/govuk/components/button/button.js +2 -2
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +3 -3
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +14 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +8 -10
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +0 -2
- data/node_modules/govuk-frontend/govuk/components/details/_index.scss +2 -1
- data/node_modules/govuk-frontend/govuk/components/details/details.js +2 -2
- data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +1 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +2 -2
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +1 -0
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +6 -37
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +10 -4
- data/node_modules/govuk-frontend/govuk/components/header/header.js +4 -4
- data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +1 -3
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +499 -2
- data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +13 -1
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +14 -0
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +4 -4
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +13 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1108 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +15 -23
- data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +2 -2
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +2 -2
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +0 -5
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +1 -1
- data/node_modules/govuk-frontend/govuk/core/_all.scss +0 -1
- data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +0 -6
- data/node_modules/govuk-frontend/govuk/core/_links.scss +0 -6
- data/node_modules/govuk-frontend/govuk/core/_lists.scss +0 -6
- data/node_modules/govuk-frontend/govuk/core/_section-break.scss +0 -6
- data/node_modules/govuk-frontend/govuk/core/_typography.scss +0 -6
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +2 -2
- data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +22 -4
- data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +15 -30
- data/node_modules/govuk-frontend/govuk/{core → objects}/_template.scss +1 -5
- data/node_modules/govuk-frontend/govuk/overrides/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/overrides/_display.scss +0 -6
- data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +0 -6
- data/node_modules/govuk-frontend/govuk/overrides/_text-align.scss +14 -0
- data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +0 -6
- data/node_modules/govuk-frontend/govuk/overrides/_width.scss +0 -6
- data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +0 -10
- data/node_modules/govuk-frontend/govuk/tools/_all.scss +0 -1
- data/package-lock.json +6 -6
- data/package.json +1 -1
- metadata +13 -10
- data/.travis.yml +0 -19
- data/CONTRIBUTING.md +0 -12
- data/node_modules/govuk-frontend/govuk/tools/_iff.scss +0 -17
|
@@ -52,48 +52,44 @@ $input-size: 40px;
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
@include govuk-media-query($until: tablet) {
|
|
56
|
+
html.js.has-search-results-open:not(.toc-open) {
|
|
57
|
+
.toc {
|
|
58
|
+
display: block;
|
|
59
|
+
padding-bottom: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.toc__close {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.toc__list {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
}
|
|
71
|
+
|
|
65
72
|
.search-results {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
@include govuk-media-query(tablet) {
|
|
74
|
+
// Create basis for the search results caret (below)
|
|
75
|
+
position: relative;
|
|
76
|
+
|
|
77
|
+
@include govuk-font($size: 16);
|
|
78
|
+
padding-top: govuk-spacing(6);
|
|
69
79
|
}
|
|
70
|
-
}
|
|
71
80
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
right: 0;
|
|
77
|
-
bottom: 0;
|
|
78
|
-
z-index: 600;
|
|
79
|
-
overflow-x: scroll;
|
|
80
|
-
-webkit-overflow-scrolling: touch;
|
|
81
|
-
-ms-overflow-style: none;
|
|
82
|
-
@include govuk-media-query(tablet) {
|
|
83
|
-
padding: govuk-spacing(6);
|
|
84
|
-
top: 0;
|
|
85
|
-
// The width of the sidebar
|
|
86
|
-
left: 330px;
|
|
87
|
-
min-height: auto;
|
|
88
|
-
}
|
|
81
|
+
a {
|
|
82
|
+
@include govuk-link-common;
|
|
83
|
+
@include govuk-link-style-no-visited-state;
|
|
84
|
+
}
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
ul {
|
|
87
|
+
list-style: none;
|
|
88
|
+
padding: 0;
|
|
89
|
+
margin: 0;
|
|
94
90
|
}
|
|
91
|
+
}
|
|
95
92
|
.search-results__inner {
|
|
96
|
-
position: relative;
|
|
97
93
|
background: govuk-colour("white");
|
|
98
94
|
border-top: 1px solid govuk-colour("mid-grey");
|
|
99
95
|
max-width: 40rem;
|
|
@@ -104,7 +100,7 @@ html.has-search-results-open {
|
|
|
104
100
|
&::after {
|
|
105
101
|
content: '';
|
|
106
102
|
position: absolute;
|
|
107
|
-
top:
|
|
103
|
+
top: 35px;
|
|
108
104
|
left: -9px;
|
|
109
105
|
width: 10px;
|
|
110
106
|
height: 20px;
|
|
@@ -117,44 +113,6 @@ html.has-search-results-open {
|
|
|
117
113
|
@include govuk-font($size: 27, $weight: bold);
|
|
118
114
|
margin-bottom: govuk-spacing(6);
|
|
119
115
|
}
|
|
120
|
-
.search-results__close {
|
|
121
|
-
@include govuk-font($size: 16);
|
|
122
|
-
position: absolute;
|
|
123
|
-
top: 18px;
|
|
124
|
-
right: 20px;
|
|
125
|
-
appearance: none;
|
|
126
|
-
-webkit-appearance: none;
|
|
127
|
-
background: none;
|
|
128
|
-
border: 0;
|
|
129
|
-
padding: 0;
|
|
130
|
-
cursor: pointer;
|
|
131
|
-
|
|
132
|
-
&:focus {
|
|
133
|
-
@include govuk-focused-text;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
&::after {
|
|
137
|
-
content: '';
|
|
138
|
-
display: inline-block;
|
|
139
|
-
vertical-align: middle;
|
|
140
|
-
padding-left: 8px;
|
|
141
|
-
height: 18px;
|
|
142
|
-
width: 18px;
|
|
143
|
-
background: no-repeat url('/images/govuk-icn-close.png') center right;
|
|
144
|
-
@include govuk-device-pixel-ratio {
|
|
145
|
-
background-image: url('/images/govuk-icn-close@2x.png');
|
|
146
|
-
}
|
|
147
|
-
background-size: contain;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
.search-results__close-label {
|
|
151
|
-
position: absolute;
|
|
152
|
-
left: -9999em;
|
|
153
|
-
top: auto;
|
|
154
|
-
width: 1px;
|
|
155
|
-
height: 1px;
|
|
156
|
-
overflow: hidden;
|
|
157
|
-
}
|
|
158
116
|
.search-result {
|
|
159
117
|
margin-bottom: govuk-spacing(6);
|
|
160
118
|
}
|
|
@@ -162,4 +120,24 @@ html.has-search-results-open {
|
|
|
162
120
|
background-color: transparent;
|
|
163
121
|
color: inherit;
|
|
164
122
|
font-weight: bold;
|
|
123
|
+
|
|
124
|
+
// In forced color mode some browsers will keep the background transparent
|
|
125
|
+
// but set the text colour black, making the highlighted text unreadable.
|
|
126
|
+
// The following blocks fix this by setting the text colour to be the same as
|
|
127
|
+
// other text in a way that forced color mode will respect.
|
|
128
|
+
|
|
129
|
+
@media screen and (-ms-high-contrast: active) {
|
|
130
|
+
// IE does not support `CanvasText`,
|
|
131
|
+
// and `currentColor` does not work with Blink
|
|
132
|
+
color: currentColor;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@media screen and (forced-colors: active) {
|
|
136
|
+
background-color: Canvas; // needed for Firefox
|
|
137
|
+
color: CanvasText;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.js .search-help__no-js {
|
|
142
|
+
display: none;
|
|
165
143
|
}
|
|
@@ -7,6 +7,7 @@ module GovukTechDocs
|
|
|
7
7
|
def initialize(app, document)
|
|
8
8
|
@app = app
|
|
9
9
|
@document = document
|
|
10
|
+
@redcarpet = build_redcarpet(app)
|
|
10
11
|
|
|
11
12
|
# Load template files
|
|
12
13
|
@template_api_full = get_renderer("api_reference_full.html.erb")
|
|
@@ -137,6 +138,11 @@ module GovukTechDocs
|
|
|
137
138
|
|
|
138
139
|
private
|
|
139
140
|
|
|
141
|
+
def build_redcarpet(app)
|
|
142
|
+
renderer = GovukTechDocs::TechDocsHTMLRenderer.new(context: app.config_context)
|
|
143
|
+
Redcarpet::Markdown.new(renderer)
|
|
144
|
+
end
|
|
145
|
+
|
|
140
146
|
def get_renderer(file)
|
|
141
147
|
template_path = File.join(File.dirname(__FILE__), "templates/" + file)
|
|
142
148
|
template = File.open(template_path, "r").read
|
|
@@ -159,6 +165,10 @@ module GovukTechDocs
|
|
|
159
165
|
id = "schema-#{schema.name.parameterize}"
|
|
160
166
|
"<a href='\##{id}'>#{schema.name}</a>"
|
|
161
167
|
end
|
|
168
|
+
|
|
169
|
+
def render_markdown(text)
|
|
170
|
+
@redcarpet.render(text) if text
|
|
171
|
+
end
|
|
162
172
|
end
|
|
163
173
|
end
|
|
164
174
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<h1 id="<%= info.title.parameterize %>"><%= info.title %> v<%= info.version %></h1>
|
|
2
|
-
<%= info.
|
|
2
|
+
<%= render_markdown(info.description) %>
|
|
3
3
|
|
|
4
4
|
<%# OpenAPI files default to having a single server of URL "/" %>
|
|
5
5
|
<% if servers.length > 1 || servers[0].url != "/" %>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<div id="server-list">
|
|
8
8
|
<% servers.each do |server| %>
|
|
9
9
|
<% if server.description %>
|
|
10
|
-
<p><strong><%= server.description %></strong></p>
|
|
10
|
+
<p><strong><%= render_markdown(server.description) %></strong></p>
|
|
11
11
|
<% end %>
|
|
12
12
|
<a href="<%= server.url %>"><%= server.url %></a>
|
|
13
13
|
<% end %>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<td><%= parameter.in %></td>
|
|
12
12
|
<td><%= parameter.schema.type %></td>
|
|
13
13
|
<td><%= parameter.required? %></td>
|
|
14
|
-
<td><%= parameter.
|
|
14
|
+
<td><%= render_markdown(parameter.description) %>
|
|
15
15
|
<% if parameter.schema.enum %>
|
|
16
16
|
<p>Available items:</p>
|
|
17
17
|
<ul>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<tr>
|
|
10
10
|
<td><%= key %></td>
|
|
11
11
|
<td>
|
|
12
|
-
<%= response.
|
|
12
|
+
<%= render_markdown(response.description) %>
|
|
13
13
|
<% if response.content['application/json']
|
|
14
14
|
if response.content['application/json']["example"]
|
|
15
15
|
request_body = json_prettyprint(response.content['application/json']["example"])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<h3 id="<%= id = 'schema-' + title; id.parameterize %>"><%= title %></h3>
|
|
2
|
-
<%= schema.
|
|
2
|
+
<%= render_markdown(schema.description) %>
|
|
3
3
|
<% if properties.any? %>
|
|
4
4
|
<table class='<%= id.parameterize %>'>
|
|
5
5
|
<thead>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<td><%= property_name %></td>
|
|
12
12
|
<td><%= property_attributes.type %></td>
|
|
13
13
|
<td><%= schema.requires?(property_name) %></td>
|
|
14
|
-
<td><%= property_attributes.
|
|
14
|
+
<td><%= render_markdown(property_attributes.description) %></td>
|
|
15
15
|
<td>
|
|
16
16
|
<%=
|
|
17
17
|
linked_schema = property_attributes
|
|
@@ -20,12 +20,18 @@ module GovukTechDocs
|
|
|
20
20
|
|
|
21
21
|
def report_issue_url
|
|
22
22
|
url = config[:source_urls]&.[](:report_issue_url)
|
|
23
|
+
params = {
|
|
24
|
+
body: "Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})",
|
|
25
|
+
}
|
|
23
26
|
|
|
24
27
|
if url.nil?
|
|
25
|
-
"#{repo_url}/issues/new
|
|
28
|
+
url = "#{repo_url}/issues/new"
|
|
29
|
+
params["labels"] = "bug"
|
|
30
|
+
params["title"] = "Re: '#{current_page.data.title}'"
|
|
26
31
|
else
|
|
27
|
-
"
|
|
32
|
+
params["subject"] = "Re: '#{current_page.data.title}'"
|
|
28
33
|
end
|
|
34
|
+
"#{url}?#{URI.encode_www_form(params)}"
|
|
29
35
|
end
|
|
30
36
|
|
|
31
37
|
def repo_url
|
data/lib/govuk_tech_docs.rb
CHANGED
|
@@ -113,10 +113,12 @@ module GovukTechDocs
|
|
|
113
113
|
url: { index: false, store: true },
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
search.pipeline_remove = %w[stopWordFilter]
|
|
116
|
+
search.pipeline_remove = %w[stemmer stopWordFilter]
|
|
117
117
|
|
|
118
118
|
search.tokenizer_separator = '/[\s\-/]+/'
|
|
119
119
|
end
|
|
120
|
+
else
|
|
121
|
+
context.ignore "search/*"
|
|
120
122
|
end
|
|
121
123
|
end
|
|
122
124
|
end
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
</div>
|
|
42
42
|
<% if config[:tech_docs][:header_links] %>
|
|
43
43
|
<div class="govuk-header__content">
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
<ul id="navigation" class="govuk-header__navigation
|
|
44
|
+
<nav class="govuk-header__navigation govuk-header__navigation--end" aria-label="Menu">
|
|
45
|
+
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide menu">Menu</button>
|
|
46
|
+
<ul id="navigation" class="govuk-header__navigation-list">
|
|
47
47
|
<% config[:tech_docs][:header_links].each do |title, path| %>
|
|
48
48
|
<li class="govuk-header__navigation-item<% if active_page(path) %> govuk-header__navigation-item--active<% end %>">
|
|
49
49
|
<a class="govuk-header__link" href="<%= url_for path %>"><%= title %></a>
|
|
@@ -13,12 +13,5 @@
|
|
|
13
13
|
placeholder="Search">
|
|
14
14
|
<button type="submit" class="search__button">Search</button>
|
|
15
15
|
</form>
|
|
16
|
-
<div id="search-results" class="search-results" aria-hidden="true" role="dialog" aria-labelledby="search-results-title">
|
|
17
|
-
<div class="search-results__inner">
|
|
18
|
-
<button class="search-results__close">Close<span class="search-results__close-label"> search results</span></button>
|
|
19
|
-
<h2 id="search-results-title" class="search-results__title" aria-live="assertive" role="alert">Results</h2>
|
|
20
|
-
<div class="search-results__content"></div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
16
|
</div>
|
|
24
17
|
<% end %>
|
data/lib/source/layouts/core.erb
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
<div class="app-pane">
|
|
29
29
|
<div class="app-pane__header toc-open-disabled">
|
|
30
|
-
<a href="#content" class="govuk-skip-link">Skip to main content</a>
|
|
30
|
+
<a href="#content" class="govuk-skip-link" data-module="govuk-skip-link">Skip to main content</a>
|
|
31
31
|
|
|
32
32
|
<%= partial 'layouts/header' %>
|
|
33
33
|
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Search
|
|
3
|
+
index: false
|
|
4
|
+
prevent_indexing: true
|
|
5
|
+
hide_in_navigation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<div id="search-help" class="search-help">
|
|
9
|
+
<%# strange id is to avoid clash with search input id #%>
|
|
10
|
+
<h1 id="how-to-search">Search</h1>
|
|
11
|
+
|
|
12
|
+
<p class="govuk-body search-help__no-js">
|
|
13
|
+
You need to turn on JavaScript in your browser to search this site. You can either:
|
|
14
|
+
|
|
15
|
+
<ul>
|
|
16
|
+
<li>turn on JavaScript in your browser</li>
|
|
17
|
+
<li>search this site using Google</li>
|
|
18
|
+
</ul>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p class="govuk-body">
|
|
22
|
+
Enter a search term in the search box, then select the search button.
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div id="search-results" class="search-results" hidden aria-labelledby="search-results-title">
|
|
27
|
+
<div class="search-results__inner">
|
|
28
|
+
<h1 id="search-results-title" class="search-results__title" aria-live="assertive">Results</h1>
|
|
29
|
+
<div class="search-results__content"></div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|