asciidoctor-diagram 2.2.11 → 2.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +7 -0
  3. data/lib/asciidoctor-diagram/plantuml/converter.rb +1 -0
  4. data/lib/asciidoctor-diagram/structurizr/renderers.rb +5 -0
  5. data/lib/asciidoctor-diagram/version.rb +1 -1
  6. metadata +3 -130
  7. data/Rakefile +0 -9
  8. data/docs/antora.yml +0 -5
  9. data/docs/modules/ROOT/images/a2s.svg +0 -44
  10. data/docs/modules/ROOT/images/actdiag.png +0 -0
  11. data/docs/modules/ROOT/images/asciidoctor-diagram-classes.png +0 -0
  12. data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
  13. data/docs/modules/ROOT/images/barcode.png +0 -0
  14. data/docs/modules/ROOT/images/barcode2.png +0 -0
  15. data/docs/modules/ROOT/images/blockdiag.png +0 -0
  16. data/docs/modules/ROOT/images/d2.png +0 -0
  17. data/docs/modules/ROOT/images/lilypond.png +0 -0
  18. data/docs/modules/ROOT/images/penrose.png +0 -0
  19. data/docs/modules/ROOT/nav.adoc +0 -41
  20. data/docs/modules/ROOT/pages/blocks.adoc +0 -140
  21. data/docs/modules/ROOT/pages/diagram_types/a2s.adoc +0 -47
  22. data/docs/modules/ROOT/pages/diagram_types/actdiag.adoc +0 -46
  23. data/docs/modules/ROOT/pages/diagram_types/barcode.adoc +0 -72
  24. data/docs/modules/ROOT/pages/diagram_types/blockdiag.adoc +0 -38
  25. data/docs/modules/ROOT/pages/diagram_types/bpmn.adoc +0 -21
  26. data/docs/modules/ROOT/pages/diagram_types/bytefield.adoc +0 -16
  27. data/docs/modules/ROOT/pages/diagram_types/d2.adoc +0 -43
  28. data/docs/modules/ROOT/pages/diagram_types/dbml.adoc +0 -16
  29. data/docs/modules/ROOT/pages/diagram_types/diagrams.adoc +0 -20
  30. data/docs/modules/ROOT/pages/diagram_types/ditaa.adoc +0 -31
  31. data/docs/modules/ROOT/pages/diagram_types/dpic.adoc +0 -16
  32. data/docs/modules/ROOT/pages/diagram_types/erd.adoc +0 -17
  33. data/docs/modules/ROOT/pages/diagram_types/gnuplot.adoc +0 -27
  34. data/docs/modules/ROOT/pages/diagram_types/graphviz.adoc +0 -21
  35. data/docs/modules/ROOT/pages/diagram_types/lilypond.adoc +0 -27
  36. data/docs/modules/ROOT/pages/diagram_types/meme.adoc +0 -34
  37. data/docs/modules/ROOT/pages/diagram_types/mermaid.adoc +0 -28
  38. data/docs/modules/ROOT/pages/diagram_types/msc.adoc +0 -23
  39. data/docs/modules/ROOT/pages/diagram_types/nomnoml.adoc +0 -16
  40. data/docs/modules/ROOT/pages/diagram_types/nwdiag.adoc +0 -22
  41. data/docs/modules/ROOT/pages/diagram_types/penrose.adoc +0 -50
  42. data/docs/modules/ROOT/pages/diagram_types/pikchr.adoc +0 -16
  43. data/docs/modules/ROOT/pages/diagram_types/plantuml.adoc +0 -24
  44. data/docs/modules/ROOT/pages/diagram_types/seqdiag.adoc +0 -18
  45. data/docs/modules/ROOT/pages/diagram_types/shaape.adoc +0 -18
  46. data/docs/modules/ROOT/pages/diagram_types/smcat.adoc +0 -18
  47. data/docs/modules/ROOT/pages/diagram_types/structurizr.adoc +0 -29
  48. data/docs/modules/ROOT/pages/diagram_types/svgbob.adoc +0 -21
  49. data/docs/modules/ROOT/pages/diagram_types/symbolator.adoc +0 -19
  50. data/docs/modules/ROOT/pages/diagram_types/syntrax.adoc +0 -28
  51. data/docs/modules/ROOT/pages/diagram_types/tikz.adoc +0 -21
  52. data/docs/modules/ROOT/pages/diagram_types/umlet.adoc +0 -19
  53. data/docs/modules/ROOT/pages/diagram_types/vega.adoc +0 -28
  54. data/docs/modules/ROOT/pages/diagram_types/wavedrom.adoc +0 -17
  55. data/docs/modules/ROOT/pages/enabling.adoc +0 -25
  56. data/docs/modules/ROOT/pages/generate.adoc +0 -15
  57. data/docs/modules/ROOT/pages/index.adoc +0 -12
  58. data/docs/modules/ROOT/pages/installation.adoc +0 -32
  59. data/docs/modules/ROOT/pages/output.adoc +0 -19
  60. data/docs/modules/ROOT/partials/shared-attrs.adoc +0 -12
  61. data/docs/modules/ROOT/partials/uris.adoc +0 -48
  62. data/examples/Gemfile +0 -3
  63. data/examples/README.adoc +0 -18
  64. data/examples/design.adoc +0 -78
  65. data/examples/features.adoc +0 -189
  66. data/spec/a2s_spec.rb +0 -33
  67. data/spec/barcode_spec.rb +0 -176
  68. data/spec/blockdiag_spec.rb +0 -20
  69. data/spec/bpmn_spec.rb +0 -60
  70. data/spec/bytefield_spec.rb +0 -96
  71. data/spec/d2_spec.rb +0 -87
  72. data/spec/dbml_spec.rb +0 -32
  73. data/spec/diagrams_spec.rb +0 -27
  74. data/spec/ditaa_spec.rb +0 -191
  75. data/spec/dpic_spec.rb +0 -23
  76. data/spec/erd_spec.rb +0 -96
  77. data/spec/gnuplot_spec.rb +0 -229
  78. data/spec/graphviz_py_spec.rb +0 -33
  79. data/spec/graphviz_spec.rb +0 -24
  80. data/spec/lilypond_spec.rb +0 -17
  81. data/spec/man.jpg +0 -0
  82. data/spec/meme_spec.rb +0 -67
  83. data/spec/mermaid_spec.rb +0 -161
  84. data/spec/msc_spec.rb +0 -37
  85. data/spec/nomnoml_spec.rb +0 -36
  86. data/spec/pikchr_spec.rb +0 -73
  87. data/spec/plantuml_spec.rb +0 -800
  88. data/spec/shaape_spec.rb +0 -20
  89. data/spec/shared_examples.rb +0 -766
  90. data/spec/smcat_spec.rb +0 -30
  91. data/spec/structurizr_spec.rb +0 -41
  92. data/spec/svgbob_spec.rb +0 -33
  93. data/spec/symbolator_spec.rb +0 -27
  94. data/spec/syntrax_spec.rb +0 -22
  95. data/spec/test_helper_methods.rb +0 -118
  96. data/spec/tikz_spec.rb +0 -181
  97. data/spec/umlet_spec.rb +0 -32
  98. data/spec/vega_spec.rb +0 -133
  99. data/spec/wavedrom_spec.rb +0 -21
