asciidoctor-plantuml 0.0.5 → 0.0.6

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
  SHA1:
3
- metadata.gz: d237e41919909a5acb269df07453ddaacb86f70e
4
- data.tar.gz: 8a9bf93e2949704fd34072d77dad08ba7c6a1153
3
+ metadata.gz: 34593810e67a089ee25f0e4ebfb7e14a0b307c18
4
+ data.tar.gz: df526472cb4c78416f747fca5718d3800df0ce3f
5
5
  SHA512:
6
- metadata.gz: 8966c1145904166a1ba1ab7c9a90eea626814025dffed69a9db7c5e3f65941b781188a72c5271b966d949851a97fbeb129b17a9e8e1791a8d2529358e2b4622b
7
- data.tar.gz: 381214dd99a3b8f99a4ba692cc741206e601bd4ad4ecc85decf4024e3af8f6dd9da9f17cd8ac20d300ce421c057d654b5ebd9625002b14a3cdb3b16d08a8a5e0
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.
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module PlantUML
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
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.5
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-02 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler