kramdown-plantuml 1.2.0 → 1.3.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/README.md +10 -4
- data/bin/net/sourceforge/plantuml/plantuml/{1.2021.14/plantuml-1.2021.14.jar → 1.2021.12/plantuml-1.2021.12.jar} +0 -0
- data/lib/kramdown-plantuml/options.rb +6 -5
- data/lib/kramdown-plantuml/plantuml_diagram.rb +1 -1
- data/lib/kramdown-plantuml/theme.rb +19 -12
- data/lib/kramdown-plantuml/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc1234f77cba369797da8b8efd79b0a1913e65cd07f14ab26189c0acb2fa4900
|
4
|
+
data.tar.gz: 445fea556a2c3f248a3158e3f8fd9383624a1aceefb1e03e549e48ce87a6a4de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62dea36dfd6f811cb0861db862a938ae6e10f4d36fa1783ef33ec2338355710cfe8c718fcaf246cc73974d652729ea99560220997ef12c44174a8b6b1adbab1b
|
7
|
+
data.tar.gz: b9b72275e8eec577c9a249802191f8e9a457b1dfdb4e83328e2e4a942f43077ab39c08fbff2790af23f7c1c3c6d451250bfab7effa7b47455d994472bea1c439
|
data/README.md
CHANGED
@@ -132,20 +132,26 @@ kramdown:
|
|
132
132
|
|
133
133
|
### Dimensions and Styling
|
134
134
|
|
135
|
-
It's possible to customize the dimensions of the diagram by providing
|
136
|
-
`width` and `
|
137
|
-
styling with the `style` key.
|
135
|
+
It's possible to customize the dimensions and scale of the diagram by providing
|
136
|
+
the `width`, `height` and `scale` configuration keys. It's also possible to add
|
137
|
+
arbitrary styling with the `style` key.
|
138
|
+
|
139
|
+
`scale` is applied before the diagram is generated, while `width` and `height`
|
140
|
+
are applied after, meaning they can be combined (to most likely detrimental
|
141
|
+
results, but YOLO).
|
138
142
|
|
139
143
|
```yaml
|
140
144
|
kramdown:
|
141
145
|
plantuml:
|
142
146
|
width: 200px
|
143
147
|
height: 100px
|
148
|
+
scale: 2
|
144
149
|
style: "border: 1px solid black"
|
145
150
|
```
|
146
151
|
|
147
152
|
To remove the `width`, `height` and `style` attributes from the `<svg />`
|
148
|
-
element, set the key's value to `none`.
|
153
|
+
element, set the key's value to `none`. `scale` does not support a value of
|
154
|
+
`none` as it does not need to be removed.
|
149
155
|
|
150
156
|
```yaml
|
151
157
|
kramdown:
|
Binary file
|
@@ -7,7 +7,7 @@ module Kramdown
|
|
7
7
|
module PlantUml
|
8
8
|
# Options for PlantUML processing
|
9
9
|
class Options
|
10
|
-
attr_reader :theme_name, :theme_directory, :width, :height, :style
|
10
|
+
attr_reader :theme_name, :theme_directory, :width, :height, :style, :scale
|
11
11
|
|
12
12
|
def initialize(options_hash = {})
|
13
13
|
@logger = LogWrapper.init
|
@@ -72,14 +72,15 @@ module Kramdown
|
|
72
72
|
set_instance_property(:width, options)
|
73
73
|
set_instance_property(:height, options)
|
74
74
|
set_instance_property(:style, options)
|
75
|
+
set_instance_property(:scale, options)
|
75
76
|
end
|
76
77
|
|
77
|
-
def set_instance_property(
|
78
|
-
return unless options.key?
|
78
|
+
def set_instance_property(key, options)
|
79
|
+
return unless options.key? key
|
79
80
|
|
80
|
-
value = options[
|
81
|
+
value = options[key]
|
81
82
|
value = :none if value.none_s?
|
82
|
-
prop_name = "@#{
|
83
|
+
prop_name = "@#{key}".to_sym
|
83
84
|
instance_variable_set(prop_name, value)
|
84
85
|
end
|
85
86
|
|
@@ -8,7 +8,7 @@ module Kramdown
|
|
8
8
|
module PlantUml
|
9
9
|
# Provides theming support for PlantUML
|
10
10
|
class Theme
|
11
|
-
attr_reader :name, :directory
|
11
|
+
attr_reader :name, :directory, :scale
|
12
12
|
|
13
13
|
def initialize(options)
|
14
14
|
raise ArgumentError, 'options cannot be nil' if options.nil?
|
@@ -17,6 +17,7 @@ module Kramdown
|
|
17
17
|
@raise_errors = options.raise_errors?
|
18
18
|
@logger = LogWrapper.init
|
19
19
|
@name = options.theme_name
|
20
|
+
@scale = options.scale
|
20
21
|
@directory = resolve options.theme_directory
|
21
22
|
end
|
22
23
|
|
@@ -26,11 +27,6 @@ module Kramdown
|
|
26
27
|
return plantuml
|
27
28
|
end
|
28
29
|
|
29
|
-
if @name.nil? || @name.empty?
|
30
|
-
@logger.debug 'No theme to apply.'
|
31
|
-
return plantuml.strip
|
32
|
-
end
|
33
|
-
|
34
30
|
theme(plantuml)
|
35
31
|
end
|
36
32
|
|
@@ -59,13 +55,12 @@ module Kramdown
|
|
59
55
|
end
|
60
56
|
|
61
57
|
def theme(plantuml)
|
62
|
-
|
63
|
-
startuml_index = plantuml.index(startuml) + startuml.length
|
58
|
+
theme_string = build_theme_string
|
64
59
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
if theme_string.empty?
|
61
|
+
@logger.debug 'No theme to apply.'
|
62
|
+
return plantuml
|
63
|
+
end
|
69
64
|
|
70
65
|
@logger.debug "Applying #{theme_string.strip}"
|
71
66
|
|
@@ -75,6 +70,18 @@ module Kramdown
|
|
75
70
|
|
76
71
|
plantuml.strip
|
77
72
|
end
|
73
|
+
|
74
|
+
def build_theme_string
|
75
|
+
theme_string = ''
|
76
|
+
|
77
|
+
unless @name.nil? || @name.empty?
|
78
|
+
theme_string << "\n!theme #{@name}"
|
79
|
+
theme_string << " from #{@directory}" unless @directory.nil?
|
80
|
+
end
|
81
|
+
|
82
|
+
theme_string << "\nscale #{@scale}" unless @scale.nil?
|
83
|
+
theme_string
|
84
|
+
end
|
78
85
|
end
|
79
86
|
end
|
80
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown-plantuml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swedbank Pay
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -194,7 +194,7 @@ files:
|
|
194
194
|
- LICENSE
|
195
195
|
- README.md
|
196
196
|
- Rakefile
|
197
|
-
- bin/net/sourceforge/plantuml/plantuml/1.2021.
|
197
|
+
- bin/net/sourceforge/plantuml/plantuml/1.2021.12/plantuml-1.2021.12.jar
|
198
198
|
- kramdown-plantuml.gemspec
|
199
199
|
- lib/kramdown-plantuml.rb
|
200
200
|
- lib/kramdown-plantuml/bool_env.rb
|