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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbe80b6133cdaf41e2ab339250489d0a8c72f86cc88dc89f7e51c2340306a4c9
4
- data.tar.gz: f79167cb25923c99056e776a289dfa7124643c251b19633e2f01b7995d04df2a
3
+ metadata.gz: 306970ce3c2eedf60e681b68a6a0539480d8a4626ff4bd3f57207fa32cb2a06c
4
+ data.tar.gz: 2d8ccd150d9e394a9c54ee3a33bd0c424ecd71848022d00bbc7ce7f66c1cfc24
5
5
  SHA512:
6
- metadata.gz: a32ec9f65bf6a326b7300575fd101a36663a982160b81462b0b57854ecd13b8a3fa9116cc93a4702f4bd0fcfb04480a1d787f61522b23a974cd7878250a86086
7
- data.tar.gz: a978877e74111d7055b07682d32dc8e09c5e5aa972e6e143c144a3261a734b57b8257273e7afd3f850d657fd87d9b35744bfa87283a88450c3ca2eb7b1b0c33a
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
- ⚠️ Don't forget to update the gem version in the [CHANGELOG](https://github.com/alphagov/tech-docs-gem/blob/master/CHANGELOG.md) before merging! When you're ready to release bump [version file](https://github.com/alphagov/tech-docs-gem/blob/master/lib/govuk_tech_docs/version.rb) and generate a tag. ⚠️
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.description_html %>
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 %>
@@ -3,7 +3,7 @@
3
3
  <p><em><%= operation.summary %></em></p>
4
4
  <% end %>
5
5
  <% if operation.description %>
6
- <%= operation.description_html %>
6
+ <%= render_markdown(operation.description) %>
7
7
  <% end %>
8
8
 
9
9
  <%= parameters %>
@@ -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.description_html %>
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.description_html %>
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.description_html %>
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.description_html %></td>
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?labels=bug&title=Re: '#{current_page.data.title}'&body=Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})"
28
+ url = "#{repo_url}/issues/new"
29
+ params["labels"] = "bug"
30
+ params["title"] = "Re: '#{current_page.data.title}'"
26
31
  else
27
- "#{url}?subject=Re: '#{current_page.data.title}'&body=Problem with '#{current_page.data.title}' (#{config[:tech_docs][:host]}#{current_page.url})"
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
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "3.0.0".freeze
2
+ VERSION = "3.0.1".freeze
3
3
  end
data/package-lock.json CHANGED
@@ -1421,9 +1421,9 @@
1421
1421
  "dev": true
1422
1422
  },
1423
1423
  "path-parse": {
1424
- "version": "1.0.6",
1425
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
1426
- "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
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.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-10-06 00:00:00.000000000 Z
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.0.8
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