gitlab_kramdown 0.16.0 → 0.17.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: 517b3887d49cee2247f49be6b18fa0cbb6c4c18e7af3665ba7ff5ef176a76605
4
- data.tar.gz: 59cde8e22215f041764f87129bea76d3437812c80514bd7aea9051766fc5662d
3
+ metadata.gz: bd726d2ca05265f3dc10e348b0bf87d7ae76311b781edf33ed14eb4d8180681d
4
+ data.tar.gz: 232a0e2a3596e476d77c451c307c5940a91175a96af81af2faa9af0f9ab6e11d
5
5
  SHA512:
6
- metadata.gz: 4aabf0787861f334bf0e500a49ef9cd678beae3a3fba429d772df8e100b99980d9951e302c0e6a1d6502e8594671391841cdfcfba46f5c4e4500ec643eb2b3d7
7
- data.tar.gz: 96ea79c38638a5f800dd457c904114179a2ab4bf478bd6aa2e3b9cb4db37227e12ce363d73e38c215de6fe6c5d2a7e82dd164b2b5c40c8cda42b0f073b0e0c67
6
+ metadata.gz: 6c1a69ad95676834697382a26b454f16117f7a76472b5524ab740a6ed6dcdb1268b365975933efaa21f9c173e7dba53f32e4d469b678a99f66d05370a6c1ea5d
7
+ data.tar.gz: 1ed074519f3f46d3bccc005388668b36dff7a9350e33d3579eaed77662c892453f9981c4e278dbe291436e6f86a62260a4dc09215c146e539ce8c8b29c62dbd1
data/CHANGELOG.md CHANGED
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.16.0] - 2022-24-01
10
+ ## [0.17.0] - 2022-02-10
11
+
12
+ ### Added
13
+
14
+ - Add support for making PlantUML images a clickable link
15
+
16
+ ## [0.16.0] - 2022-01-24
11
17
 
12
18
  ### Fixed
13
19
 
@@ -21,19 +27,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
21
27
 
22
28
  ## [0.15.0] - 2021-12-20
23
29
 
24
- ### Changes
30
+ ### Changed
25
31
 
26
32
  - Update Gem dependencies.
27
33
 
28
34
  ## [0.14.0] - 2021-08-10
29
35
 
30
- ### Changes
36
+ ### Changed
31
37
 
32
38
  - Update Gem dependencies. In particular, update Nokogiri to version 1.12.x.
33
39
 
34
40
  ## [0.13.0] - 2021-07-02
35
41
 
36
- ### Changes
42
+ ### Changed
37
43
 
38
44
  - Update Gem dependencies
39
45
 
@@ -33,13 +33,7 @@ module GitlabKramdown
33
33
  when 'mermaid'
34
34
  %(<div class="mermaid">#{element.value}</div>\n)
35
35
  when 'plantuml'
36
- plantuml_setup
37
-
38
- img_tag = Nokogiri::HTML::DocumentFragment.parse(
39
- Asciidoctor::PlantUml::Processor.plantuml_content(element.value, {})
40
- )
41
-
42
- %(#{img_tag}\n)
36
+ render_plantuml(element)
43
37
  else
44
38
  super
45
39
  end
@@ -66,7 +60,7 @@ module GitlabKramdown
66
60
 
67
61
  href = element.attr['src']
68
62
 
69
- %(<a href="#{href}" target="_blank" rel="noopener noreferrer">#{super}</a>)
63
+ img_with_clickable_link(href, super)
70
64
  end
71
65
 
72
66
  # Label element is generated by the GitlabKramdown parser, representing GitLab labels
@@ -83,6 +77,26 @@ module GitlabKramdown
83
77
 
84
78
  format_as_span_html(:a, { 'href' => element.attr['href'] }, span_tag)
85
79
  end
80
+
81
+ def img_with_clickable_link(href, img_html)
82
+ %(<a class="no-attachment-icon" href="#{href}" target="_blank" rel="noopener noreferrer">#{img_html}</a>)
83
+ end
84
+
85
+ def render_plantuml(element)
86
+ plantuml_setup
87
+
88
+ img_tag = Nokogiri::HTML::DocumentFragment.parse(
89
+ Asciidoctor::PlantUml::Processor.plantuml_content(element.value, {})
90
+ )
91
+
92
+ if @clickable_images
93
+ href = img_tag.at('img').attr('src')
94
+
95
+ "#{img_with_clickable_link(href, img_tag)}\n"
96
+ else
97
+ %(#{img_tag}\n)
98
+ end
99
+ end
86
100
  end
87
101
  end
88
102
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitlabKramdown
4
- VERSION = '0.16.0'
4
+ VERSION = '0.17.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_kramdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Mazetto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -202,15 +202,15 @@ files:
202
202
  - lib/gitlab_kramdown/parser/strikethrough.rb
203
203
  - lib/gitlab_kramdown/version.rb
204
204
  - lib/kramdown/parser/gitlab_kramdown.rb
205
- homepage: https://gitlab.com/gitlab-org/gitlab_kramdown
205
+ homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown
206
206
  licenses:
207
207
  - MIT
208
208
  metadata:
209
- homepage_uri: https://gitlab.com/gitlab-org/gitlab_kramdown
210
- source_code_uri: https://gitlab.com/gitlab-org/gitlab_kramdown
211
- changelog_uri: https://gitlab.com/gitlab-org/gitlab_kramdown/blob/main/CHANGELOG.md
212
- bug_tracker_uri: https://gitlab.com/gitlab-org/gitlab_kramdown/-/issues
213
- post_install_message:
209
+ homepage_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown
210
+ source_code_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown
211
+ changelog_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown/blob/main/CHANGELOG.md
212
+ bug_tracker_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown/-/issues
213
+ post_install_message:
214
214
  rdoc_options: []
215
215
  require_paths:
216
216
  - lib
@@ -225,8 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  - !ruby/object:Gem::Version
226
226
  version: '0'
227
227
  requirements: []
228
- rubygems_version: 3.1.6
229
- signing_key:
228
+ rubygems_version: 3.3.5
229
+ signing_key:
230
230
  specification_version: 4
231
231
  summary: GitLab Flavored Kramdown
232
232
  test_files: []