govuk_markdown 2.0.1 → 2.0.2

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: 975a784ccde8bc595764bf9bbff9dc0377b00d43e3114a0870f75fb9a74dc828
4
- data.tar.gz: a648e648e2a72505e45f9100a3f4c7599287cca3c0bdd78fb34d5110cfcac62d
3
+ metadata.gz: 04e0653c66e2b3caa406acdfd07269a638ad834fd0791858f9d71dfa3eb43bbd
4
+ data.tar.gz: 1b1350d46fc9937987c5077a9130dc0602852afd72f8c57433cb746957290351
5
5
  SHA512:
6
- metadata.gz: a2309375dd6555cc7ca361513a9147844611519ad5c19a765e24a018cab5725faa2d91e50ca7698080d2efa7dc526876096f0ff97f7c7984945ab8da517e7a48
7
- data.tar.gz: 8ad79ffc90dae8461e019b18ad5371e94943df3e39d58697089a4a8510d856a1d0859b5b8792f0e4118f99715af106043db4e7ed1b96085794fa58b95f8da7c9
6
+ metadata.gz: 0cb66e8911fc9c18b9a7b05e2737400acc32a6fc444ceccbc0cf1da1e48515f299d793d55be2ec8310fb8b9be759f05fa2abe90b2b7e98ab82fa7d2f1514550c
7
+ data.tar.gz: 707d0d37111906368efd76b9f9086a7e026ee502ce1e0e31a3651d3b6b952507dad4b262946f4feea980ded9a2dfd22008580f5c61822fee054a9cc2ead7b5ba
@@ -10,14 +10,14 @@ jobs:
10
10
  name: Publish to RubyGems.org
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  with:
15
15
  ref: ${{ github.event.inputs.tag }}
16
16
 
17
17
  - name: Set up Ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: '2.7.6'
20
+ ruby-version: '3.1.4'
21
21
 
22
22
  - name: Install dependencies
23
23
  run: |
@@ -26,5 +26,5 @@ jobs:
26
26
 
27
27
  - name: Publish gem
28
28
  uses: dawidd6/action-publish-gem@v1
29
- with:
29
+ with:
30
30
  api_key: ${{ secrets.RUBYGEMS_API_KEY }}
@@ -6,7 +6,7 @@ jobs:
6
6
  strategy:
7
7
  fail-fast: false
8
8
  matrix:
9
- ruby: ['2.7.6', '3.0.4', '3.1.2']
9
+ ruby: ['3.1.4', '3.2.3', '3.3.0']
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
12
  - uses: actions/checkout@v2
@@ -23,4 +23,4 @@ jobs:
23
23
  run: bundle exec rubocop .
24
24
 
25
25
  - name: Run tests
26
- run: bundle exec rake
26
+ run: bundle exec rspec
data/.rubocop.yml CHANGED
@@ -5,3 +5,6 @@ inherit_gem:
5
5
  inherit_mode:
6
6
  merge:
7
7
  - Exclude
8
+
9
+ Style/EmptyCaseCondition:
10
+ Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.1.4
data/Gemfile.lock CHANGED
@@ -1,83 +1,106 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- govuk_markdown (2.0.1)
4
+ govuk_markdown (2.0.2)
5
5
  activesupport
6
6
  redcarpet
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (6.1.7.3)
11
+ activesupport (7.1.3.2)
12
+ base64
13
+ bigdecimal
12
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ connection_pool (>= 2.2.5)
16
+ drb
13
17
  i18n (>= 1.6, < 2)
14
18
  minitest (>= 5.1)
19
+ mutex_m
15
20
  tzinfo (~> 2.0)
16
- zeitwerk (~> 2.3)
17
21
  ast (2.4.2)
22
+ base64 (0.2.0)
23
+ bigdecimal (3.1.7)
18
24
  coderay (1.1.3)
19
- concurrent-ruby (1.2.2)
20
- diff-lcs (1.4.4)
21
- i18n (1.12.0)
25
+ concurrent-ruby (1.2.3)
26
+ connection_pool (2.4.1)
27
+ diff-lcs (1.5.1)
28
+ drb (2.2.1)
29
+ i18n (1.14.4)
22
30
  concurrent-ruby (~> 1.0)
23
- method_source (1.0.0)
24
- minitest (5.18.0)
25
- parallel (1.20.1)
26
- parser (3.0.2.0)
31
+ json (2.7.2)
32
+ language_server-protocol (3.17.0.3)
33
+ method_source (1.1.0)
34
+ minitest (5.22.3)
35
+ mutex_m (0.2.0)
36
+ parallel (1.24.0)
37
+ parser (3.3.0.5)
27
38
  ast (~> 2.4.1)