data/spec/barcode_spec.rb DELETED
@@ -1,176 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- BARCODES = {
4
- :bookland => '978-0-306-40615-7',
5
- :codabar => 'A123456A',
6
- :code25 => '123456',
7
- :code25iata => '123456',
8
- :code25interleaved => '123456',
9
- :code39 => '123456',
10
- :code93 => '123456',
11
- :code128 => '123456',
12
- :code128a => '123456',
13
- :code128b => '123456',
14
- :code128c => '123456',
15
- :ean8 => '0170725',
16
- :ean13 => '070071967072',
17
- :gs1_128 => '(FNC1)(SP)00(SP)12345678(SP)0000000001',
18
- :qrcode => 'http://github.com/',
19
- :upca => '12360105707',
20
- }
21
-
22
- describe Asciidoctor::Diagram::BarcodeBlockProcessor do
23
- BARCODES.each_pair do |type, code|
24
- it "should support #{type}" do
25
- doc = <<-eos
26
- = Hello, barby!
27
- Doc Writer <doc@example.com>
28
-
29
- == First Section
30
-
31
- [#{type},test,png,xdim=1,margin=10,height=100,foreground=darkgray,background=azure]
32
- ----
33
- #{code}
34
- ----
35
- eos
36
-
37
- d = load_asciidoc doc
38
- expect(d).to_not be_nil
39
-
40
- b = d.find { |bl| bl.context == :image }
41
- expect(b).to_not be_nil
42
-
43
- expect(b.content_model).to eq :empty
44
-
45
- target = b.attributes['target']
46
- expect(target).to_not be_nil
47
- expect(target).to match(/\.png$/)
48
- expect(File.exist?(target)).to be true
49
-
50
- expect(b.attributes['width']).to_not be_nil
51
- expect(b.attributes['height']).to_not be_nil
52
- end
53
- end
54
-
55
- it "should support complex QR codes" do
56
- doc = <<-eos
57
- = Hello, barby!
58
- Doc Writer <doc@example.com>
59
-
60
- == First Section
61
-
62
- [qrcode]
63
- ----
64
- BEGIN:VCARD
65
- VERSION:3.0
66
- N:Doe;John;;;
67
- FN:John Doe
68
- ORG:Example.com Inc.;
69
- TITLE:Imaginary test person
70
- EMAIL;type=INTERNET;type=WORK;type=pref:johnDoe@example.org
71
- TEL;type=WORK;type=pref:+1 617 555 1212
72
- TEL;type=WORK:+1 (617) 555-1234
73
- TEL;type=CELL:+1 781 555 1212
74
- TEL;type=HOME:+1 202 555 1212
75
- item1.ADR;type=WORK:;;2 Enterprise Avenue;Worktown;NY;01111;USA
76
- item1.X-ABADR:us
77
- item2.ADR;type=HOME;type=pref:;;3 Acacia Avenue;Hoemtown;MA;02222;USA
78
- item2.X-ABADR:us
79
- NOTE:John Doe has a long and varied history\, being documented on more police files that anyone else. Reports of his death are alas numerous.
80
- item3.URL;type=pref:http\://www.example/com/doe
81
- item3.X-ABLabel:_$!<HomePage>!$_
82
- item4.URL:http\://www.example.com/Joe/foaf.df
83
- item4.X-ABLabel:FOAF
84
- item5.X-ABRELATEDNAMES;type=pref:Jane Doe
85
- item5.X-ABLabel:_$!<Friend>!$_
86
- CATEGORIES:Work,Test group
87
- X-ABUID:5AD380FD-B2DE-4261-BA99-DE1D1DB52FBE\:ABPerson
88
- END:VCARD
89
- ----
90
- eos
91
-
92
- d = load_asciidoc doc
93
- expect(d).to_not be_nil
94
-
95
- b = d.find { |bl| bl.context == :image }
96
- expect(b).to_not be_nil
97
-
98
- expect(b.content_model).to eq :empty
99
-
100
- target = b.attributes['target']
101
- expect(target).to_not be_nil
102
- expect(target).to match(/\.svg$/)
103
- expect(File.exist?(target)).to be true
104
-
105
- expect(b.attributes['width']).to_not be_nil
106
- expect(b.attributes['height']).to_not be_nil
107
- end
108
- end
109
-
110
- describe Asciidoctor::Diagram::BarcodeBlockMacroProcessor do
111
- BARCODES.each_pair do |type, code|
112
- it "should support #{type}" do
113
- doc = <<-eos
114
- = Hello, barby!
115
- Doc Writer <doc@example.com>
116
-
117
- == First Section
118
-
119
- #{type}::#{code}[xdim=1,margin=10,height=100,foreground=darkgray,background=azure]
120
- eos
121
-
122
- d = load_asciidoc doc
123
- expect(d).to_not be_nil
124
-
125
- b = d.find { |bl| bl.context == :image }
126
- expect(b).to_not be_nil
127
-
128
- expect(b.content_model).to eq :empty
129
-
130
- target = b.attributes['target']
131
- expect(target).to_not be_nil
132
- expect(target).to match(/\.svg$/)
133
- expect(File.exist?(target)).to be true
134
-
135
- expect(b.attributes['width']).to_not be_nil
136
- expect(b.attributes['height']).to_not be_nil
137
- end
138
- end
139
- end
140
-
141
- describe Asciidoctor::Diagram::BarcodeInlineMacroProcessor do
142
- BARCODES.each_pair do |type, code|
143
- it "should support #{type}" do
144
- doc = <<-eos
145
- = Hello, barby!
146
- Doc Writer <doc@example.com>
147
-
148
- == First Section
149
-
150
- #{type}:#{code}[xdim=1,margin=10,height=100,foreground=darkgray,background=azure]
151
- eos
152
-
153
- d = load_asciidoc doc
154
- expect(d).to_not be_nil
155
-
156
- b = d.find { |bl| bl.context == :paragraph }
157
- expect(b).to_not be_nil
158
-
159
- output = b.convert
160
- img_match = /<img[^>]*>/.match(output)
161
- expect(img_match).to_not be_nil
162
- img = img_match.to_s
163
-
164
- src_match = /src="([^"]*)"/.match(img)
165
- expect(src_match).to_not be_nil
166
- src = src_match[1]
167
-
168
- expect(src).to_not be_nil
169
- expect(src).to match(/\.svg$/)
170
- expect(File.exist?(src)).to be true
171
-
172
- expect(/width="([^"]*)"/.match(img)).to_not be_nil
173
- expect(/height="([^"]*)"/.match(img)).to_not be_nil
174
- end
175
- end
176
- end
@@ -1,20 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- BLOCKDIAG_CODE = <<-eos
4
- blockdiag {
5
- A -> B -> C -> D;
6
- A -> E -> F -> G;
7
- }
8
- eos
9
-
10
- describe Asciidoctor::Diagram::BlockDiagInlineMacroProcessor do
11
- include_examples "inline_macro", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
12
- end
13
-
14
- describe Asciidoctor::Diagram::BlockDiagBlockMacroProcessor do
15
- include_examples "block_macro", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
16
- end
17
-
18
- describe Asciidoctor::Diagram::BlockDiagBlockProcessor do
19
- include_examples "block", :blockdiag, BLOCKDIAG_CODE, [:png, :svg, :pdf]
20
- end
data/spec/bpmn_spec.rb DELETED
@@ -1,60 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- BPNM_CODE = <<EOF
4
- <?xml version="1.0" encoding="UTF-8"?>
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
- <bpmn:process id="Process_081h9u7" isExecutable="false">
7
- <bpmn:startEvent id="StartEvent_00w25dz" name="Start">
8
- <bpmn:outgoing>SequenceFlow_11u0n1f</bpmn:outgoing>
9
- </bpmn:startEvent>
10
- <bpmn:task id="Task_0yx8j7s" name="Task">
11
- <bpmn:incoming>SequenceFlow_11u0n1f</bpmn:incoming>
12
- <bpmn:outgoing>SequenceFlow_104th5x</bpmn:outgoing>
13
- </bpmn:task>
14
- <bpmn:sequenceFlow id="SequenceFlow_11u0n1f" sourceRef="StartEvent_00w25dz" targetRef="Task_0yx8j7s" />
15
- <bpmn:endEvent id="EndEvent_0jxehtp" name="End">
16
- <bpmn:incoming>SequenceFlow_104th5x</bpmn:incoming>
17
- </bpmn:endEvent>
18
- <bpmn:sequenceFlow id="SequenceFlow_104th5x" sourceRef="Task_0yx8j7s" targetRef="EndEvent_0jxehtp" />
19
- </bpmn:process>
20
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
21
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_081h9u7">
22
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_00w25dz">
23
- <dc:Bounds x="156" y="81" width="36" height="36" />
24
- <bpmndi:BPMNLabel>
25
- <dc:Bounds x="162" y="124" width="24" height="14" />
26
- </bpmndi:BPMNLabel>
27
- </bpmndi:BPMNShape>
28
- <bpmndi:BPMNShape id="Task_0yx8j7s_di" bpmnElement="Task_0yx8j7s">
29
- <dc:Bounds x="250" y="59" width="100" height="80" />
30
- </bpmndi:BPMNShape>
31
- <bpmndi:BPMNEdge id="SequenceFlow_11u0n1f_di" bpmnElement="SequenceFlow_11u0n1f">
32
- <di:waypoint x="192" y="99" />
33
- <di:waypoint x="250" y="99" />
34
- </bpmndi:BPMNEdge>
35
- <bpmndi:BPMNShape id="EndEvent_0jxehtp_di" bpmnElement="EndEvent_0jxehtp">
36
- <dc:Bounds x="412" y="81" width="36" height="36" />
37
- <bpmndi:BPMNLabel>
38
- <dc:Bounds x="420" y="124" width="20" height="14" />
39
- </bpmndi:BPMNLabel>
40
- </bpmndi:BPMNShape>
41
- <bpmndi:BPMNEdge id="SequenceFlow_104th5x_di" bpmnElement="SequenceFlow_104th5x">
42
- <di:waypoint x="350" y="99" />
43
- <di:waypoint x="412" y="99" />
44
- </bpmndi:BPMNEdge>
45
- </bpmndi:BPMNPlane>
46
- </bpmndi:BPMNDiagram>
47
- </bpmn:definitions>
48
- EOF
49
-
50
- describe Asciidoctor::Diagram::BpmnInlineMacroProcessor do
51
- include_examples "inline_macro", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
52
- end
53
-
54
- describe Asciidoctor::Diagram::BpmnBlockMacroProcessor do
55
- include_examples "block_macro", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
56
- end
57
-
58
- describe Asciidoctor::Diagram::BpmnBlockProcessor do
59
- include_examples "block", :bpmn, BPNM_CODE, [:png, :svg, :pdf]
60
- end
@@ -1,96 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- BYTEFIELD_CODE = <<-eos
4
- ;; This the source for the sample diagram illustrated in the project Read Me.
5
-
6
- ;; Some nice default background colors, used to distinguish header sections.
7
- (defattrs :bg-green {:fill "#a0ffa0"})
8
- (defattrs :bg-yellow {:fill "#ffffa0"})
9
- (defattrs :bg-pink {:fill "#ffb0a0"})
10
- (defattrs :bg-cyan {:fill "#a0fafa"})
11
- (defattrs :bg-purple {:fill "#e4b5f7"})
12
-
13
- (defn draw-group-label-header
14
- "Creates a small borderless box used to draw the textual label headers
15
- used below the byte labels for remotedb message diagrams.
16
- Arguments are the number of colums to span and the text of the
17
- label."
18
- [span label]
19
- (draw-box (text label [:math {:font-size 12}]) {:span span
20
- :borders \#{}
21
- :height 14}))
22
-
23
- (defn draw-remotedb-header
24
- "Generates the byte and field labels and standard header fields of a
25
- request or response message for the remotedb database server with
26
- the specified kind and args values."
27
- [kind args]
28
- (draw-column-headers)
29
- (draw-group-label-header 5 "start")
30
- (draw-group-label-header 5 "TxID")
31
- (draw-group-label-header 3 "type")
32
- (draw-group-label-header 2 "args")
33
- (draw-group-label-header 1 "tags")
34
- (next-row 18)
35
-
36
- (draw-box 0x11 :bg-green)
37
- (draw-box 0x872349ae [{:span 4} :bg-green])
38
- (draw-box 0x11 :bg-yellow)
39
- (draw-box (text "TxID" :math) [{:span 4} :bg-yellow])
40
- (draw-box 0x10 :bg-pink)
41
- (draw-box (hex-text kind 4 :bold) [{:span 2} :bg-pink])
42
- (draw-box 0x0f :bg-cyan)
43
- (draw-box (hex-text args 2 :bold) :bg-cyan)
44
- (draw-box 0x14 :bg-purple)
45
-
46
- (draw-box (text "0000000c" :hex [[:plain {:font-weight "light" :font-size 16}] " (12)"])
47
- [{:span 4} :bg-purple])
48
- (draw-box (hex-text 6 2 :bold) [:box-first :bg-purple])
49
- (doseq [val [6 6 3 6 6 6 6 3]]
50
- (draw-box (hex-text val 2 :bold) [:box-related :bg-purple]))
51
- (doseq [val [0 0]]
52
- (draw-box val [:box-related :bg-purple]))
53
- (draw-box 0 [:box-last :bg-purple]))
54
-
55
- ;; Figure 48: Cue point response message.
56
-
57
- (draw-remotedb-header 0x4702 9)
58
-
59
- (draw-box 0x11)
60
- (draw-box 0x2104 {:span 4})
61
- (draw-box 0x11)
62
- (draw-box 0 {:span 4})
63
- (draw-box 0x11)
64
- (draw-box (text "length" [:math] [:sub 1]) {:span 4})
65
- (draw-box 0x14)
66
-
67
- (draw-box (text "length" [:math] [:sub 1]) {:span 4})
68
- (draw-gap "Cue and loop point bytes")
69
-
70
- (draw-box nil :box-below)
71
- (draw-box 0x11)
72
- (draw-box 0x36 {:span 4})
73
- (draw-box 0x11)
74
- (draw-box (text "num" [:math] [:sub "hot"]) {:span 4})
75
- (draw-box 0x11)
76
- (draw-box (text "num" [:math] [:sub "cue"]) {:span 4})
77
-
78
- (draw-box 0x11)
79
- (draw-box (text "length" [:math] [:sub 2]) {:span 4})
80
- (draw-box 0x14)
81
- (draw-box (text "length" [:math] [:sub 2]) {:span 4})
82
- (draw-gap "Unknown bytes" {:min-label-columns 6})
83
- (draw-bottom)
84
- eos
85
-
86
- describe Asciidoctor::Diagram::BytefieldInlineMacroProcessor do
87
- include_examples "inline_macro", :bytefield, BYTEFIELD_CODE, [:svg]
88
- end
89
-
90
- describe Asciidoctor::Diagram::BytefieldBlockMacroProcessor do
91
- include_examples "block_macro", :bytefield, BYTEFIELD_CODE, [:svg]
92
- end
93
-
94
- describe Asciidoctor::Diagram::BytefieldBlockProcessor do
95
- include_examples "block", :bytefield, BYTEFIELD_CODE, [:svg]
96
- end
data/spec/d2_spec.rb DELETED
@@ -1,87 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- D2_CODE = <<-eos
4
- # Actors
5
- hans: Hans Niemann
6
-
7
- defendants: {
8
- mc: Magnus Carlsen
9
- playmagnus: Play Magnus Group
10
- chesscom: Chess.com
11
- naka: Hikaru Nakamura
12
-
13
- mc -> playmagnus: Owns majority
14
- playmagnus <-> chesscom: Merger talks
15
- chesscom -> naka: Sponsoring
16
- }
17
-
18
- # Accusations
19
- hans -> defendants: 'sueing for $100M'
20
-
21
- # Offense
22
- defendants.naka -> hans: Accused of cheating on his stream
23
- defendants.mc -> hans: Lost then withdrew with accusations
24
- defendants.chesscom -> hans: 72 page report of cheating
25
- eos
26
-
27
- describe Asciidoctor::Diagram::D2InlineMacroProcessor, :broken_on_windows do
28
- include_examples "inline_macro", :d2, D2_CODE, [:svg]
29
- end
30
-
31
- describe Asciidoctor::Diagram::D2BlockMacroProcessor, :broken_on_windows do
32
- include_examples "block_macro", :d2, D2_CODE, [:svg]
33
- end
34
-
35
- describe Asciidoctor::Diagram::D2BlockProcessor, :broken_on_windows do
36
- include_examples "block", :d2, D2_CODE, [:svg]
37
-
38
- it "should not use sketch mode by default" do
39
- doc = <<-eos
40
- = Hello, d2!
41
- Doc Writer <doc@example.com>
42
-
43
- == First Section
44
-
45
- [d2]
46
- ----
47
- #{D2_CODE}
48
- ----
49
- eos
50
-
51
- d = load_asciidoc doc
52
- expect(d).to_not be_nil
53
-
54
- b = d.find { |bl| bl.context == :image }
55
- expect(b).to_not be_nil
56
- target = b.attributes['target']
57
- expect(target).to match(/\.svg$/)
58
- expect(File.exist?(target)).to be true
59
- svg = File.read(target, :encoding => Encoding::UTF_8)
60
- expect(svg).to_not match(/class='.*?sketch-overlay-B5.*?'/)
61
- end
62
-
63
- it "should support sketch mode" do
64
- doc = <<-eos
65
- = Hello, D2!
66
- Doc Writer <doc@example.com>
67
-
68
- == First Section
69
-
70
- [d2, foobar, svg, sketch]
71
- ----
72
- #{D2_CODE}
73
- ----
74
- eos
75
-
76
- d = load_asciidoc doc
77
- expect(d).to_not be_nil
78
-
79
- b = d.find { |bl| bl.context == :image }
80
- expect(b).to_not be_nil
81
- target = b.attributes['target']
82
- expect(target).to match(/\.svg$/)
83
- expect(File.exist?(target)).to be true
84
- svg = File.read(target, :encoding => Encoding::UTF_8)
85
- expect(svg).to match(/class='.*?sketch-overlay-B5.*?'/)
86
- end
87
- end
data/spec/dbml_spec.rb DELETED
@@ -1,32 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- DBML_CODE = <<-eos
4
- Table users {
5
- id integer
6
- username varchar
7
- role varchar
8
- created_at timestamp
9
- }
10
-
11
- Table posts {
12
- id integer [primary key]
13
- title varchar
14
- body text [note: 'Content of the post']
15
- user_id integer
16
- created_at timestamp
17
- }
18
-
19
- Ref: posts.user_id > users.id
20
- eos
21
-
22
- describe Asciidoctor::Diagram::DbmlInlineMacroProcessor, :broken_on_windows do
23
- include_examples "inline_macro", :dbml, DBML_CODE, [:svg]
24
- end
25
-
26
- describe Asciidoctor::Diagram::DbmlBlockMacroProcessor, :broken_on_windows do
27
- include_examples "block_macro", :dbml, DBML_CODE, [:svg]
28
- end
29
-
30
- describe Asciidoctor::Diagram::DbmlBlockProcessor, :broken_on_windows do
31
- include_examples "block", :dbml, DBML_CODE, [:svg]
32
- end
@@ -1,27 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- DIAGRAMS_CODE = <<-eos
4
- from diagrams import Diagram
5
- from diagrams.aws.compute import EC2
6
- from diagrams.aws.database import RDS
7
- from diagrams.aws.network import ELB
8
-
9
- with Diagram("Grouped Workers", show=False, direction="TB"):
10
- ELB("lb") >> [EC2("worker1"),
11
- EC2("worker2"),
12
- EC2("worker3"),
13
- EC2("worker4"),
14
- EC2("worker5")] >> RDS("events")
15
- eos
16
-
17
- describe Asciidoctor::Diagram::DiagramsInlineMacroProcessor do
18
- include_examples "inline_macro", :diagrams, DIAGRAMS_CODE, [:png, :svg]
19
- end
20
-
21
- describe Asciidoctor::Diagram::DiagramsBlockMacroProcessor do
22
- include_examples "block_macro", :diagrams, DIAGRAMS_CODE, [:png, :svg]
23
- end
24
-
25
- describe Asciidoctor::Diagram::DiagramsBlockProcessor do
26
- include_examples "block", :diagrams, DIAGRAMS_CODE, [:png, :svg]
27
- end
data/spec/ditaa_spec.rb DELETED
@@ -1,191 +0,0 @@
1
- require_relative 'test_helper_methods'
2
-
3
- DITAA_CODE = <<-eos
4
- +--------+ +-------+ +-------+
5
- | | --+ ditaa +--> | |
6
- | Text | +-------+ |diagram|
7
- |Document| |!magic!| | |
8
- | {d}| | | | |
9
- +---+----+ +-------+ +-------+
10
- : ^
11
- | Lots of work |
12
- +-------------------------+
13
- eos
14
-
15
- describe Asciidoctor::Diagram::DitaaInlineMacroProcessor do
16
- include_examples "inline_macro", :ditaa, DITAA_CODE, [:png, :svg]
17
- end
18
-
19
- describe Asciidoctor::Diagram::DitaaBlockMacroProcessor do
20
- include_examples "block_macro", :ditaa, DITAA_CODE, [:png, :svg, :txt]
21
- end
22
-
23
- describe Asciidoctor::Diagram::DitaaBlockProcessor do
24
- include_examples "block", :ditaa, DITAA_CODE, [:png, :svg, :txt]
25
-
26
- it "should support ditaa options as attributes" do
27
- doc = <<-eos
28
- :ditaa-option-antialias: false
29
- :ditaa-option-round-corners: true
30
- = Hello, PlantUML!
31
- Doc Writer <doc@example.com>
32
-
33
- == First Section
34
-
35
- [ditaa, shadows=false, separation=false, round-corners=false, scale=2.3]
36
- ----
37
- +--------+ +-------+ +-------+
38
- | | --+ ditaa +--> | |
39
- | Text | +-------+ |diagram|
40
- |Document| |!magic!| | |
41
- | {d}| | | | |
42
- +---+----+ +-------+ +-------+
43
- : ^
44
- | Lots of work |
45
- +-------------------------+
46
- ----
47
- eos
48
-
49
- d = load_asciidoc doc
50
- expect(d).to_not be_nil
51
-
52
- b = d.find { |bl| bl.context == :image }
53
- expect(b).to_not be_nil
54
- target = b.attributes['target']
55
- expect(target).to match(/\.png$/)
56
- expect(File.exist?(target)).to be true
57
- end
58
-
59
- it "should regenerate images when options change" do
60
- doc = <<-eos
61
- = Hello, PlantUML!
62
- Doc Writer <doc@example.com>
63
-
64
- == First Section
65
-
66
- [ditaa, test, png, {opts}]
67
- ----
68
- +--------+ +-------+ +-------+
69
- | | --+ ditaa +--> | |
70
- | Text | +-------+ |diagram|
71
- |Document| |!magic!| | |
72
- | {d}| | | | |
73
- +---+----+ +-------+ +-------+
74
- : ^
75
- | Lots of work |
76
- +-------------------------+
77
- ----
78
- eos
79
-
80
- d = load_asciidoc(doc.sub('{opts}', 'shadow=false'))
81
- b = d.find { |bl| bl.context == :image }
82
- target = b.attributes['target']
83
- mtime1 = File.mtime(target)
84
-
85
- sleep 1
86
-
87
- d = load_asciidoc(doc.sub('{opts}', 'round-corners=true'))
88
-
89
- mtime2 = File.mtime(target)
90
-
91
- expect(mtime2).to be > mtime1
92
- end
93
-
94
- it "should support UTF-8 characters" do
95
- doc = <<-eos
96
- = Test
97
-
98
- [ditaa]
99
- ----
100
- /-----\\
101
- |\u00AB \u2026 \u00BB|
102
- \\-----/
103
- ----
104
- eos
105
-
106
- d = load_asciidoc doc
107
- expect(d).to_not be_nil
108
-
109
- b = d.find { |bl| bl.context == :image }
110
- expect(b).to_not be_nil
111
-
112
- expect(b.content_model).to eq :empty
113
-
114
- target = b.attributes['target']
115
- expect(target).to_not be_nil
116
- expect(target).to match(/\.png$/)
117
- expect(File.exist?(target)).to be true
118
-
119
- expect(b.attributes['width']).to_not be_nil
120
- expect(b.attributes['height']).to_not be_nil
121
- end
122
-
123
- it "should report syntax errors" do
124
- doc = <<-eos
125
- = Hello, Ditaa!
126
- Doc Writer <doc@example.com>
127
-
128
- == First Section
129
-
130
- [ditaa,format="svg"]
131
- ----
132
- This should cause a bug.
133
-
134
- // TODO:
135
- // - don't make bugs
136
- // - oops I wrote a comment here
137
-
138
- +--------+ +-------+ +-------+
139
- | | --+ ditaa +--> | |
140
- | Text | +-------+ |diagram|
141
- |Document| |!magic!| | |
142
- | {d}| | | | |
143
- +---+----+ +-------+ +-------+
144
- : ^
145
- | Lots of work |
146
- +-------------------------+
147
- ----
148
- eos
149
-
150
- expect {
151
- load_asciidoc doc
152
- }.to raise_error(/Ambiguous input/i)
153
- end
154
-
155
- it "should support custom bullet characters" do
156
- doc = <<-eos
157
- = Hello, Ditaa!
158
- Doc Writer <doc@example.com>
159
-
160
- == First Section
161
-
162
- [ditaa,format="svg",bullet-characters=x]
163
- ----
164
- +-----------------+
165
- | o Things to do |
166
- | cGRE |
167
- | x Cut the grass |
168
- | x Buy jam |
169
- | x Fix car |
170
- | x Make website |
171
- +-----------------+
172
- ----
173
- eos
174
-
175
- d = load_asciidoc doc
176
- expect(d).to_not be_nil
177
-
178
- b = d.find { |bl| bl.context == :image }
179
- expect(b).to_not be_nil
180
-
181
- expect(b.content_model).to eq :empty
182
-
183
- target = b.attributes['target']
184
- expect(target).to_not be_nil
185
- expect(target).to match(/\.svg$/)
186
- expect(File.exist?(target)).to be true
187
-
188
- expect(b.attributes['width']).to_not be_nil
189
- expect(b.attributes['height']).to_not be_nil
190
- end
191
- end