asciidoctor-diagram 2.2.3 → 3.0.0

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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +159 -0
  3. data/README.adoc +17 -13
  4. data/lib/asciidoctor-diagram/a2s/converter.rb +7 -2
  5. data/lib/asciidoctor-diagram/barcode/converter.rb +83 -78
  6. data/lib/asciidoctor-diagram/blockdiag/converter.rb +12 -2
  7. data/lib/asciidoctor-diagram/bpmn/converter.rb +4 -1
  8. data/lib/asciidoctor-diagram/bytefield/converter.rb +4 -1
  9. data/lib/asciidoctor-diagram/d2/converter.rb +57 -0
  10. data/lib/asciidoctor-diagram/d2/extension.rb +18 -0
  11. data/lib/asciidoctor-diagram/d2.rb +8 -0
  12. data/lib/asciidoctor-diagram/dbml/converter.rb +27 -0
  13. data/lib/asciidoctor-diagram/dbml/extension.rb +18 -0
  14. data/lib/asciidoctor-diagram/dbml.rb +8 -0
  15. data/lib/asciidoctor-diagram/diagram_processor.rb +49 -9
  16. data/lib/asciidoctor-diagram/diagram_source.rb +35 -33
  17. data/lib/asciidoctor-diagram/diagrams/converter.rb +4 -1
  18. data/lib/asciidoctor-diagram/ditaa/converter.rb +15 -7
  19. data/lib/asciidoctor-diagram/ditaa/ditaa-2.2.0.jar +0 -0
  20. data/lib/asciidoctor-diagram/dpic/converter.rb +4 -1
  21. data/lib/asciidoctor-diagram/erd/converter.rb +5 -2
  22. data/lib/asciidoctor-diagram/gnuplot/converter.rb +7 -1
  23. data/lib/asciidoctor-diagram/graphviz/converter.rb +4 -1
  24. data/lib/asciidoctor-diagram/graphviz_py/converter.rb +4 -1
  25. data/lib/asciidoctor-diagram/http/converter.rb +16 -7
  26. data/lib/asciidoctor-diagram/http/server.rb +2 -2
  27. data/lib/asciidoctor-diagram/lilypond/converter.rb +3 -2
  28. data/lib/asciidoctor-diagram/meme/converter.rb +29 -3
  29. data/lib/asciidoctor-diagram/mermaid/converter.rb +4 -2
  30. data/lib/asciidoctor-diagram/msc/converter.rb +6 -2
  31. data/lib/asciidoctor-diagram/nomnoml/converter.rb +4 -1
  32. data/lib/asciidoctor-diagram/penrose/converter.rb +53 -0
  33. data/lib/asciidoctor-diagram/penrose/extension.rb +18 -0
  34. data/lib/asciidoctor-diagram/penrose.rb +8 -0
  35. data/lib/asciidoctor-diagram/pikchr/converter.rb +4 -1
  36. data/lib/asciidoctor-diagram/pintora/converter.rb +60 -0
  37. data/lib/asciidoctor-diagram/pintora/extension.rb +18 -0
  38. data/lib/asciidoctor-diagram/pintora.rb +8 -0
  39. data/lib/asciidoctor-diagram/plantuml/converter.rb +256 -43
  40. data/lib/asciidoctor-diagram/plantuml/plantuml-2.2.4.jar +0 -0
  41. data/lib/asciidoctor-diagram/shaape/converter.rb +4 -1
  42. data/lib/asciidoctor-diagram/smcat/converter.rb +5 -1
  43. data/lib/asciidoctor-diagram/structurizr/converter.rb +69 -0
  44. data/lib/asciidoctor-diagram/structurizr/extension.rb +52 -0
  45. data/lib/asciidoctor-diagram/structurizr/renderers.rb +63 -0
  46. data/lib/asciidoctor-diagram/structurizr/structurizr-2.2.2.jar +0 -0
  47. data/lib/asciidoctor-diagram/structurizr.rb +7 -0
  48. data/lib/asciidoctor-diagram/svgbob/converter.rb +6 -2
  49. data/lib/asciidoctor-diagram/symbolator/converter.rb +4 -1
  50. data/lib/asciidoctor-diagram/syntrax/converter.rb +72 -17
  51. data/lib/asciidoctor-diagram/syntrax/syntrax-2.2.0.jar +0 -0
  52. data/lib/asciidoctor-diagram/tikz/converter.rb +5 -2
  53. data/lib/asciidoctor-diagram/umlet/converter.rb +4 -1
  54. data/lib/asciidoctor-diagram/util/base64.rb +25 -0
  55. data/lib/asciidoctor-diagram/util/cli.rb +11 -3
  56. data/lib/asciidoctor-diagram/util/cli_generator.rb +1 -0
  57. data/lib/asciidoctor-diagram/util/java.rb +15 -7
  58. data/lib/asciidoctor-diagram/util/java_jruby.rb +14 -0
  59. data/lib/asciidoctor-diagram/util/java_socket.rb +4 -0
  60. data/lib/asciidoctor-diagram/util/server-2.2.3.jar +0 -0
  61. data/lib/asciidoctor-diagram/util/svg.rb +5 -3
  62. data/lib/asciidoctor-diagram/vega/converter.rb +5 -3
  63. data/lib/asciidoctor-diagram/version.rb +1 -1
  64. data/lib/asciidoctor-diagram/wavedrom/converter.rb +38 -24
  65. data/lib/asciidoctor-diagram.rb +5 -0
  66. metadata +32 -115
  67. data/Rakefile +0 -9
  68. data/docs/antora.yml +0 -3
  69. data/docs/modules/ROOT/images/asciidoctor-diagram-classes.png +0 -0
  70. data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
  71. data/docs/modules/ROOT/pages/index.adoc +0 -21
  72. data/docs/modules/ROOT/partials/advanced.adoc +0 -365
  73. data/docs/modules/ROOT/partials/create_diagram.adoc +0 -134
  74. data/docs/modules/ROOT/partials/generate.adoc +0 -15
  75. data/docs/modules/ROOT/partials/installation.adoc +0 -19
  76. data/docs/modules/ROOT/partials/uris.adoc +0 -41
  77. data/examples/Gemfile +0 -3
  78. data/examples/README.adoc +0 -18
  79. data/examples/design.adoc +0 -78
  80. data/examples/features.adoc +0 -189
  81. data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.21.jar +0 -0
  82. data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.21.jar +0 -0
  83. data/lib/asciidoctor-diagram/util/server-1.3.21.jar +0 -0
  84. data/spec/a2s_spec.rb +0 -33
  85. data/spec/barcode_spec.rb +0 -176
  86. data/spec/blockdiag_spec.rb +0 -20
  87. data/spec/bpmn_spec.rb +0 -60
  88. data/spec/bytefield_spec.rb +0 -96
  89. data/spec/diagrams_spec.rb +0 -27
  90. data/spec/ditaa_spec.rb +0 -191
  91. data/spec/dpic_spec.rb +0 -23
  92. data/spec/erd_spec.rb +0 -96
  93. data/spec/gnuplot_spec.rb +0 -229
  94. data/spec/graphviz_py_spec.rb +0 -33
  95. data/spec/graphviz_spec.rb +0 -24
  96. data/spec/lilypond_spec.rb +0 -17
  97. data/spec/man.jpg +0 -0
  98. data/spec/meme_spec.rb +0 -67
  99. data/spec/mermaid_spec.rb +0 -198
  100. data/spec/msc_spec.rb +0 -37
  101. data/spec/nomnoml_spec.rb +0 -36
  102. data/spec/pikchr_spec.rb +0 -73
  103. data/spec/plantuml_spec.rb +0 -772
  104. data/spec/shaape_spec.rb +0 -20
  105. data/spec/shared_examples.rb +0 -764
  106. data/spec/smcat_spec.rb +0 -30
  107. data/spec/svgbob_spec.rb +0 -33
  108. data/spec/symbolator_spec.rb +0 -27
  109. data/spec/syntrax_spec.rb +0 -22
  110. data/spec/test_helper.rb +0 -113
  111. data/spec/tikz_spec.rb +0 -181
  112. data/spec/umlet_spec.rb +0 -32
  113. data/spec/vega_spec.rb +0 -133
  114. data/spec/wavedrom_spec.rb +0 -21
