asciidoctor-plantuml 0.0.5 → 0.0.6
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/lib/asciidoctor-plantuml/plantuml.rb +31 -1
- data/lib/asciidoctor-plantuml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34593810e67a089ee25f0e4ebfb7e14a0b307c18
|
4
|
+
data.tar.gz: df526472cb4c78416f747fca5718d3800df0ce3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bba398cd880168512cb502dabeb581f5fcd8b060450507693efab5d02dc8ab07fe78544d32553f99ee03be963cb103a4e5f4442410bb340af046d6af9472741c
|
7
|
+
data.tar.gz: 1efcbd60cc11db47b30d6050e1fa9ca8abcd1f5c523628f545fada264f17055af493eb433400c99d99d531a21288eac027be84d38d23d1dd7a12c0fc6d3906f9
|
@@ -10,11 +10,13 @@ module Asciidoctor
|
|
10
10
|
|
11
11
|
DEFAULT_URL = ENV["PLANTUML_URL"] || ""
|
12
12
|
|
13
|
-
attr_accessor :url, :txt_enable
|
13
|
+
attr_accessor :url, :txt_enable, :svg_enable, :png_enable
|
14
14
|
|
15
15
|
def initialize
|
16
16
|
@url = DEFAULT_URL
|
17
17
|
@txt_enable = true
|
18
|
+
@svg_enable = true
|
19
|
+
@png_enable = true
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -47,10 +49,26 @@ module Asciidoctor
|
|
47
49
|
PlantUml::configuration.txt_enable
|
48
50
|
end
|
49
51
|
|
52
|
+
def png_enabled?
|
53
|
+
PlantUml::configuration.png_enable
|
54
|
+
end
|
55
|
+
|
56
|
+
def svg_enabled?
|
57
|
+
PlantUml::configuration.svg_enable
|
58
|
+
end
|
59
|
+
|
60
|
+
def enabled?
|
61
|
+
txt_enabled? || png_enabled? || svg_enabled?
|
62
|
+
end
|
63
|
+
|
50
64
|
def plantuml_content(code, attrs = {})
|
51
65
|
|
52
66
|
format = attrs["format"] || DEFAULT_FORMAT
|
53
67
|
|
68
|
+
if !enabled?
|
69
|
+
return plantuml_disabled_content(code, attrs)
|
70
|
+
end
|
71
|
+
|
54
72
|
if !valid_uri?(server_url)
|
55
73
|
return plantuml_server_unavailable_content(server_url, attrs)
|
56
74
|
end
|
@@ -132,6 +150,18 @@ module Asciidoctor
|
|
132
150
|
content += "</div>"
|
133
151
|
end
|
134
152
|
|
153
|
+
def plantuml_disabled_content(code, attrs = {})
|
154
|
+
content = "<div class=\"listingblock\">"
|
155
|
+
content += "<div class=\"content\">"
|
156
|
+
content += "<pre "
|
157
|
+
content +="id=\"#{attrs['id']}\" " if attrs['id']
|
158
|
+
content +="class=\"plantuml plantuml-error\">\n"
|
159
|
+
content += code
|
160
|
+
content +="</pre>"
|
161
|
+
content += "</div>"
|
162
|
+
content += "</div>"
|
163
|
+
end
|
164
|
+
|
135
165
|
|
136
166
|
# Compression code used to generate PlantUML URLs. Taken directly from the
|
137
167
|
# Transcoder class in the PlantUML java code.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-plantuml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Horacio Sanson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|