28
- pry (0.14.1)
39
+ racc
40
+ pry (0.14.2)
29
41
  coderay (~> 1.1)
30
42
  method_source (~> 1.0)
31
- rack (3.0.7)
32
- rainbow (3.0.0)
33
- rake (13.0.6)
43
+ racc (1.7.3)
44
+ rack (3.0.10)
45
+ rainbow (3.1.1)
46
+ rake (13.2.1)
34
47
  redcarpet (3.6.0)
35
- regexp_parser (2.1.1)
36
- rexml (3.2.5)
37
- rspec (3.10.0)
38
- rspec-core (~> 3.10.0)
39
- rspec-expectations (~> 3.10.0)
40
- rspec-mocks (~> 3.10.0)
41
- rspec-core (3.10.1)
42
- rspec-support (~> 3.10.0)
43
- rspec-expectations (3.10.1)
48
+ regexp_parser (2.9.0)
49
+ rexml (3.2.6)
50
+ rspec (3.13.0)
51
+ rspec-core (~> 3.13.0)
52
+ rspec-expectations (~> 3.13.0)
53
+ rspec-mocks (~> 3.13.0)
54
+ rspec-core (3.13.0)
55
+ rspec-support (~> 3.13.0)
56
+ rspec-expectations (3.13.0)
44
57
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.10.0)
46
- rspec-mocks (3.10.2)
58
+ rspec-support (~> 3.13.0)
59
+ rspec-mocks (3.13.0)
47
60
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.10.0)
49
- rspec-support (3.10.2)
50
- rubocop (1.15.0)
61
+ rspec-support (~> 3.13.0)
62
+ rspec-support (3.13.1)
63
+ rubocop (1.62.1)
64
+ json (~> 2.3)
65
+ language_server-protocol (>= 3.17.0)
51
66
  parallel (~> 1.10)
52
- parser (>= 3.0.0.0)
67
+ parser (>= 3.3.0.2)
53
68
  rainbow (>= 2.2.2, < 4.0)
54
69
  regexp_parser (>= 1.8, < 3.0)
55
- rexml
56
- rubocop-ast (>= 1.5.0, < 2.0)
70
+ rexml (>= 3.2.5, < 4.0)
71
+ rubocop-ast (>= 1.31.1, < 2.0)
57
72
  ruby-progressbar (~> 1.7)
58
- unicode-display_width (>= 1.4.0, < 3.0)
59
- rubocop-ast (1.6.0)
60
- parser (>= 3.0.1.1)
61
- rubocop-govuk (4.0.0)
62
- rubocop (~> 1.15.0)
63
- rubocop-ast (~> 1.6.0)
64
- rubocop-rails (~> 2.10.0)
65
- rubocop-rake (= 0.5.1)
66
- rubocop-rspec (~> 2.3.0)
67
- rubocop-rails (2.10.1)
73
+ unicode-display_width (>= 2.4.0, < 3.0)
74
+ rubocop-ast (1.31.2)
75
+ parser (>= 3.3.0.4)
76
+ rubocop-capybara (2.20.0)
77
+ rubocop (~> 1.41)
78
+ rubocop-factory_bot (2.25.1)
79
+ rubocop (~> 1.41)
80
+ rubocop-govuk (4.16.1)
81
+ rubocop (= 1.62.1)
82
+ rubocop-ast (= 1.31.2)
83
+ rubocop-rails (= 2.24.1)
84
+ rubocop-rake (= 0.6.0)
85
+ rubocop-rspec (= 2.28.0)
86
+ rubocop-rails (2.24.1)
68
87
  activesupport (>= 4.2.0)
69
88
  rack (>= 1.1)
70
- rubocop (>= 1.7.0, < 2.0)
71
- rubocop-rake (0.5.1)
72
- rubocop
73
- rubocop-rspec (2.3.0)
89
+ rubocop (>= 1.33.0, < 2.0)
90
+ rubocop-ast (>= 1.31.1, < 2.0)
91
+ rubocop-rake (0.6.0)
74
92
  rubocop (~> 1.0)
75
- rubocop-ast (>= 1.1.0)
76
- ruby-progressbar (1.11.0)
93
+ rubocop-rspec (2.28.0)
94
+ rubocop (~> 1.40)
95
+ rubocop-capybara (~> 2.17)
96
+ rubocop-factory_bot (~> 2.22)
97
+ rubocop-rspec_rails (~> 2.28)
98
+ rubocop-rspec_rails (2.28.3)
99
+ rubocop (~> 1.40)
100
+ ruby-progressbar (1.13.0)
77
101
  tzinfo (2.0.6)
78
102
  concurrent-ruby (~> 1.0)
