asciidoctor-diagram 2.2.3 → 2.2.5

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: 2c2f34fcc568a14ae6c72579b4a9e8ef429cbc1b023ae9c20945084a212ad844
4
- data.tar.gz: 7a11bdd3d63d22c3e472671b9a3e74ea3945edf80757350aaf6bfde690a9c392
3
+ metadata.gz: 980b6fb443595ac5fa50769efd9c56585825cad5f05eae4d3b19540f317f8d0d
4
+ data.tar.gz: 5c52555bd202fd535319ae5b2b2e9a2381ab13dd9f13f7ae76cdb5f97062ecf1
5
5
  SHA512:
6
- metadata.gz: ec745e7abc74b9ab114922de70fcc2fe01cd367cb60b1d47e90ee28ce120c7082400fa7d7176c2b0c9f47ea0a643a19dde64861d63460920b19e4157ff1aa706
7
- data.tar.gz: 9bc01b94478a69b8782e5fe7c3ffffa95cc9dbdbbc5092f64f3dfc340f84bdc65d0cb62c72445fbb3dbcce12befe2f4d6011782542ade71681e2a9636393872d
6
+ metadata.gz: 9ba75fc18d1a7f0367763f47cfd5fefc7280cc0a4d54ca4a782ddae7699cdd3ec9b7bcfdc113c79e85bdf5ce0e438225e6246a0d454bd3c16b0099812a0485f5
7
+ data.tar.gz: 184c202daec74ca42c450735e66de0b6de854d34671e009e5aaaf7e9a47b1d8207ca4d9b6bdbdd93596bbd7476c86a1efd4ffa8018a2c901c61263998ece0a89
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,19 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 2.2.5
4
+
5
+ Enhancements::
6
+
7
+ * Issue #401: Add passthrough `txt` output format support for A2S, Ditaa, and Svgbob
8
+ * Issue #402: Add https://github.com/kaishuu0123/erd-go[erd-go] support
9
+ * Issue #404: Add https://github.com/mscgenjs[mscgenjs] support
10
+
11
+ == 2.2.4
12
+
13
+ Enhancements::
14
+
15
+ * Issue #399: Add support for PlantUML theme attribute
16
+
3
17
  == 2.2.3
4
18
 
5
19
  Enhancements::
@@ -5,7 +5,7 @@ include::partial$uris.adoc[]
5
5
 
6
6
  Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document.
7
7
 
8
- The extensions supports the {uri-a2s}[AsciiToSVG], BlockDiag ({uri-blockdiag}[BlockDiag], {uri-seqdiag}[SeqDiag], {uri-actdiag}[ActDiag], {uri-nwdiag}[NwDiag]), {uri-bytefield}[Bytefield-SVG], {uri-ditaa}[Ditaa], {uri-dpic}[dpic], {uri-erd}[Erd], {uri-gnuplot}[Gnuplot], {uri-dot}[GraphViz], {uri-mermaid}[Mermaid], {uri-mscgen}[Msc], {uri-nomnoml}[Nomnoml], {uri-pikchr}[Pikchr], {uri-plantuml}[PlantUML], {uri-shaape}[Shaape], {uri-smcat}[State Machine Cat], {uri-svgbob}[SvgBob], {uri-symbolator}[Symbolator], {uri-syntrax}[Syntrax] / {uri-jsyntrax}[JSyntrax], {uri-umlet}[UMLet], {uri-vega}[Vega], {uri-vegalite}[Vega-Lite] and {uri-wavedrom}[WaveDrom] syntax.
8
+ The extensions support the {uri-a2s}[AsciiToSVG], BlockDiag ({uri-blockdiag}[BlockDiag], {uri-seqdiag}[SeqDiag], {uri-actdiag}[ActDiag], {uri-nwdiag}[NwDiag]), {uri-bytefield}[Bytefield-SVG], {uri-ditaa}[Ditaa], {uri-dpic}[dpic], {uri-erd}[Erd], {uri-gnuplot}[Gnuplot], {uri-dot}[GraphViz], {uri-mermaid}[Mermaid], {uri-mscgen}[Msc], {uri-nomnoml}[Nomnoml], {uri-pikchr}[Pikchr], {uri-plantuml}[PlantUML], {uri-shaape}[Shaape], {uri-smcat}[State Machine Cat], {uri-svgbob}[SvgBob], {uri-symbolator}[Symbolator], {uri-syntrax}[Syntrax] / {uri-jsyntrax}[JSyntrax], {uri-umlet}[UMLet], {uri-vega}[Vega], {uri-vegalite}[Vega-Lite] and {uri-wavedrom}[WaveDrom] syntax.
9
9
 
