govuk_tech_docs 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of govuk_tech_docs might be problematic. Click here for more details.
- 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/CHANGELOG.md +11 -0
- 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/package-lock.json +3 -3
- metadata +9 -7
- data/.travis.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 306970ce3c2eedf60e681b68a6a0539480d8a4626ff4bd3f57207fa32cb2a06c
|
4
|
+
data.tar.gz: 2d8ccd150d9e394a9c54ee3a33bd0c424ecd71848022d00bbc7ce7f66c1cfc24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2efb012ebfdf219f6f08fb91130189fb23368731a31371f806fb16727b627f7ba7c3f8fa0894afc0e10af879adb950eb1b2d7dfca49f98b0fa2fe6eabc129a74
|
7
|
+
data.tar.gz: e34554e67b183255fa3f20fb2dcb95e4c3af042de317f7735c82e5c3a988524de7c4e0e12b58bac20f9bdf770a9bd2e556bea6febb0e62ecd560f04cdd885782
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!--
|
2
|
+
Please fill in the sections below.
|
3
|
+
|
4
|
+
After you submit your issue, 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
|
+
-->
|
6
|
+
|
7
|
+
## What should change
|
8
|
+
|
9
|
+
<!-- What would fix the issue? Is this something you think should behave differently, or something that you currently cannot do? -->
|
10
|
+
|
11
|
+
## User need
|
12
|
+
|
13
|
+
<!-- Do you have evidence that this meets the needs of users? Let us know about any user research or testing you’ve done. -->
|
@@ -1 +1,14 @@
|
|
1
|
-
|
1
|
+
<!--
|
2
|
+
## Please fill in the sections below
|
3
|
+
|
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
|
+
-->
|
6
|
+
|
7
|
+
## What’s changed
|
8
|
+
|
9
|
+
<!-- What are you trying to do? Is this something that changes how the Tech Docs Template behaves, or is it fixing a bug? -->
|
10
|
+
|
11
|
+
|
12
|
+
## Identifying a user need
|
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. -->
|
@@ -0,0 +1,76 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
workflow_dispatch:
|
8
|
+
|
9
|
+
concurrency: rubygems
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
pre:
|
13
|
+
name: Pre-flight checks
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
outputs:
|
16
|
+
go: ${{ steps.gem_version.outputs.new_version }}
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
|
23
|
+
- name: Check if new version to release
|
24
|
+
id: gem_version
|
25
|
+
run: |
|
26
|
+
gem_version=$(ruby -r rubygems -e "puts Gem::Specification::load('govuk_tech_docs.gemspec').version")
|
27
|
+
echo "::set-output name=gem_version::$gem_version"
|
28
|
+
|
29
|
+
if git fetch origin "refs/tags/v$gem_version" >/dev/null 2>&1
|
30
|
+
then
|
31
|
+
echo "Tag 'v$gem_version' already exists"
|
32
|
+
echo "::set-output name=new_version::false"
|
33
|
+
else
|
34
|
+
echo "::set-output name=new_version::true"
|
35
|
+
fi
|
36
|
+
|
37
|
+
deploy:
|
38
|
+
name: Publish Ruby Gem
|
39
|
+
environment: rubygems
|
40
|
+
permissions:
|
41
|
+
contents: write # needed to be able to tag the release
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
needs: pre
|
44
|
+
if: ${{ needs.pre.outputs.go == 'true' }}
|
45
|
+
|
46
|
+
steps:
|
47
|
+
- uses: actions/checkout@v2
|
48
|
+
|
49
|
+
- uses: actions/setup-node@v2
|
50
|
+
with:
|
51
|
+
cache: 'npm'
|
52
|
+
node-version: '14'
|
53
|
+
|
54
|
+
- uses: ruby/setup-ruby@v1
|
55
|
+
with:
|
56
|
+
bundler-cache: true
|
57
|
+
|
58
|
+
- name: Publish
|
59
|
+
env:
|
60
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
61
|
+
run: |
|
62
|
+
mkdir -p ~/.gem
|
63
|
+
|
64
|
+
cat << EOF > ~/.gem/credentials
|
65
|
+
---
|
66
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
67
|
+
EOF
|
68
|
+
|
69
|
+
chmod 0600 ~/.gem/credentials
|
70
|
+
|
71
|
+
# tag will be associated with github-actions bot user, see
|
72
|
+
# https://github.community/t/github-actions-bot-email-address/17204
|
73
|
+
git config user.name "github-actions[bot]"
|
74
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
75
|
+
|
76
|
+
bundle exec rake release
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: Test
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- uses: actions/setup-node@v2
|
14
|
+
with:
|
15
|
+
node-version: '14'
|
16
|
+
cache: 'npm'
|
17
|
+
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
bundler-cache: true
|
21
|
+
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 3.0.1
|
6
|
+
|
7
|
+
### Fixes
|
8
|
+
|
9
|
+
We’ve made the following fixes to the tech docs gem in [pull request #281: Don't break TOC when OpenAPI description includes headers](https://github.com/alphagov/tech-docs-gem/pull/281):
|
10
|
+
|
11
|
+
* we now render OpenAPI Markdown with the same Markdown renderer as other documents
|
12
|
+
* table of contents (TOC) uses `TechDocsHTMLRenderer` to render the headings with IDs
|
13
|
+
|
14
|
+
Thanks to [@jamietanna](https://github.com/jamietanna) for contributing to this issue and its solution.
|
15
|
+
|
5
16
|
## 3.0.0
|
6
17
|
|
7
18
|
### Breaking changes
|
@@ -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/package-lock.json
CHANGED
@@ -1421,9 +1421,9 @@
|
|
1421
1421
|
"dev": true
|
1422
1422
|
},
|
1423
1423
|
"path-parse": {
|
1424
|
-
"version": "1.0.
|
1425
|
-
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.
|
1426
|
-
"integrity": "sha512-
|
1424
|
+
"version": "1.0.7",
|
1425
|
+
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
1426
|
+
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
1427
1427
|
"dev": true
|
1428
1428
|
},
|
1429
1429
|
"path-type": {
|
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: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Government Digital Service
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autoprefixer-rails
|
@@ -271,13 +271,15 @@ extensions: []
|
|
271
271
|
extra_rdoc_files: []
|
272
272
|
files:
|
273
273
|
- ".editorconfig"
|
274
|
+
- ".github/ISSUE_TEMPLATE.md"
|
274
275
|
- ".github/pull_request_template.md"
|
276
|
+
- ".github/workflows/publish.yaml"
|
277
|
+
- ".github/workflows/test.yaml"
|
275
278
|
- ".gitignore"
|
276
279
|
- ".nvmrc"
|
277
280
|
- ".rspec"
|
278
281
|
- ".rubocop.yml"
|
279
282
|
- ".ruby-version"
|
280
|
-
- ".travis.yml"
|
281
283
|
- CHANGELOG.md
|
282
284
|
- Gemfile
|
283
285
|
- LICENCE
|
@@ -558,7 +560,7 @@ homepage: https://github.com/alphagov/tech-docs-gem
|
|
558
560
|
licenses:
|
559
561
|
- MIT
|
560
562
|
metadata: {}
|
561
|
-
post_install_message:
|
563
|
+
post_install_message:
|
562
564
|
rdoc_options: []
|
563
565
|
require_paths:
|
564
566
|
- lib
|
@@ -573,8 +575,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
573
575
|
- !ruby/object:Gem::Version
|
574
576
|
version: '0'
|
575
577
|
requirements: []
|
576
|
-
rubygems_version: 3.
|
577
|
-
signing_key:
|
578
|
+
rubygems_version: 3.1.4
|
579
|
+
signing_key:
|
578
580
|
specification_version: 4
|
579
581
|
summary: Gem to distribute the GOV.UK Tech Docs Template
|
580
582
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache:
|
3
|
-
bundler: true
|
4
|
-
npm: true
|
5
|
-
before_install:
|
6
|
-
- nvm install
|
7
|
-
- nvm use
|
8
|
-
- gem update --system
|
9
|
-
- gem install bundler
|
10
|
-
before_script:
|
11
|
-
- npm install
|
12
|
-
deploy:
|
13
|
-
provider: rubygems
|
14
|
-
gem: govuk_tech_docs
|
15
|
-
api_key:
|
16
|
-
secure: "pFaDlf2VfJAv/EwTFQTdHQFlFRLxtNnipcJyFG0Dvn7itvETKzs5+91gnXQAJuUzGBgXSidHgMkmPTsmWM4k2wbOcHopir9ThSKf0OUtI6o/5GqCU92BpLNJ/Ykhf+wyz9ai6HWX+HN5KRDqpeiuwhraiQjy/tg6lwsauBU8sB80wvUgYYM6oXijHfVwPUkXdhqYTIj20S0M868yYGtf4IInHds8M85TSNor79TFvRd0SFLO7cS+bftqxnNo1mYuBzVXls3POjq59WX+yG8+vS9Sr/tHHuKxw1nho95Fnjf8RYzdxD45osCrXAu3JIbWyJjF6AmQd87zILhdl8n0KNf4tbpFVM+SXVUjMZ2ERvcS1v+nBybVzU3uPwskGZNfWMtCOS401yRF3A21xzNoS916gZrTUSvHjsMcNhzJAZCsEx6MGFVTMzfe5slfWQCPk8k9wBHjyUyC7dl0h5g9qo3jTDnafcpQdnWGOSGgwCxgTaYT1NFfV3M5YpdGevorkOnE6EmWtU67mdtjzRyVvMWc8obqBWdyYnxqrBYKnHDeu/LhtJq3Gvqt/IExwAI8Q1Q7j296hzfmYMcgnETctLNZWoIa4sESDDVMlspcZKqCsrxytDeBFm/yMqVp12S7cjoQbt+fItTl3Bh3BP56j+3fqJlFvTPX4FIKUaaRLy0="
|
17
|
-
on:
|
18
|
-
repo: alphagov/tech-docs-gem
|
19
|
-
branch: master
|