data/spec/barcode_spec.rb DELETED
@@ -1,176 +0,0 @@
1
- require_relative 'test_helper'
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(/\.png$/)
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(/\.png$/)
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(/\.png$/)
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'
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'
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'
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
@@ -1,27 +0,0 @@
1
- require_relative 'test_helper'
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'
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]
21
- end
22
-
23
- describe Asciidoctor::Diagram::DitaaBlockProcessor do
24
- include_examples "block", :ditaa, DITAA_CODE, [:png, :svg]
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
data/spec/dpic_spec.rb DELETED
@@ -1,23 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- DPIC_CODE = <<-eos
4
- arrow "$u$" above
5
- S: circle rad 10/72.27 # 10 pt
6
- line right 0.35
7
- G: box "$G(s)$"
8
- arrow "$y$" above
9
- line -> down G.ht from last arrow then left last arrow.c.x-S.x then to S.s
10
- "$-\;$" below rjust
11
- eos
12
-
13
- describe Asciidoctor::Diagram::DpicInlineMacroProcessor, :broken_on_windows do
14
- include_examples "inline_macro", :dpic, DPIC_CODE, [:svg]
15
- end
16
-
17
- describe Asciidoctor::Diagram::DpicBlockMacroProcessor, :broken_on_windows do
18
- include_examples "block_macro", :dpic, DPIC_CODE, [:svg]
19
- end
20
-
21
- describe Asciidoctor::Diagram::DpicBlockProcessor, :broken_on_windows do
22
- include_examples "block", :dpic, DPIC_CODE, [:svg]
23
- end
data/spec/erd_spec.rb DELETED
@@ -1,96 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- ERD_CODE = <<-eos
4
- title {label: "nfldb Entity-Relationship diagram (condensed)", size: "20"}
5
-
6
- # Entities
7
-
8
- [player] {bgcolor: "#d0e0d0"}
9
- *player_id {label: "varchar, not null"}
10
- full_name {label: "varchar, null"}
11
- team {label: "varchar, not null"}
12
- position {label: "player_pos, not null"}
13
- status {label: "player_status, not null"}
14
-
15
- [team] {bgcolor: "#d0e0d0"}
16
- *team_id {label: "varchar, not null"}
17
- city {label: "varchar, not null"}
18
- name {label: "varchar, not null"}
19
-
20
- [game] {bgcolor: "#ececfc"}
21
- *gsis_id {label: "gameid, not null"}
22
- start_time {label: "utctime, not null"}
23
- week {label: "usmallint, not null"}
24
- season_year {label: "usmallint, not null"}
25
- season_type {label: "season_phase, not null"}
26
- finished {label: "boolean, not null"}
27
- home_team {label: "varchar, not null"}
28
- home_score {label: "usmallint, not null"}
29
- away_team {label: "varchar, not null"}
30
- away_score {label: "usmallint, not null"}
31
-
32
- [drive] {bgcolor: "#ececfc"}
33
- *+gsis_id {label: "gameid, not null"}
34
- *drive_id {label: "usmallint, not null"}
35
- start_field {label: "field_pos, null"}
36
- start_time {label: "game_time, not null"}
37
- end_field {label: "field_pos, null"}
38
- end_time {label: "game_time, not null"}
39
- pos_team {label: "varchar, not null"}
40
- pos_time {label: "pos_period, null"}
41
-
42
- [play] {bgcolor: "#ececfc"}
43
- *+gsis_id {label: "gameid, not null"}
44
- *+drive_id {label: "usmallint, not null"}
45
- *play_id {label: "usmallint, not null"}
46
- time {label: "game_time, not null"}
47
- pos_team {label: "varchar, not null"}
48
- yardline {label: "field_pos, null"}
49
- down {label: "smallint, null"}
50
- yards_to_go {label: "smallint, null"}
51
-
52
- [play_player] {bgcolor: "#ececfc"}
53
- *+gsis_id {label: "gameid, not null"}
54
- *+drive_id {label: "usmallint, not null"}
55
- *+play_id {label: "usmallint, not null"}
56
- *+player_id {label: "varchar, not null"}
57
- team {label: "varchar, not null"}
58
-
59
- [meta] {bgcolor: "#fcecec"}
60
- version {label: "smallint, null"}
61
- season_type {label: "season_phase, null"}
62
- season_year {label: "usmallint, null"}
63
- week {label: "usmallint, null"}
64
-
65
- # Relationships
66
-
67
- player *--1 team
68
- game *--1 team {label: "home"}
69
- game *--1 team {label: "away"}
70
- drive *--1 team
71
- play *--1 team
72
- play_player *--1 team
73
-
74
- game 1--* drive
75
- game 1--* play
76
- game 1--* play_player
77
-
78
- drive 1--* play
79
- drive 1--* play_player
80
-
81
- play 1--* play_player
82
-
83
- player 1--* play_player
84
- eos
85
-
86
- describe Asciidoctor::Diagram::ErdInlineMacroProcessor, :broken_on_windows do
87
- include_examples "inline_macro", :erd, ERD_CODE, [:png, :svg]
88
- end
89
-
90
- describe Asciidoctor::Diagram::ErdBlockMacroProcessor, :broken_on_windows do
91
- include_examples "block_macro", :erd, ERD_CODE, [:png, :svg]
92
- end
93
-
94
- describe Asciidoctor::Diagram::ErdBlockProcessor, :broken_on_windows do
95
- include_examples "block", :erd, ERD_CODE, [:png, :svg]
96
- end