asciidoctor-diagram 2.1.1 → 2.1.2
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/CHANGELOG.adoc +10 -0
- data/docs/modules/ROOT/partials/advanced.adoc +11 -3
- data/lib/asciidoctor-diagram/http/converter.rb +35 -11
- data/lib/asciidoctor-diagram/syntrax/converter.rb +1 -1
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/spec/a2s_spec.rb +3 -3
- data/spec/blockdiag_spec.rb +3 -3
- data/spec/bpmn_spec.rb +3 -3
- data/spec/bytefield_spec.rb +3 -3
- data/spec/diagrams_spec.rb +3 -3
- data/spec/ditaa_spec.rb +3 -3
- data/spec/dpic_spec.rb +3 -3
- data/spec/erd_spec.rb +3 -3
- data/spec/gnuplot_spec.rb +10 -10
- data/spec/graphviz_spec.rb +3 -3
- data/spec/lilypond_spec.rb +3 -3
- data/spec/mermaid_spec.rb +3 -3
- data/spec/msc_spec.rb +3 -3
- data/spec/nomnoml_spec.rb +3 -3
- data/spec/pikchr_spec.rb +3 -3
- data/spec/plantuml_spec.rb +35 -3
- data/spec/shaape_spec.rb +3 -3
- data/spec/smcat_spec.rb +3 -3
- data/spec/svgbob_spec.rb +3 -3
- data/spec/symbolator_spec.rb +3 -3
- data/spec/syntrax_spec.rb +3 -3
- data/spec/tikz_spec.rb +4 -4
- data/spec/umlet_spec.rb +3 -3
- data/spec/vega_spec.rb +6 -6
- data/spec/wavedrom_spec.rb +3 -3
- 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: 9c999abc157686ce7101a23d06b8e3cdf83ec0244f1d9697343ec7e9a6afe946
|
4
|
+
data.tar.gz: 44349c53eefb7e2eb330348a29e2f1a4ee6b60ed1ec5548dc4b3c99ab6fcab5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afd079eab9fbfd29a76690012e699c9fa5e45ab14f35b9469defb3a46060e3011b814913af1d5c5365c63157ee8def0101a41ba6b6368d154ad26fe36440ac75
|
7
|
+
data.tar.gz: e994d6101f63d0fcfde7b04c4763aa43a9eac167cb19295777124cbc25b3042c132869d47597fd33c107b7da583442697bd80852faa9db641d91155cd8b86edd
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 2.1.2
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
|
7
|
+
* Issue #345: Switch to POST requests when URI length becomes too long
|
8
|
+
|
9
|
+
Bug Fixes::
|
10
|
+
|
11
|
+
* Issue #348: Rename Syntrax `style` attribute to `style-file` to avoid clashing with the built-in block style attribute.
|
12
|
+
|
3
13
|
== 2.1.1
|
4
14
|
|
5
15
|
Enhancements::
|
@@ -149,12 +149,20 @@ The attribute name at the document level should be prefixed with the diagram typ
|
|
149
149
|
|
150
150
|
==== Shared Attributes
|
151
151
|
|
152
|
+
The set of shared attributes applies to all diagram types.
|
153
|
+
The value for these attributes can be defined at the document level for a single diagram type using the diagram type as prefix or for all diagram types using `diagram` as prefix.
|
154
|
+
|
152
155
|
[cols=">,<,<",options="header"]
|
153
156
|
|===
|
154
|
-
|Name
|
155
|
-
|svg-type
|
157
|
+
|Name |Default value |Description
|
158
|
+
|svg-type |unspecified |One of `static`, `inline` or `interactive`.
|
156
159
|
This determines the style of SVG embedding that's used in certain backends.
|
157
160
|
The xref:asciidoc:macros:image-svg.adoc[asciidoc spec] describes this in more detail.
|
161
|
+
|server-url |unspecified |External service to render diagram.
|
162
|
+
Usage removes the need to depend on external tools to be installed locally.
|
163
|
+
|server-type |unspecified |One of `plantuml` or `kroki_io`
|
164
|
+
|max-get-size |1024 |The maximum size of the URI path for HTTP GET requests.
|
165
|
+
If the maximum size is exceeded, POST requests are used instead
|
158
166
|
|===
|
159
167
|
|
160
168
|
==== AsciiToSVG
|
@@ -298,7 +306,7 @@ No specific attributes.
|
|
298
306
|
|Name |Default value |Description
|
299
307
|
|heading |unspecifed |Diagram title
|
300
308
|
|scale |1 |A scale factor that is applied to the image.
|
301
|
-
|style
|
309
|
+
|style-file |unspecifed |Path to a style config file to pass to Syntrax.
|
302
310
|
|transparent |false |Makes the background of the image transparent instead of opaque white.
|
303
311
|
|===
|
304
312
|
|
@@ -11,6 +11,8 @@ module Asciidoctor
|
|
11
11
|
module Diagram
|
12
12
|
# @private
|
13
13
|
class HttpConverter
|
14
|
+
DEFAULT_MAX_GET_SIZE = 1024
|
15
|
+
|
14
16
|
include DiagramConverter
|
15
17
|
|
16
18
|
def initialize(base_uri, type, converter)
|
@@ -23,6 +25,14 @@ module Asciidoctor
|
|
23
25
|
@converter.supported_formats
|
24
26
|
end
|
25
27
|
|
28
|
+
def collect_options(source)
|
29
|
+
options = {}
|
30
|
+
|
31
|
+
options[:max_get_size] = source.global_attr('max-get-size', DEFAULT_MAX_GET_SIZE).to_i
|
32
|
+
|
33
|
+
options
|
34
|
+
end
|
35
|
+
|
26
36
|
def convert(source, format, options)
|
27
37
|
code = source.code
|
28
38
|
|
@@ -41,37 +51,49 @@ module Asciidoctor
|
|
41
51
|
encoded = Base64.urlsafe_encode64(compressed)
|
42
52
|
data = '0A' + encoded
|
43
53
|
|
44
|
-
path = uri.path
|
54
|
+
path = uri.path.dup
|
45
55
|
path << '/' unless path.end_with? '/'
|
46
56
|
path << format.to_s
|
47
|
-
path << '/' << data
|
48
|
-
uri.path = path
|
49
57
|
when :kroki_io
|
50
58
|
compressed = Zlib.deflate(code, Zlib::BEST_COMPRESSION)
|
51
59
|
data = Base64.urlsafe_encode64(compressed)
|
52
60
|
|
53
|
-
path = uri.path
|
61
|
+
path = uri.path.dup
|
54
62
|
path << '/' unless path.end_with? '/'
|
55
63
|
path << source.diagram_type.to_s
|
56
64
|
path << '/' << format.to_s
|
57
|
-
path << '/' << data
|
58
|
-
uri.path = path
|
59
65
|
else
|
60
66
|
raise "Unsupported server type: " + @type
|
61
67
|
end
|
62
68
|
|
63
|
-
|
69
|
+
get_path = path.dup << '/' << data
|
70
|
+
|
71
|
+
if get_path.length > options[:max_get_size]
|
72
|
+
uri.path = path
|
73
|
+
get_uri(uri, code, 'text/plain; charset=utf-8')
|
74
|
+
else
|
75
|
+
uri.path = get_path
|
76
|
+
get_uri(uri)
|
77
|
+
end
|
64
78
|
end
|
65
79
|
|
66
80
|
private
|
67
81
|
|
68
|
-
def get_uri(uri, attempt = 1)
|
82
|
+
def get_uri(uri, post_data = nil, post_content_type = nil, attempt = 1)
|
69
83
|
if attempt >= 10
|
70
84
|
raise "Too many redirects"
|
71
85
|
end
|
72
86
|
|
87
|
+
if post_data.nil?
|
88
|
+
request = Net::HTTP::Get.new(uri.path)
|
89
|
+
else
|
90
|
+
request = Net::HTTP::Post.new(uri.path)
|
91
|
+
request.body = post_data
|
92
|
+
request.set_content_type(post_content_type) if post_content_type
|
93
|
+
end
|
94
|
+
|
73
95
|
Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme.downcase == 'https') do |http|
|
74
|
-
response = http.
|
96
|
+
response = http.request(request)
|
75
97
|
case response
|
76
98
|
when Net::HTTPSuccess
|
77
99
|
response.body
|
@@ -79,10 +101,12 @@ module Asciidoctor
|
|
79
101
|
location = response['Location']
|
80
102
|
new_uri = URI.parse(location)
|
81
103
|
if new_uri.relative?
|
82
|
-
|
104
|
+
resolved_uri = uri + location
|
83
105
|
else
|
84
|
-
|
106
|
+
resolved_uri = new_uri
|
85
107
|
end
|
108
|
+
|
109
|
+
get_uri(resolved_uri, post_data, post_content_type, attempt + 1)
|
86
110
|
else
|
87
111
|
response.value
|
88
112
|
end
|
data/spec/a2s_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
A2S_CODE = <<-eos
|
4
4
|
.--. .---. .---. .---. .---. .---. .---.
|
5
5
|
| | OS API '---' '---' '---' '---' '---' '---'
|
6
6
|
v | | | | | | |
|
@@ -21,9 +21,9 @@ code = <<-eos
|
|
21
21
|
eos
|
22
22
|
|
23
23
|
describe Asciidoctor::Diagram::AsciiToSvgBlockMacroProcessor do
|
24
|
-
include_examples "block_macro", :a2s,
|
24
|
+
include_examples "block_macro", :a2s, A2S_CODE, [:svg]
|
25
25
|
end
|
26
26
|
|
27
27
|
describe Asciidoctor::Diagram::AsciiToSvgBlockProcessor do
|
28
|
-
include_examples "block", :svgbob,
|
28
|
+
include_examples "block", :svgbob, A2S_CODE, [:svg]
|
29
29
|
end
|
data/spec/blockdiag_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
BLOCKDIAG_CODE = <<-eos
|
4
4
|
blockdiag {
|
5
5
|
A -> B -> C -> D;
|
6
6
|
A -> E -> F -> G;
|
@@ -8,9 +8,9 @@ blockdiag {
|
|
8
8
|
eos
|
9
9
|
|
10
10
|
describe Asciidoctor::Diagram::BlockDiagBlockMacroProcessor do
|
11
|
-
include_examples "block_macro", :blockdiag,
|
11
|
+
include_examples "block_macro", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
|
12
12
|
end
|
13
13
|
|
14
14
|
describe Asciidoctor::Diagram::BlockDiagBlockProcessor do
|
15
|
-
include_examples "block", :blockdiag,
|
15
|
+
include_examples "block", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
|
16
16
|
end
|
data/spec/bpmn_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
BPNM_CODE = <<EOF
|
4
4
|
<?xml version="1.0" encoding="UTF-8"?>
|
5
5
|
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0zt4mn9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="5.1.2">
|
6
6
|
<bpmn:process id="Process_081h9u7" isExecutable="false">
|
@@ -48,9 +48,9 @@ code = <<EOF
|
|
48
48
|
EOF
|
49
49
|
|
50
50
|
describe Asciidoctor::Diagram::BpmnBlockMacroProcessor do
|
51
|
-
include_examples "block_macro", :bpmn,
|
51
|
+
include_examples "block_macro", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
|
52
52
|
end
|
53
53
|
|
54
54
|
describe Asciidoctor::Diagram::BpmnBlockProcessor do
|
55
|
-
include_examples "block", :bpmn,
|
55
|
+
include_examples "block", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
|
56
56
|
end
|
data/spec/bytefield_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
BYTEFIELD_CODE = <<-eos
|
4
4
|
;; This the source for the sample diagram illustrated in the project Read Me.
|
5
5
|
|
6
6
|
;; Some nice default background colors, used to distinguish header sections.
|
@@ -84,9 +84,9 @@ code = <<-eos
|
|
84
84
|
eos
|
85
85
|
|
86
86
|
describe Asciidoctor::Diagram::BytefieldBlockMacroProcessor do
|
87
|
-
include_examples "block_macro", :bytefield,
|
87
|
+
include_examples "block_macro", :bytefield, BYTEFIELD_CODE, [:svg]
|
88
88
|
end
|
89
89
|
|
90
90
|
describe Asciidoctor::Diagram::BytefieldBlockProcessor do
|
91
|
-
include_examples "block", :bytefield,
|
91
|
+
include_examples "block", :bytefield, BYTEFIELD_CODE, [:svg]
|
92
92
|
end
|
data/spec/diagrams_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
DIAGRAMS_CODE = <<-eos
|
4
4
|
from diagrams import Diagram
|
5
5
|
from diagrams.aws.compute import EC2
|
6
6
|
from diagrams.aws.database import RDS
|
@@ -15,9 +15,9 @@ with Diagram("Grouped Workers", show=False, direction="TB"):
|
|
15
15
|
eos
|
16
16
|
|
17
17
|
describe Asciidoctor::Diagram::DiagramsBlockMacroProcessor do
|
18
|
-
include_examples "block_macro", :diagrams,
|
18
|
+
include_examples "block_macro", :diagrams, DIAGRAMS_CODE, [:png, :svg]
|
19
19
|
end
|
20
20
|
|
21
21
|
describe Asciidoctor::Diagram::DiagramsBlockProcessor do
|
22
|
-
include_examples "block", :diagrams,
|
22
|
+
include_examples "block", :diagrams, DIAGRAMS_CODE, [:png, :svg]
|
23
23
|
end
|
data/spec/ditaa_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
DITAA_CODE = <<-eos
|
4
4
|
+--------+ +-------+ +-------+
|
5
5
|
| | --+ ditaa +--> | |
|
6
6
|
| Text | +-------+ |diagram|
|
@@ -13,11 +13,11 @@ code = <<-eos
|
|
13
13
|
eos
|
14
14
|
|
15
15
|
describe Asciidoctor::Diagram::DitaaBlockMacroProcessor do
|
16
|
-
include_examples "block_macro", :ditaa,
|
16
|
+
include_examples "block_macro", :ditaa, DITAA_CODE, [:png, :svg]
|
17
17
|
end
|
18
18
|
|
19
19
|
describe Asciidoctor::Diagram::DitaaBlockProcessor do
|
20
|
-
include_examples "block", :ditaa,
|
20
|
+
include_examples "block", :ditaa, DITAA_CODE, [:png, :svg]
|
21
21
|
|
22
22
|
it "should support ditaa options as attributes" do
|
23
23
|
doc = <<-eos
|
data/spec/dpic_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
DPIC_CODE = <<-eos
|
4
4
|
arrow "$u$" above
|
5
5
|
S: circle rad 10/72.27 # 10 pt
|
6
6
|
line right 0.35
|
@@ -11,9 +11,9 @@ G: box "$G(s)$"
|
|
11
11
|
eos
|
12
12
|
|
13
13
|
describe Asciidoctor::Diagram::DpicBlockMacroProcessor, :broken_on_windows do
|
14
|
-
include_examples "block_macro", :dpic,
|
14
|
+
include_examples "block_macro", :dpic, DPIC_CODE, [:svg]
|
15
15
|
end
|
16
16
|
|
17
17
|
describe Asciidoctor::Diagram::DpicBlockProcessor, :broken_on_windows do
|
18
|
-
include_examples "block", :dpic,
|
18
|
+
include_examples "block", :dpic, DPIC_CODE, [:svg]
|
19
19
|
end
|
data/spec/erd_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
ERD_CODE = <<-eos
|
4
4
|
title {label: "nfldb Entity-Relationship diagram (condensed)", size: "20"}
|
5
5
|
|
6
6
|
# Entities
|
@@ -84,9 +84,9 @@ player 1--* play_player
|
|
84
84
|
eos
|
85
85
|
|
86
86
|
describe Asciidoctor::Diagram::ErdBlockMacroProcessor, :broken_on_windows do
|
87
|
-
include_examples "block_macro", :erd,
|
87
|
+
include_examples "block_macro", :erd, ERD_CODE, [:png, :svg]
|
88
88
|
end
|
89
89
|
|
90
90
|
describe Asciidoctor::Diagram::ErdBlockProcessor, :broken_on_windows do
|
91
|
-
include_examples "block", :erd,
|
91
|
+
include_examples "block", :erd, ERD_CODE, [:png, :svg]
|
92
92
|
end
|
data/spec/gnuplot_spec.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
GNUPLOT_CODE = <<-eos
|
4
4
|
plot [0:5][0:20] x**2 title 'O(n^2)'
|
5
5
|
eos
|
6
6
|
|
7
7
|
describe Asciidoctor::Diagram::GnuplotBlockMacroProcessor do
|
8
|
-
include_examples "block_macro", :gnuplot,
|
8
|
+
include_examples "block_macro", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif, :txt]
|
9
9
|
end
|
10
10
|
|
11
11
|
describe Asciidoctor::Diagram::GnuplotBlockProcessor do
|
12
|
-
include_examples "block", :gnuplot,
|
12
|
+
include_examples "block", :gnuplot, GNUPLOT_CODE, [:png, :svg, :gif, :txt]
|
13
13
|
|
14
14
|
it "should generate images with user defined size" do
|
15
15
|
doc = <<-eos
|
@@ -20,7 +20,7 @@ Doc Writer <doc@example.com>
|
|
20
20
|
|
21
21
|
[gnuplot, format="png",width="800", height="600"]
|
22
22
|
----
|
23
|
-
#{
|
23
|
+
#{GNUPLOT_CODE}
|
24
24
|
----
|
25
25
|
eos
|
26
26
|
|
@@ -50,7 +50,7 @@ Doc Writer <doc@example.com>
|
|
50
50
|
|
51
51
|
[gnuplot, format="png", crop=false, transparent=false]
|
52
52
|
----
|
53
|
-
#{
|
53
|
+
#{GNUPLOT_CODE}
|
54
54
|
----
|
55
55
|
eos
|
56
56
|
|
@@ -80,7 +80,7 @@ Doc Writer <doc@example.com>
|
|
80
80
|
|
81
81
|
[gnuplot, format="png", crop=true, transparent=true]
|
82
82
|
----
|
83
|
-
#{
|
83
|
+
#{GNUPLOT_CODE}
|
84
84
|
----
|
85
85
|
eos
|
86
86
|
|
@@ -110,7 +110,7 @@ Doc Writer <doc@example.com>
|
|
110
110
|
|
111
111
|
[gnuplot, format="png", font="Arial"]
|
112
112
|
----
|
113
|
-
#{
|
113
|
+
#{GNUPLOT_CODE}
|
114
114
|
----
|
115
115
|
eos
|
116
116
|
|
@@ -140,7 +140,7 @@ Doc Writer <doc@example.com>
|
|
140
140
|
|
141
141
|
[gnuplot, format="png", font="Arial,11"]
|
142
142
|
----
|
143
|
-
#{
|
143
|
+
#{GNUPLOT_CODE}
|
144
144
|
----
|
145
145
|
eos
|
146
146
|
|
@@ -170,7 +170,7 @@ Doc Writer <doc@example.com>
|
|
170
170
|
|
171
171
|
[gnuplot, format="png", font="Arial", scale="0.5"]
|
172
172
|
----
|
173
|
-
#{
|
173
|
+
#{GNUPLOT_CODE}
|
174
174
|
----
|
175
175
|
eos
|
176
176
|
|
@@ -200,7 +200,7 @@ Doc Writer <doc@example.com>
|
|
200
200
|
|
201
201
|
[gnuplot, format="png", background="red"]
|
202
202
|
----
|
203
|
-
#{
|
203
|
+
#{GNUPLOT_CODE}
|
204
204
|
----
|
205
205
|
eos
|
206
206
|
|
data/spec/graphviz_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
DOT_CODE = <<-eos
|
4
4
|
digraph foo {
|
5
5
|
node [style=rounded]
|
6
6
|
node1 [shape=box]
|
@@ -12,9 +12,9 @@ digraph foo {
|
|
12
12
|
eos
|
13
13
|
|
14
14
|
describe Asciidoctor::Diagram::GraphvizBlockMacroProcessor do
|
15
|
-
include_examples "block_macro", :graphviz,
|
15
|
+
include_examples "block_macro", :graphviz, DOT_CODE, [:png, :svg]
|
16
16
|
end
|
17
17
|
|
18
18
|
describe Asciidoctor::Diagram::GraphvizBlockProcessor do
|
19
|
-
include_examples "block", :graphviz,
|
19
|
+
include_examples "block", :graphviz, DOT_CODE, [:png, :svg]
|
20
20
|
end
|
data/spec/lilypond_spec.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
LILYPOND_CODE = <<-eos
|
4
4
|
\\relative c' { f d f a d f e d cis a cis e a g f e }
|
5
5
|
eos
|
6
6
|
|
7
7
|
describe Asciidoctor::Diagram::LilypondBlockMacroProcessor do
|
8
|
-
include_examples "block_macro", :lilypond,
|
8
|
+
include_examples "block_macro", :lilypond, LILYPOND_CODE, [:png]
|
9
9
|
end
|
10
10
|
|
11
11
|
describe Asciidoctor::Diagram::LilypondBlockProcessor do
|
12
|
-
include_examples "block", :lilypond,
|
12
|
+
include_examples "block", :lilypond, LILYPOND_CODE, [:png]
|
13
13
|
end
|
data/spec/mermaid_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
MERMAID_CODE = <<-eos
|
4
4
|
graph LR
|
5
5
|
A[Square Rect] -- Link text --> B((Circle))
|
6
6
|
A --> C(Round Rect)
|
@@ -9,7 +9,7 @@ graph LR
|
|
9
9
|
eos
|
10
10
|
|
11
11
|
describe Asciidoctor::Diagram::MermaidBlockMacroProcessor do
|
12
|
-
include_examples "block_macro", :mermaid,
|
12
|
+
include_examples "block_macro", :mermaid, MERMAID_CODE, [:png, :svg]
|
13
13
|
|
14
14
|
it "should respect the sequenceConfig attribute" do
|
15
15
|
seq_diag = <<-eos
|
@@ -135,7 +135,7 @@ mermaid::mermaid.txt[target="without_config"]
|
|
135
135
|
end
|
136
136
|
|
137
137
|
describe Asciidoctor::Diagram::MermaidBlockProcessor do
|
138
|
-
include_examples "block", :mermaid,
|
138
|
+
include_examples "block", :mermaid, MERMAID_CODE, [:png, :svg]
|
139
139
|
|
140
140
|
it "should work with kroki.io" do
|
141
141
|
doc = <<-eos
|
data/spec/msc_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
MSC_CODE = <<-eos
|
4
4
|
# MSC for some fictional process
|
5
5
|
msc {
|
6
6
|
hscale = "2";
|
@@ -25,9 +25,9 @@ msc {
|
|
25
25
|
eos
|
26
26
|
|
27
27
|
describe Asciidoctor::Diagram::MscBlockMacroProcessor do
|
28
|
-
include_examples "block_macro", :msc,
|
28
|
+
include_examples "block_macro", :msc, MSC_CODE, [:png, :svg]
|
29
29
|
end
|
30
30
|
|
31
31
|
describe Asciidoctor::Diagram::MscBlockProcessor do
|
32
|
-
include_examples "block", :msc,
|
32
|
+
include_examples "block", :msc, MSC_CODE, [:png, :svg]
|
33
33
|
end
|
data/spec/nomnoml_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
NOMNOML_CODE = <<-eos
|
4
4
|
[Pirate
|
5
5
|
[beard]--[parrot]
|
6
6
|
[beard]-:>[foul mouth]
|
@@ -24,9 +24,9 @@ code = <<-eos
|
|
24
24
|
eos
|
25
25
|
|
26
26
|
describe Asciidoctor::Diagram::NomnomlBlockMacroProcessor do
|
27
|
-
include_examples "block_macro", :nomnoml,
|
27
|
+
include_examples "block_macro", :nomnoml, NOMNOML_CODE, [:svg]
|
28
28
|
end
|
29
29
|
|
30
30
|
describe Asciidoctor::Diagram::NomnomlBlockProcessor do
|
31
|
-
include_examples "block", :nomnoml,
|
31
|
+
include_examples "block", :nomnoml, NOMNOML_CODE, [:svg]
|
32
32
|
end
|
data/spec/pikchr_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
PIKCHR_CODE = <<-eos
|
4
4
|
# Change from the original:
|
5
5
|
# * Expand the macro by hand, as Pikchr does not support
|
6
6
|
# macros
|
@@ -43,11 +43,11 @@ box invis wid 2*boxwid "ndtable:" with .e at Start.w
|
|
43
43
|
eos
|
44
44
|
|
45
45
|
describe Asciidoctor::Diagram::PikchrBlockMacroProcessor, :broken_on_windows do
|
46
|
-
include_examples "block_macro", :pikchr,
|
46
|
+
include_examples "block_macro", :pikchr, PIKCHR_CODE, [:svg]
|
47
47
|
end
|
48
48
|
|
49
49
|
describe Asciidoctor::Diagram::PikchrBlockProcessor, :broken_on_windows do
|
50
|
-
include_examples "block", :pikchr,
|
50
|
+
include_examples "block", :pikchr, PIKCHR_CODE, [:svg]
|
51
51
|
|
52
52
|
it "should report syntax errors" do
|
53
53
|
doc = <<-eos
|
data/spec/plantuml_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
PLANTUML_CODE = <<-eos
|
4
4
|
User -> (Start)
|
5
5
|
User --> (Use the application) : Label
|
6
6
|
|
@@ -8,7 +8,7 @@ User --> (Use the application) : Label
|
|
8
8
|
eos
|
9
9
|
|
10
10
|
describe Asciidoctor::Diagram::PlantUmlBlockMacroProcessor do
|
11
|
-
include_examples "block_macro", :plantuml,
|
11
|
+
include_examples "block_macro", :plantuml, PLANTUML_CODE, [:png, :svg, :txt]
|
12
12
|
|
13
13
|
it 'should support substitutions in diagram code' do
|
14
14
|
code = <<-eos
|
@@ -156,7 +156,39 @@ plantuml::dir/plantuml.txt[format="svg", subs=attributes+]
|
|
156
156
|
end
|
157
157
|
|
158
158
|
describe Asciidoctor::Diagram::PlantUmlBlockProcessor do
|
159
|
-
include_examples "block", :plantuml,
|
159
|
+
include_examples "block", :plantuml, PLANTUML_CODE, [:png, :svg, :txt]
|
160
|
+
|
161
|
+
it "should work with plantuml.com" do
|
162
|
+
doc = <<-eos
|
163
|
+
= Hello, kroki!
|
164
|
+
:diagram-server-url: http://plantuml.com/plantuml
|
165
|
+
:diagram-server-type: plantuml
|
166
|
+
Doc Writer <doc@example.com>
|
167
|
+
|
168
|
+
== First Section
|
169
|
+
|
170
|
+
[plantuml, format=svg]
|
171
|
+
----
|
172
|
+
#{PLANTUML_CODE}
|
173
|
+
----
|
174
|
+
eos
|
175
|
+
|
176
|
+
d = load_asciidoc doc
|
177
|
+
expect(d).to_not be_nil
|
178
|
+
|
179
|
+
b = d.find { |bl| bl.context == :image }
|
180
|
+
expect(b).to_not be_nil
|
181
|
+
|
182
|
+
expect(b.content_model).to eq :empty
|
183
|
+
|
184
|
+
target = b.attributes['target']
|
185
|
+
expect(target).to_not be_nil
|
186
|
+
expect(target).to match(/\.svg$/)
|
187
|
+
expect(File.exist?(target)).to be true
|
188
|
+
|
189
|
+
expect(b.attributes['width']).to_not be_nil
|
190
|
+
expect(b.attributes['height']).to_not be_nil
|
191
|
+
end
|
160
192
|
|
161
193
|
it 'should use plantuml configuration when specified as a document attribute' do
|
162
194
|
doc = <<-eos
|
data/spec/shaape_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
SHAAPE_CODE = <<-eos
|
4
4
|
+-->
|
5
5
|
/ /\
|
6
6
|
>---+---->+ +
|
@@ -8,9 +8,9 @@ code = <<-eos
|
|
8
8
|
eos
|
9
9
|
|
10
10
|
describe Asciidoctor::Diagram::ShaapeBlockMacroProcessor, :broken_on_osx, :broken_on_github, :broken_on_windows do
|
11
|
-
include_examples "block_macro", :shaape,
|
11
|
+
include_examples "block_macro", :shaape, SHAAPE_CODE, [:png, :svg]
|
12
12
|
end
|
13
13
|
|
14
14
|
describe Asciidoctor::Diagram::ShaapeBlockProcessor, :broken_on_osx, :broken_on_github, :broken_on_windows do
|
15
|
-
include_examples "block", :shaape,
|
15
|
+
include_examples "block", :shaape, SHAAPE_CODE, [:png, :svg]
|
16
16
|
end
|
data/spec/smcat_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
SMCAT_CODE = <<-eos
|
4
4
|
initial,
|
5
5
|
doing: entry/ write unit test
|
6
6
|
do/ write code
|
@@ -18,9 +18,9 @@ testing => final : test ok;
|
|
18
18
|
eos
|
19
19
|
|
20
20
|
describe Asciidoctor::Diagram::SmcatBlockMacroProcessor do
|
21
|
-
include_examples "block_macro", :smcat,
|
21
|
+
include_examples "block_macro", :smcat, SMCAT_CODE, [:svg]
|
22
22
|
end
|
23
23
|
|
24
24
|
describe Asciidoctor::Diagram::SmcatBlockProcessor do
|
25
|
-
include_examples "block", :smcat,
|
25
|
+
include_examples "block", :smcat, SMCAT_CODE, [:svg]
|
26
26
|
end
|
data/spec/svgbob_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
SVGBOB_CODE = <<-eos
|
4
4
|
.--. .---. .---. .---. .---. .---. .---.
|
5
5
|
| | OS API '---' '---' '---' '---' '---' '---'
|
6
6
|
v | | | | | | |
|
@@ -21,9 +21,9 @@ code = <<-eos
|
|
21
21
|
eos
|
22
22
|
|
23
23
|
describe Asciidoctor::Diagram::SvgBobBlockMacroProcessor do
|
24
|
-
include_examples "block_macro", :svgbob,
|
24
|
+
include_examples "block_macro", :svgbob, SVGBOB_CODE, [:svg]
|
25
25
|
end
|
26
26
|
|
27
27
|
describe Asciidoctor::Diagram::SvgBobBlockProcessor do
|
28
|
-
include_examples "block", :svgbob,
|
28
|
+
include_examples "block", :svgbob, SVGBOB_CODE, [:svg]
|
29
29
|
end
|
data/spec/symbolator_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
SYMBOLATOR_CODE = <<-eos
|
4
4
|
library ieee;
|
5
5
|
use ieee.std_logic_1164.all;
|
6
6
|
|
@@ -15,9 +15,9 @@ end package;
|
|
15
15
|
eos
|
16
16
|
|
17
17
|
describe Asciidoctor::Diagram::SymbolatorBlockMacroProcessor, :broken_on_windows do
|
18
|
-
include_examples "block_macro", :symbolator,
|
18
|
+
include_examples "block_macro", :symbolator, SYMBOLATOR_CODE, [:png, :svg, :pdf]
|
19
19
|
end
|
20
20
|
|
21
21
|
describe Asciidoctor::Diagram::SymbolatorBlockProcessor, :broken_on_windows do
|
22
|
-
include_examples "block", :symbolator,
|
22
|
+
include_examples "block", :symbolator, SYMBOLATOR_CODE, [:png, :svg, :pdf]
|
23
23
|
end
|
data/spec/syntrax_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
SYNTRAX_CODE = <<-eos
|
4
4
|
indentstack(10,
|
5
5
|
line(opt('-'), choice('0', line('1-9', loop(None, '0-9'))),
|
6
6
|
opt('.', loop('0-9', None))),
|
@@ -10,9 +10,9 @@ indentstack(10,
|
|
10
10
|
eos
|
11
11
|
|
12
12
|
describe Asciidoctor::Diagram::SyntraxBlockMacroProcessor, :broken_on_windows do
|
13
|
-
include_examples "block_macro", :syntrax,
|
13
|
+
include_examples "block_macro", :syntrax, SYNTRAX_CODE, [:png, :svg]
|
14
14
|
end
|
15
15
|
|
16
16
|
describe Asciidoctor::Diagram::SyntraxBlockProcessor, :broken_on_windows do
|
17
|
-
include_examples "block", :syntrax,
|
17
|
+
include_examples "block", :syntrax, SYNTRAX_CODE, [:png, :svg]
|
18
18
|
end
|
data/spec/tikz_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
TIKZ_CODE = <<-'eos'
|
4
4
|
\begin{tikzpicture}[font=\LARGE]
|
5
5
|
|
6
6
|
% Figure parameters (tta and k needs to have the same sign)
|
@@ -99,14 +99,14 @@ code = <<-'eos'
|
|
99
99
|
eos
|
100
100
|
|
101
101
|
describe Asciidoctor::Diagram::TikZBlockMacroProcessor, :broken_on_windows do
|
102
|
-
include_examples "block_macro", :tikz,
|
102
|
+
include_examples "block_macro", :tikz, TIKZ_CODE, [:pdf]
|
103
103
|
end
|
104
104
|
|
105
105
|
describe Asciidoctor::Diagram::TikZBlockProcessor, :broken_on_windows do
|
106
|
-
include_examples "block", :tikz,
|
106
|
+
include_examples "block", :tikz, TIKZ_CODE, [:pdf]
|
107
107
|
|
108
108
|
it "should support the preamble attribute" do
|
109
|
-
File.write("tikz.txt",
|
109
|
+
File.write("tikz.txt", TIKZ_CODE)
|
110
110
|
|
111
111
|
doc = <<'eos'
|
112
112
|
= Hello, tikz!
|
data/spec/umlet_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
CODE = <<-eos
|
4
4
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
5
5
|
<diagram program="umlet" version="14.2">
|
6
6
|
<zoom_level>10</zoom_level>
|
@@ -21,9 +21,9 @@ eos
|
|
21
21
|
|
22
22
|
|
23
23
|
describe Asciidoctor::Diagram::UmletBlockMacroProcessor do
|
24
|
-
include_examples "block_macro", :umlet,
|
24
|
+
include_examples "block_macro", :umlet, CODE, [:svg]
|
25
25
|
end
|
26
26
|
|
27
27
|
describe Asciidoctor::Diagram::UmletBlockProcessor do
|
28
|
-
include_examples "block", :umlet,
|
28
|
+
include_examples "block", :umlet, CODE, [:svg]
|
29
29
|
end
|
data/spec/vega_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
VEGA_CODE = <<-eos
|
4
4
|
{
|
5
5
|
"$schema": "https://vega.github.io/schema/vega/v3.json",
|
6
6
|
"width": 400,
|
@@ -98,7 +98,7 @@ vega_code = <<-eos
|
|
98
98
|
}
|
99
99
|
eos
|
100
100
|
|
101
|
-
|
101
|
+
VEGALITE_CODE = <<-eos
|
102
102
|
{
|
103
103
|
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
|
104
104
|
"description": "A simple bar chart with embedded data.",
|
@@ -118,11 +118,11 @@ vegalite_code = <<-eos
|
|
118
118
|
eos
|
119
119
|
|
120
120
|
describe Asciidoctor::Diagram::VegaBlockMacroProcessor, :broken_on_windows do
|
121
|
-
include_examples "block_macro", :vega,
|
122
|
-
# include_examples "block_macro", :vegalite,
|
121
|
+
include_examples "block_macro", :vega, VEGA_CODE, [:svg]
|
122
|
+
# include_examples "block_macro", :vegalite, VEGALITE_CODE, [:svg]
|
123
123
|
end
|
124
124
|
|
125
125
|
describe Asciidoctor::Diagram::VegaBlockProcessor, :broken_on_windows do
|
126
|
-
include_examples "block", :vega,
|
127
|
-
# include_examples "block", :vegalite,
|
126
|
+
include_examples "block", :vega, VEGA_CODE, [:svg]
|
127
|
+
# include_examples "block", :vegalite, VEGALITE_CODE, [:svg]
|
128
128
|
end
|
data/spec/wavedrom_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
WAVEDROM_CODE = <<-eos
|
4
4
|
{ signal : [
|
5
5
|
{ name: "clk", wave: "p......" },
|
6
6
|
{ name: "bus", wave: "x.34.5x", data: "head body tail" },
|
@@ -9,9 +9,9 @@ code = <<-eos
|
|
9
9
|
eos
|
10
10
|
|
11
11
|
describe Asciidoctor::Diagram::WavedromBlockMacroProcessor, :broken_on_windows do
|
12
|
-
include_examples "block_macro", :wavedrom,
|
12
|
+
include_examples "block_macro", :wavedrom, WAVEDROM_CODE, [:png, :svg]
|
13
13
|
end
|
14
14
|
|
15
15
|
describe Asciidoctor::Diagram::WavedromBlockProcessor, :broken_on_windows do
|
16
|
-
include_examples "block", :wavedrom,
|
16
|
+
include_examples "block", :wavedrom, WAVEDROM_CODE, [:png, :svg]
|
17
17
|
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.1.
|
4
|
+
version: 2.1.2
|
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: 2021-03
|
11
|
+
date: 2021-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.1.2
|
291
291
|
signing_key:
|
292
292
|
specification_version: 4
|
293
293
|
summary: A family of Asciidoctor extensions that generate images from a broad range
|