79
- unicode-display_width (2.0.0)
80
- zeitwerk (2.6.7)
103
+ unicode-display_width (2.5.0)
81
104
 
82
105
  PLATFORMS
83
106
  ruby
data/README.md CHANGED
@@ -4,7 +4,7 @@ This Ruby gem converts Markdown into [GOV.UK Frontend](https://github.com/alphag
4
4
 
5
5
  Don't confuse this gem with [govspeak](https://github.com/alphagov/govspeak), which is a Markdown dialect specifically built for the GOV.UK publishing system (www.gov.uk).
6
6
 
7
- Note that this gem supports [GOV.UK Components](https://github.com/DFE-Digital/govuk-components) version 4.0.0
7
+ Note that this gem supports [GOV.UK Design System](https://design-system.service.gov.uk/) version 5.3.0.
8
8
 
9
9
  ## Installation
10
10
 
@@ -52,9 +52,9 @@ GovukMarkdown.render(markdown, headings_start_with: "l")
52
52
 
53
53
  ### Adding inset text to your markdown
54
54
 
55
- To add [inset text](https://govuk-components.netlify.app/components/inset-text/) to your markdown document, use the following tags:
55
+ To add [inset text](https://design-system.service.gov.uk/components/inset-text/) to your markdown document, use the following tags:
56
56
 
57
- ```markdown
57
+ ```
58
58
  {inset-text}Text to be inset goes here{/inset-text}
59
59
  ```
60
60
 
@@ -70,10 +70,10 @@ The renderer also handles multi-line text as well as multiple paragraphs inside
70
70
 
71
71
  ### Adding details sections to your markdown
72
72
 
73
- To add the [details component](https://govuk-components.netlify.app/components/details/) to your markdown, use the following tags:
73
+ To add the [details component](https://design-system.service.gov.uk/components/details/) to your markdown, use the following tags:
74
74
 
75
- ```markdown
76
- {details} Find out about the fox and the dog. Whilst the fox is quick and brown, the dog is lazy. {/details}
75
+ ```
76
+ {details} Find out about the fox and the dog. Whilst the fox is quick and brown, the dog is lazy.{/details}
77
77
  ```
78
78
 
79
79
  The first sentence is rendered as the details summary text. The remaining text is rendered as the details text. The renderer handles multiple paragraphs for the details text.
data/Rakefile CHANGED
@@ -1,4 +1,9 @@
1
+ require "mkmf"
1
2
  require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
2
7
  task default: :spec
3
8
 
4
9
  desc "Regenerate the example HTML in example/example.html"
@@ -9,7 +14,15 @@ task :generate_example do
9
14
  html = GovukMarkdown.render(markdown)
10
15
 
11
16
  File.write("example/example.html", ERB.new(File.read("example/example_layout.html.erb")).result(binding))
12
- sh "open example/example.html"
17
+
18
+ case
19
+ when find_executable("xdg-open") # linux
20
+ sh("xdg-open example/example.html")
21
+ when find_executable("open") # mac
22
+ sh("open example/example.html")
23
+ else
24
+ puts "View the example in example/example.html"
25
+ end
13
26
  end
14
27
 
15
28
  desc "Print the current version of the gem"
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = "Convert Markdown into GOV.UK styled HTML"
10
10
  spec.description = "Convert Markdown into GOV.UK styled HTML"
11
11
  spec.homepage = "https://github.com/DFE-Digital/govuk_markdown"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.4")
13
13
 
14
14
  spec.metadata["homepage_uri"] = spec.homepage
15
15
  spec.metadata["source_code_uri"] = spec.homepage
@@ -26,12 +26,20 @@ module GovukMarkdown
26
26
  HTML
27
27
  end
28
28
 
29
- def table_cell(content, _alignment)
30
- <<~HTML
31
- <td class='govuk-table__cell'>
32
- #{content}
33
- </td>
34
- HTML
29
+ def table_cell(content, _alignment, header)
30
+ if header
31
+ <<~HTML
32
+ <th class='govuk-table__header'>
33
+ #{content}
34
+ </th>
35
+ HTML
36
+ else
37
+ <<~HTML
38
+ <td class='govuk-table__cell'>
39
+ #{content}
40
+ </td>
41
+ HTML
42
+ end
35
43
  end
36
44
 
37
45
  def header(text, header_level)
@@ -1,3 +1,3 @@
1
1
  module GovukMarkdown
2
- VERSION = "2.0.1".freeze
2
+ VERSION = "2.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tijmen Brommet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -138,14 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
139
  - - ">="
140
140
  - !ruby/object:Gem::Version
141
- version: 2.7.0
141
+ version: 3.1.4
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.1.4
148
+ rubygems_version: 3.3.26
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Convert Markdown into GOV.UK styled HTML