10
10
  Each extension runs the diagram processor to generate an SVG, PNG, or TXT file from the input text.
11
11
  The generated file is then inserted into your converted document.
@@ -18,4 +18,4 @@ include::partial$create_diagram.adoc[]
18
18
 
19
19
  include::partial$generate.adoc[]
20
20
 
21
- include::partial$advanced.adoc[]
21
+ include::partial$advanced.adoc[]
@@ -20,7 +20,7 @@ require 'asciidoctor-diagram/<extension_name>'
20
20
 
21
21
  Requiring one or more of these files will automatically register the extensions for all processed documents.
22
22
 
23
- If you need more fine grained control over when the extensions are enabled, `asciidoctor-diagram/<extension_name>/extension` can be used instead.
23
+ If you need more fine-grained control over when the extensions are enabled, `asciidoctor-diagram/<extension_name>/extension` can be used instead.
24
24
  This loads the extensions but does not register it in the Asciidoctor extension registry.
25
25
  You can then manually register the extensions at the appropriate times using the `Asciidoctor::Extensions` API.
26
26
 
@@ -54,13 +54,13 @@ When Asciidoctor Diagram writes images to disk it will go over the following opt
54
54
  The image generation also outputs metadata files that by default are located in `.asciidoctor/diagram`.
55
55
  To place them in different location, Asciidoctor Diagram checks for (in this order).
56
56
 
57
- . `\{cachedir\}` attribute is specified in the block header (ie. `[plantuml, png, cachedir=my-cache]`)
57
+ . `\{cachedir\}` attribute is specified in the block header (i.e. `[plantuml, png, cachedir=my-cache]`)
58
58
  . `\{diagram-cachedir\}` if the `diagram-cachedir` attribute has been specified
59
59
  . `\{outdir\}/\{imagesdir\}`
60
60
 
61
61
  === Specifying Diagram Generator Paths
62
62
 
63
- Asciidoctor Diagram depends on external tools to generates images.
63
+ Asciidoctor Diagram depends on external tools to generate images.
64
64
  In most cases it will locate these tools automatically for you by looking for specific executables in each directory in the `PATH` environment variable.
65
65
  In case you've installed a tool in a way where the executable is not in the `PATH`, you can override its location manually using document attributes.
66
66
  The following table lists the tools that are required for each diagram type, the location where they can be downloaded and the document attribute you can use to override their locations.
@@ -76,12 +76,12 @@ The following table lists the tools that are required for each diagram type, the
76
76
  |diagrams |{uri-python}[Python] |`diagrams-python`
77
77
  |ditaa |{uri-java}[Java] |`java`
78
78
  |dpic |{uri-dpic}[dpic] |`dpic`
79
- |erd |{uri-erd}[Erd] |`erd`
79
+ |erd |{uri-erd}[Erd] or {uri-erd-go}[Erd Go] |`erd`
80
80
  |gnuplot |{uri-gnuplot}[Gnuplot] |`gnuplot`
81
81
  |graphviz |{uri-graphviz}[GraphViz] |`dot` or `graphvizdot`
82
82
  |meme |{uri-imagemagick}[ImageMagick] |`convert` and `identify`
83
83
  |mermaid |{uri-mermaid}[Mermaid.cli] |`mmdc`
84
- |msc |{uri-mscgen}[Mscgen] |`mscgen`
84
+ |msc |{uri-mscgen}[Mscgen] or {uri-mscgen-js}[mscgen.js] |`mscgen`
85
85
  |nomnoml |{uri-nomnoml}[Nomnoml] |`nomnoml`
86
86
  |nwdiag |{uri-nwdiag}[NwDiag] |`nwdiag`
87
87
  |packetdiag |{uri-nwdiag}[NwDiag] |`packetdiag`
@@ -110,7 +110,7 @@ If for instance you installed `actdiag` in `/home/me/actdiag/bin` and this path
110
110
  === The Meme Extension
111
111
 
112
112
  The meme extension provides a basic '`Advice Animal`' style image generator.
113
- It's usage is easiest to explain with an example.
113
+ Its usage is easiest to explain with an example.
114
114
 
115
115
  ----
116
116
  meme::yunoguy.jpg[Doc writers,Y U NO // AsciiDoc]
@@ -144,7 +144,7 @@ Barcode macros can be specified using blocks, inline macros or block macros usin
144
144
  <2> Barcode attributes (see the <<barcode_attributes>> attributes section)
145
145
  <3> The content to encode in the barcode
146
146
 
147
- By default the `content` field of the barcode macros will be interpreted as the barcode content.
147
+ By default, the `content` field of the barcode macros will be interpreted as the barcode content.
148
148
  This works fine for simple barcodes, but for complex data (e.g., a vCard encoded as a QR code) this is not practical.
149
149
  If the `external` attribute is set on a barcode macro, the target is interpreted as a file path.
150
150
  The barcode content will then be obtained by reading the contents of the referenced file.
@@ -320,6 +320,7 @@ No specific attributes.
320
320
  |===
321
321
  |Name |Default value |Description
322
322
  |config |unspecified |Path to a config file to pass to PlantUML.
323
+ |theme |unspecified |PlantUML theme to use.
323
324
  |size-limit |4096 |The maximum dimensions (width and height) of generated diagrams.
324
325
  |includedir |unspecified |sets a common directory for puml includes (plantuml.include.path)
325
326
  |preprocess |true |Preprocess PlantUML code before rendering the diagram.
@@ -21,14 +21,14 @@ The following diagram types and output formats are available:
21
21
  [cols=">,5*^",options="header"]
22
22
  |===
23
23
  |Diagram Type |gif |pdf |png |svg |txt
24
- |{uri-a2s}[a2s] | | | |{check}|
24
+ |{uri-a2s}[a2s] | | | |{check}|{check}
25
25
  |{uri-actdiag}[actdiag] | |{check}|{check}|{check}|
26
26
  |<<barcode,barcode>> | | |{check}| |{check}
27
27
  |{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
28
28
  |{uri-bpmn}[bpmn] | |{check}|{check}|{check}|
29
29
  |{uri-bytefield}[bytefield] | | | |{check}|
30
30
  |{uri-diagrams}[diagrams] | |{check}|{check}|{check}|
31
- |{uri-ditaa}[ditaa] | | |{check}|{check}|
31
+ |{uri-ditaa}[ditaa] | | |{check}|{check}|{check}
32
32
  |{uri-dpic}[dpic] | | | |{check}|
33
33
  |{uri-erd}[erd] | | |{check}|{check}|
34
34
  |{uri-gnuplot}[gnuplot] |{check}| |{check}|{check}|{check}
@@ -45,7 +45,7 @@ The following diagram types and output formats are available:
45
45
  |{uri-seqdiag}[seqdiag] | |{check}|{check}|{check}|
46
46
  |{uri-shaape}[shaape] | | |{check}|{check}|
47
47
  |{uri-smcat}[smcat] | | | |{check}|
48
- |{uri-svgbob}[svgbob] | | | |{check}|
48
+ |{uri-svgbob}[svgbob] | | | |{check}|{check}
49
49
  |{uri-symbolator}[symbolator] | |{check}|{check}|{check}|
50
50
  |{uri-syntrax}[syntrax] (Syntrax) | |{check}|{check}|{check}|
51
51
  |{uri-jsyntrax}[syntrax] (JSyntrax)| | |{check}|{check}|
@@ -10,12 +10,14 @@
10
10
  :uri-dpic: https://gitlab.com/aplevich/dpic
11
11
  :uri-dot: https://graphviz.gitlab.io/_pages/doc/info/lang.html
12
12
  :uri-erd: https://github.com/BurntSushi/erd
13
+ :uri-erd-go: https://github.com/kaishuu0123/erd-go
13
14
  :uri-gnuplot: http://gnuplot.info
14
15
  :uri-graphviz: https://graphviz.gitlab.io
15
16
  :uri-imagemagick: http://www.imagemagick.org
16
17
  :uri-java: http://java.sun.com
17
18
  :uri-mermaid: https://github.com/mermaid-js/mermaid-cli
18
19
  :uri-mscgen: http://www.mcternan.me.uk/mscgen/
20
+ :uri-mscgen-js: https://github.com/mscgenjs/mscgenjs-cli
19
21
  :uri-nomnoml: http://nomnoml.com
20
22
  :uri-nwdiag: http://blockdiag.com/en/nwdiag/index.html
21
23
  :uri-packetdiag: http://blockdiag.com/en/nwdiag/index.html
@@ -10,7 +10,7 @@ module Asciidoctor
10
10
  include CliGenerator
11
11
 
12
12
  def supported_formats
13
- [:svg]
13
+ [:svg, :txt]
14
14
  end
15
15
 
16
16
  def collect_options(source)
@@ -24,6 +24,8 @@ module Asciidoctor
24
24
  end
25
25
 
26
26
  def convert(source, format, options)
27
+ return source.to_s if format == :txt
28
+
27
29
  sx = options[:sx]
28
30
  sy = options[:sy]
29
31
  scale = options[:scale]
@@ -40,7 +40,7 @@ module Asciidoctor
40
40
  Java.classpath.concat DITAA_JARS
41
41
 
42
42
  def supported_formats
43
- [:png, :svg]
43
+ [:png, :svg, :txt]
44
44
  end
45
45
 
46
46
  def collect_options(source)
@@ -59,6 +59,8 @@ module Asciidoctor
59
59
  end
60
60
 
61
61
  def convert(source, format, options)
62
+ return source.to_s if format == :txt
63
+
62
64
  Java.load
63
65
 
64
66
  flags = []
@@ -15,7 +15,7 @@ module Asciidoctor
15
15
  end
16
16
 
17
17
  def convert(source, format, options)
18
- erd_path = source.find_command('erd')
18
+ erd_path = source.find_command('erd', :alt_cmds => ['erd-go'])
19
19
  dot_path = source.find_command('dot', :alt_attrs => ['graphvizdot'])
20
20
 
21
21
  dot_code = generate_stdin(erd_path, format.to_s, source.to_s) do |tool_path, output_path|
@@ -20,6 +20,26 @@ module Asciidoctor
20
20
  raise "background attribute is required" unless bg_img
21
21
 
22
22
  options = source.attr('options', '').split(',')
23
+ margin = source.attr('margin', '')
24
+ margin_parts = margin.split(' ')
25
+ case margin_parts.length
26
+ when 0
27
+ ml = mr = mt = mb = nil
28
+ when 1
29
+ ml = mr = mt = mb = margin_parts[0]
30
+ when 2
31
+ mt = mb = margin_parts[0]
32
+ ml = mr = margin_parts[1]
33
+ when 3
34
+ mt = margin_parts[0]
35
+ ml = mr = margin_parts[1]
36
+ mb = margin_parts[2]
37
+ else
38
+ mt = margin_parts[0]
39
+ mr = margin_parts[1]
40
+ mb = margin_parts[2]
41
+ ml = margin_parts[3]
42
+ end
23
43
 
24
44
  {
25
45
  :bg_img => bg_img,
@@ -29,6 +49,12 @@ module Asciidoctor
29
49
  :stroke_color => source.attr(['strokecolor', 'stroke-color']),
30
50
  :stroke_width => source.attr(['strokewidth', 'stroke-width']),
31
51
  :font => source.attr('font', 'Impact'),
52
+ :font_size => source.attr('font_size', nil),
53
+ :alignment => source.attr('alignment', nil),
54
+ :margin_left => ml,
55
+ :margin_right => mr,
56
+ :margin_top => mt,
57
+ :margin_bottom => mb,
32
58
  :noupcase => options.include?('noupcase'),
33
59
  }
34
60
  end
@@ -21,7 +21,7 @@ module Asciidoctor
21
21
  def convert(source, format, options)
22
22
  font = options[:font]
23
23
 
24
- generate_stdin(source.find_command('mscgen'), format.to_s, source.to_s) do |tool_path, output_path|
24
+ generate_stdin(source.find_command('mscgen', :alt_cmds => ['mscgen_js']), format.to_s, source.to_s) do |tool_path, output_path|
25
25
  args = [tool_path, '-o', Platform.native_path(output_path), '-T', format.to_s]
26
26
  if font
27
27
  args << '-F' << font
@@ -25,7 +25,7 @@ module Asciidoctor
25
25
  Java.classpath.concat PLANTUML_JARS
26
26
 
27
27
  def wrap_source(source)
28
- PlantUMLPreprocessedSource.new(source, self.class.tag)
28
+ PlantUMLPreprocessedSource.new(source, self)
29
29
  end
30
30
 
31
31
  def supported_formats
@@ -33,9 +33,42 @@ module Asciidoctor
33
33
  end
34
34
 
35
35
  def collect_options(source)
36
- {
36
+ options = {
37
37
  :size_limit => source.attr('size-limit', '4096')
38
38
  }
39
+
40
+ theme = source.attr('theme', nil)
41
+ options[:theme] = theme if theme
42
+
43
+ options
44
+ end
45
+
46
+ def should_preprocess(source)
47
+ source.attr('preprocess', 'true') == 'true'
48
+ end
49
+
50
+ def add_common_headers(headers, source)
51
+ base_dir = source.base_dir
52
+
53
+ config_file = source.attr('plantumlconfig', nil, true) || source.attr('config')
54
+ if config_file
55
+ headers['X-PlantUML-Config'] = File.expand_path(config_file, base_dir)
56
+ end
57
+
58
+ headers['X-PlantUML-Basedir'] = Platform.native_path(File.expand_path(base_dir))
59
+
60
+ include_dir = source.attr('includedir')
61
+ if include_dir
62
+ headers['X-PlantUML-IncludeDir'] = Platform.native_path(File.expand_path(include_dir, base_dir))
63
+ end
64
+ end
65
+
66
+ def add_theme_header(headers, theme)
67
+ headers['X-PlantUML-Theme'] = theme if theme
68
+ end
69
+
70
+ def add_size_limit_header(headers, limit)
71
+ headers['X-PlantUML-SizeLimit'] = limit if limit
39
72
  end
40
73
 
41
74
  def convert(source, format, options)
@@ -60,11 +93,13 @@ module Asciidoctor
60
93
  'Accept' => mime_type
61
94
  }
62
95
 
63
- size_limit = options[:size_limit]
64
- if size_limit
65
- headers['X-PlantUML-SizeLimit'] = size_limit
96
+ unless should_preprocess(source)
97
+ add_common_headers(headers, source)
66
98
  end
67
99
 
100
+ add_theme_header(headers, options[:theme])
101
+ add_size_limit_header(headers, options[:size_limit])
102
+
68
103
  dot = source.find_command('dot', :alt_attrs => ['graphvizdot'], :raise_on_error => false)
69
104
  if dot
70
105
  headers['X-Graphviz'] = ::Asciidoctor::Diagram::Platform.host_os_path(dot)
@@ -97,9 +132,9 @@ module Asciidoctor
97
132
  end
98
133
 
99
134
  class PlantUMLPreprocessedSource < SimpleDelegator
100
- def initialize(source, tag)
135
+ def initialize(source, converter)
101
136
  super(source)
102
- @tag = tag
137
+ @converter = converter
103
138
  end
104
139
 
105
140
  def code
@@ -111,24 +146,13 @@ module Asciidoctor
111
146
 
112
147
  code = __getobj__.code
113
148
 
114
- code = "@start#{@tag}\n#{code}\n@end#{@tag}" unless code.index("@start") && code.index("@end")
115
-
116
- should_preprocess = attr('preprocess', 'true') == 'true'
149
+ tag = @converter.class.tag
150
+ code = "@start#{tag}\n#{code}\n@end#{tag}" unless code.index("@start") && code.index("@end")
117
151
 
118
- if should_preprocess
152
+ if @converter.should_preprocess(self)
119
153
  headers = {}
120
-
121
- config_file = attr('plantumlconfig', nil, true) || attr('config')
122
- if config_file
123
- headers['X-PlantUML-Config'] = File.expand_path(config_file, base_dir)
124
- end
125
-
126
- headers['X-PlantUML-Basedir'] = Platform.native_path(File.expand_path(base_dir))
127
-
128
- include_dir = attr('includedir')
129
- if include_dir
130
- headers['X-PlantUML-IncludeDir'] = Platform.native_path(File.expand_path(include_dir, base_dir))
131
- end
154
+ @converter.add_common_headers(headers, self)
155
+ @converter.add_theme_header(headers, @converter.collect_options(self)[:theme])
132
156
 
133
157
  response = Java.send_request(
134
158
  :url => '/plantumlpreprocessor',
@@ -11,7 +11,7 @@ module Asciidoctor
11
11
 
12
12
 
13
13
  def supported_formats
14
- [:svg]
14
+ [:svg, :txt]
15
15
  end
16
16
 
17
17
  def native_scaling?
@@ -38,6 +38,7 @@ module Asciidoctor
38
38
 
39
39
 
40
40
  def convert(source, format, options)
41
+ return source.to_s if format == :txt
41
42
 
42
43
  flags = []
43
44
  options.each do |option, value|
@@ -28,8 +28,10 @@ module Asciidoctor
28
28
 
29
29
  viewbox = root.attributes['viewBox']
30
30
  if (v = VIEWBOX_REGEX.match(viewbox)) && width.nil? && height.nil?
31
- width = to_numeric(v[:width])
32
- height = to_numeric(v[:height])
31
+ min_x = to_numeric(v[:min_x])
32
+ min_y = to_numeric(v[:min_y])
33
+ width ||= to_numeric(v[:width]) - min_x
34
+ height ||= to_numeric(v[:height]) - min_y
33
35
  end
34
36
 
35
37
  if viewbox.nil? && width && height
@@ -76,7 +78,7 @@ module Asciidoctor
76
78
  end
77
79
 
78
80
  WIDTH_HEIGHT_REGEX = /^\s*(?<value>\d+(?:\.\d+)?)\s*(?<unit>[a-zA-Z]+)?\s*$/
79
- VIEWBOX_REGEX = /^\s*\d+(?:\.\d+)?\s*\d+(?:\.\d+)?\s*(?<width>\d+(?:\.\d+)?)\s*(?<height>\d+(?:\.\d+)?)\s*$/
81
+ VIEWBOX_REGEX = /^\s*(?<min_x>-?\d+(?:\.\d+)?)\s*(?<min_y>-?\d+(?:\.\d+)?)\s*(?<width>\d+(?:\.\d+)?)\s*(?<height>\d+(?:\.\d+)?)\s*$/
80
82
 
81
83
  def self.to_px_factor(unit)
82
84
  case unit
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "2.2.3"
3
+ VERSION = "2.2.5"
4
4
  end
5
5
  end
data/spec/a2s_spec.rb CHANGED
@@ -25,9 +25,9 @@ describe Asciidoctor::Diagram::AsciiToSvgInlineMacroProcessor do
25
25
  end
26
26
 
27
27
  describe Asciidoctor::Diagram::AsciiToSvgBlockMacroProcessor do
28
- include_examples "block_macro", :a2s, A2S_CODE, [:svg]
28
+ include_examples "block_macro", :a2s, A2S_CODE, [:svg, :txt]
29
29
  end
30
30
 
31
31
  describe Asciidoctor::Diagram::AsciiToSvgBlockProcessor do
32
- include_examples "block", :svgbob, A2S_CODE, [:svg]
32
+ include_examples "block", :svgbob, A2S_CODE, [:svg, :txt]
33
33
  end
data/spec/ditaa_spec.rb CHANGED
@@ -17,11 +17,11 @@ describe Asciidoctor::Diagram::DitaaInlineMacroProcessor do
17
17
  end
18
18
 
19
19
  describe Asciidoctor::Diagram::DitaaBlockMacroProcessor do
20
- include_examples "block_macro", :ditaa, DITAA_CODE, [:png, :svg]
20
+ include_examples "block_macro", :ditaa, DITAA_CODE, [:png, :svg, :txt]
21
21
  end
22
22
 
23
23
  describe Asciidoctor::Diagram::DitaaBlockProcessor do
24
- include_examples "block", :ditaa, DITAA_CODE, [:png, :svg]
24
+ include_examples "block", :ditaa, DITAA_CODE, [:png, :svg, :txt]
25
25
 
26
26
  it "should support ditaa options as attributes" do
27
27
  doc = <<-eos
@@ -253,6 +253,34 @@ skinparam ArrowColor #DEADBE
253
253
  expect(svg).to match(/<[^<]+ fill=["']#DEADBE["']/)
254
254
  end
255
255
 
256
+ it 'should use plantuml theme when specified as a document attribute' do
257
+ doc = <<-eos
258
+ = Hello, PlantUML!
259
+ Doc Writer <doc@example.com>
260
+ :plantuml-format: svg
261
+ :plantuml-theme: spacelab
262
+
263
+ == First Section
264
+
265
+ [plantuml]
266
+ ----
267
+ actor Foo1
268
+ boundary Foo2
269
+ Foo1 -> Foo2 : To boundary
270
+ ----
271
+ eos
272
+
273
+ d = load_asciidoc doc
274
+ b = d.find { |bl| bl.context == :image }
275
+
276
+ target = b.attributes['target']
277
+ expect(target).to_not be_nil
278
+ expect(File.exist?(target)).to be true
279
+
280
+ svg = File.read(target, :encoding => Encoding::UTF_8)
281
+ expect(svg).to match(/<[^<]+ fill=["']url\(#gvl9ibi66ipfc0\)["']/)
282
+ end
283
+
256
284
  it 'should use plantuml include dir when specified as a document attribute' do
257
285
  doc = <<-eos
258
286
  = Hello, PlantUML!
data/spec/svgbob_spec.rb CHANGED
@@ -25,9 +25,9 @@ describe Asciidoctor::Diagram::SvgBobInlineMacroProcessor do
25
25
  end
26
26
 
27
27
  describe Asciidoctor::Diagram::SvgBobBlockMacroProcessor do
28
- include_examples "block_macro", :svgbob, SVGBOB_CODE, [:svg]
28
+ include_examples "block_macro", :svgbob, SVGBOB_CODE, [:svg, :txt]
29
29
  end
30
30
 
31
31
  describe Asciidoctor::Diagram::SvgBobBlockProcessor do
32
- include_examples "block", :svgbob, SVGBOB_CODE, [:svg]
32
+ include_examples "block", :svgbob, SVGBOB_CODE, [:svg, :txt]
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-diagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pepijn Van Eeckhoudt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-21 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -204,7 +204,7 @@ files:
204
204
  - lib/asciidoctor-diagram/plantuml.rb
205
205
  - lib/asciidoctor-diagram/plantuml/converter.rb
206
206
  - lib/asciidoctor-diagram/plantuml/extension.rb
207
- - lib/asciidoctor-diagram/plantuml/plantuml-1.3.21.jar
207
+ - lib/asciidoctor-diagram/plantuml/plantuml-1.3.22.jar
208
208
  - lib/asciidoctor-diagram/salt.rb
209
209
  - lib/asciidoctor-diagram/shaape.rb
210
210
  - lib/asciidoctor-diagram/shaape/converter.rb