asciidoctor-diagram 2.1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +43 -0
- data/docs/antora.yml +1 -1
- data/docs/modules/ROOT/pages/index.adoc +1 -1
- data/docs/modules/ROOT/partials/advanced.adoc +72 -13
- data/docs/modules/ROOT/partials/create_diagram.adoc +45 -42
- data/docs/modules/ROOT/partials/uris.adoc +5 -2
- data/lib/asciidoctor-diagram/a2s/extension.rb +4 -0
- data/lib/asciidoctor-diagram/a2s.rb +1 -0
- data/lib/asciidoctor-diagram/barcode/converter.rb +157 -0
- data/lib/asciidoctor-diagram/barcode/dependencies.rb +10 -0
- data/lib/asciidoctor-diagram/barcode/extension.rb +47 -0
- data/lib/asciidoctor-diagram/barcode/svg_outputter.rb +12 -0
- data/lib/asciidoctor-diagram/barcode.rb +11 -0
- data/lib/asciidoctor-diagram/blockdiag/extension.rb +5 -0
- data/lib/asciidoctor-diagram/blockdiag.rb +1 -0
- data/lib/asciidoctor-diagram/bpmn/extension.rb +4 -0
- data/lib/asciidoctor-diagram/bpmn.rb +1 -0
- data/lib/asciidoctor-diagram/bytefield/extension.rb +4 -0
- data/lib/asciidoctor-diagram/bytefield.rb +1 -0
- data/lib/asciidoctor-diagram/diagram_converter.rb +4 -0
- data/lib/asciidoctor-diagram/diagram_processor.rb +62 -6
- data/lib/asciidoctor-diagram/diagram_source.rb +23 -7
- data/lib/asciidoctor-diagram/diagrams/converter.rb +49 -0
- data/lib/asciidoctor-diagram/diagrams/extension.rb +18 -0
- data/lib/asciidoctor-diagram/diagrams.rb +8 -0
- data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.20.jar +0 -0
- data/lib/asciidoctor-diagram/ditaa/extension.rb +4 -0
- data/lib/asciidoctor-diagram/ditaa.rb +1 -0
- data/lib/asciidoctor-diagram/dpic/extension.rb +4 -0
- data/lib/asciidoctor-diagram/dpic.rb +1 -0
- data/lib/asciidoctor-diagram/erd/extension.rb +4 -0
- data/lib/asciidoctor-diagram/erd.rb +1 -0
- data/lib/asciidoctor-diagram/gnuplot/extension.rb +4 -0
- data/lib/asciidoctor-diagram/gnuplot.rb +1 -0
- data/lib/asciidoctor-diagram/graphviz/extension.rb +4 -0
- data/lib/asciidoctor-diagram/graphviz.rb +1 -0
- data/lib/asciidoctor-diagram/http/converter.rb +35 -11
- data/lib/asciidoctor-diagram/http/server.rb +1 -1
- data/lib/asciidoctor-diagram/lilypond/extension.rb +4 -0
- data/lib/asciidoctor-diagram/lilypond.rb +1 -0
- data/lib/asciidoctor-diagram/meme/extension.rb +14 -16
- data/lib/asciidoctor-diagram/meme.rb +1 -0
- data/lib/asciidoctor-diagram/mermaid/extension.rb +4 -0
- data/lib/asciidoctor-diagram/mermaid.rb +1 -0
- data/lib/asciidoctor-diagram/msc/extension.rb +4 -0
- data/lib/asciidoctor-diagram/msc.rb +1 -0
- data/lib/asciidoctor-diagram/nomnoml/extension.rb +4 -0
- data/lib/asciidoctor-diagram/nomnoml.rb +1 -0
- data/lib/asciidoctor-diagram/pikchr/extension.rb +4 -0
- data/lib/asciidoctor-diagram/pikchr.rb +1 -0
- data/lib/asciidoctor-diagram/plantuml/converter.rb +53 -34
- data/lib/asciidoctor-diagram/plantuml/extension.rb +8 -0
- data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.20.jar +0 -0
- data/lib/asciidoctor-diagram/plantuml.rb +1 -0
- data/lib/asciidoctor-diagram/salt.rb +1 -0
- data/lib/asciidoctor-diagram/shaape/extension.rb +4 -0
- data/lib/asciidoctor-diagram/shaape.rb +1 -0
- data/lib/asciidoctor-diagram/smcat/extension.rb +4 -0
- data/lib/asciidoctor-diagram/smcat.rb +1 -0
- data/lib/asciidoctor-diagram/svgbob/extension.rb +4 -0
- data/lib/asciidoctor-diagram/svgbob.rb +1 -0
- data/lib/asciidoctor-diagram/symbolator/extension.rb +4 -0
- data/lib/asciidoctor-diagram/symbolator.rb +1 -0
- data/lib/asciidoctor-diagram/syntrax/converter.rb +1 -1
- data/lib/asciidoctor-diagram/syntrax/extension.rb +4 -0
- data/lib/asciidoctor-diagram/syntrax.rb +1 -0
- data/lib/asciidoctor-diagram/tikz/extension.rb +4 -0
- data/lib/asciidoctor-diagram/tikz.rb +1 -0
- data/lib/asciidoctor-diagram/umlet/extension.rb +4 -0
- data/lib/asciidoctor-diagram/umlet.rb +1 -0
- data/lib/asciidoctor-diagram/util/cli_generator.rb +9 -7
- data/lib/asciidoctor-diagram/util/server-1.3.20.jar +0 -0
- data/lib/asciidoctor-diagram/vega/extension.rb +4 -0
- data/lib/asciidoctor-diagram/vega.rb +2 -0
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/extension.rb +4 -0
- data/lib/asciidoctor-diagram/wavedrom.rb +1 -0
- data/lib/asciidoctor-diagram.rb +2 -0
- data/spec/a2s_spec.rb +9 -5
- data/spec/barcode_spec.rb +176 -0
- data/spec/blockdiag_spec.rb +7 -3
- data/spec/bpmn_spec.rb +7 -3
- data/spec/bytefield_spec.rb +9 -5
- data/spec/diagrams_spec.rb +27 -0
- data/spec/ditaa_spec.rb +7 -3
- data/spec/dpic_spec.rb +7 -3
- data/spec/erd_spec.rb +7 -3
- data/spec/gnuplot_spec.rb +14 -10
- data/spec/graphviz_spec.rb +7 -3
- data/spec/lilypond_spec.rb +7 -3
- data/spec/mermaid_spec.rb +7 -3
- data/spec/msc_spec.rb +10 -6
- data/spec/nomnoml_spec.rb +9 -5
- data/spec/pikchr_spec.rb +7 -3
- data/spec/plantuml_spec.rb +114 -3
- data/spec/shaape_spec.rb +7 -3
- data/spec/shared_examples.rb +161 -0
- data/spec/smcat_spec.rb +10 -6
- data/spec/svgbob_spec.rb +7 -3
- data/spec/symbolator_spec.rb +7 -3
- data/spec/syntrax_spec.rb +7 -3
- data/spec/test_helper.rb +3 -1
- data/spec/tikz_spec.rb +8 -4
- data/spec/umlet_spec.rb +6 -3
- data/spec/vega_spec.rb +11 -6
- data/spec/wavedrom_spec.rb +7 -3
- metadata +23 -10
- data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.17.jar +0 -0
- data/lib/asciidoctor-diagram/util/server-1.3.17.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f13f5d250305d3a9da90af8da4a0b784c247979b9e23462b8b8bd77f6c92ca0a
|
4
|
+
data.tar.gz: 5f757455ea6ba101f8543d87a2bbe06106ed354e09bec89bf3d22959d1674f96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e08ce3f20a0d241e177cbf06680f68149af8adc8e65b6ab25fa57bf1e620aead335d7c8fbe96047bb10b95bf52ce7b22d7c67c3160882e8fd4f0a261c597eb2
|
7
|
+
data.tar.gz: 9ff970387205a3686999220bd37e0d54b08f10f5c95be8d37d05764fbf2f46a5606c9efe4184249b951ad845194e108d7d283fd178216fd42958230dbd50afce
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,48 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 2.2.1
|
4
|
+
|
5
|
+
Bug Fixes::
|
6
|
+
|
7
|
+
* Issue #366: Improve correctness of SVG images produced by Ditaa
|
8
|
+
* Issue #367: Resolve compatibility issue with rqrcode 2.1.0
|
9
|
+
* Issue #368: Respect `options` attribute when generating SVG images
|
10
|
+
|
11
|
+
== 2.2.0
|
12
|
+
|
13
|
+
Enhancements::
|
14
|
+
|
15
|
+
* All diagram macros can now be used as inline macros
|
16
|
+
* Add support for barcodes
|
17
|
+
|
18
|
+
Bug Fixes::
|
19
|
+
|
20
|
+
* Issue #358: Improve error handling when rendering is delegated to an external server (@ahus1)
|
21
|
+
* Issue #350: Restore support for document level `syntrax-style` attribute.
|
22
|
+
|
23
|
+
== 2.1.2
|
24
|
+
|
25
|
+
Enhancements::
|
26
|
+
|
27
|
+
* Issue #345: Switch to POST requests when URI length becomes too long
|
28
|
+
|
29
|
+
Bug Fixes::
|
30
|
+
|
31
|
+
* Issue #348: Rename Syntrax `style` attribute to `style-file` to avoid clashing with the built-in block style attribute.
|
32
|
+
|
33
|
+
== 2.1.1
|
34
|
+
|
35
|
+
Enhancements::
|
36
|
+
|
37
|
+
* Issue #335: The PlantUML preprocessor is now run locally before delegating rendering to Kroki.
|
38
|
+
This avoids file not found errors when using the PlantUML `!include` directive.
|
39
|
+
* Issue #339: Add support for a `size-limit` attribute on PlantUML blocks that controls the maximum size of PlantUML diagrams.
|
40
|
+
* Issue #341: Add support for https://diagrams.mingrammer.com[Minigrammer Diagrams].
|
41
|
+
|
42
|
+
Bug Fixes::
|
43
|
+
|
44
|
+
* Issue #343: The PlantUML preprocessor is now used to resolve `!include` statements instead of using the previous logic provided by this gem.
|
45
|
+
|
3
46
|
== 2.1.0
|
4
47
|
|
5
48
|
Enhancements::
|
data/docs/antora.yml
CHANGED
@@ -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-umlet}[UMLet], {uri-vega}[Vega], {uri-vegalite}[Vega-Lite] and {uri-wavedrom}[WaveDrom] syntax.
|
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.
|
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.
|
@@ -16,7 +16,7 @@ or load and register each extension individually.
|
|
16
16
|
require 'asciidoctor-diagram/<extension_name>'
|
17
17
|
----
|
18
18
|
|
19
|
-
`<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `ditaa`, `dpic`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `pikchr`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
|
19
|
+
`<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `diagrams`, `ditaa`, `dpic`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `pikchr`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
|
20
20
|
|
21
21
|
Requiring one or more of these files will automatically register the extensions for all processed documents.
|
22
22
|
|
@@ -26,17 +26,17 @@ You can then manually register the extensions at the appropriate times using the
|
|
26
26
|
|
27
27
|
This document explains the various features of asciidoctor-diagram blocks using ditaa diagrams as an example.
|
28
28
|
|
29
|
-
=== Diagram
|
29
|
+
=== Diagram Macros
|
30
30
|
|
31
|
-
The diagram extensions can also be used in
|
31
|
+
The diagram extensions can also be used in inline, or block macro form.
|
32
32
|
|
33
33
|
.Anatomy of a diagram block macro
|
34
34
|
----
|
35
|
-
|
35
|
+
diagram-type::source-file-name[format=output-format] // <1> <2> <3>
|
36
36
|
----
|
37
|
-
<1> The macro name
|
37
|
+
<1> The macro name specifies the diagram syntax that is being used.
|
38
38
|
<2> The source file name specifies the external file that contains the diagram source code.
|
39
|
-
<3> The
|
39
|
+
<3> The `format` attribute determines the output image format to use. If a format is not specified, the default output format for the chosen diagram type will be used.
|
40
40
|
|
41
41
|
When the source file name is a relative path it is resolved with respect to the location of the document being processed.
|
42
42
|
|
@@ -73,6 +73,7 @@ The following table lists the tools that are required for each diagram type, the
|
|
73
73
|
|blockdiag |{uri-blockdiag}[BlockDiag] |`blockdiag`
|
74
74
|
|bpmn |{uri-bpmn}[bpmn-js-cmd] |`bpmn`
|
75
75
|
|bytefield |{uri-bytefield}[bytefield-svg] |`bytefield-svg`
|
76
|
+
|diagrams |{uri-python}[Python] |`diagrams-python`
|
76
77
|
|ditaa |{uri-java}[Java] |`java`
|
77
78
|
|dpic |{uri-dpic}[dpic] |`dpic`
|
78
79
|
|erd |{uri-erd}[Erd] |`erd`
|
@@ -92,7 +93,7 @@ The following table lists the tools that are required for each diagram type, the
|
|
92
93
|
|smcat |{uri-smcat}[State Machine Cat] |`smcat`
|
93
94
|
|svgbob |{uri-svgbob}[SvgBob] |`svgbob`
|
94
95
|
|symbolator |{uri-symbolator}[Symbolator] |`symbolator`
|
95
|
-
|syntrax |{uri-syntrax}[Syntrax]
|
96
|
+
|syntrax |{uri-syntrax}[Syntrax]/{uri-jsyntrax}[JSyntrax] |`syntrax`
|
96
97
|
|tikz |A TeX distribution that supports {uri-tikz}[TikZ] |`pdflatex` and `pdf2svg`
|
97
98
|
|umlet |{uri-umlet}[Umlet] |`umlet`
|
98
99
|
|vega |{uri-vega}[vg2png] and/or {uri-vega}[vg2png] |`vg2png` and `vg2svg`
|
@@ -119,6 +120,35 @@ The target of the block macro tells the extension which image to use as backgrou
|
|
119
120
|
The first two positional attributes are `top` and `bottom` and are used for the top and bottom label.
|
120
121
|
Occurrences of `//` surrounded by whitespace are interpreted as line breaks.
|
121
122
|
|
123
|
+
[[barcode]]
|
124
|
+
=== The Barcode Extension
|
125
|
+
|
126
|
+
The barcode extension provides barcode rendering.
|
127
|
+
Barcode macros can be specified using blocks, inline macros or block macros using one of the following templates.
|
128
|
+
|
129
|
+
[source, asciidoc]
|
130
|
+
------
|
131
|
+
// Barcode block
|
132
|
+
[<type>, <attributes>] <1> <2>
|
133
|
+
----
|
134
|
+
<content> <3>
|
135
|
+
----
|
136
|
+
|
137
|
+
// Barcode block macro
|
138
|
+
<type>::<content>[<attributes>]
|
139
|
+
|
140
|
+
// Barcode inline macro
|
141
|
+
<type>::<content>[<attributes>]
|
142
|
+
------
|
143
|
+
<1> Type barcode type. One of `bookland`, `codabar`, `code25`, `code25iata`, `code25interleaved`, `code39`, `code93`, `code128`, `code128a`, `code128b`, `code128c`, `ean8`, `ean13`, `gs1_128`, `qrcode`, or `upca`.
|
144
|
+
<2> Barcode attributes (see the <<barcode_attributes>> attributes section)
|
145
|
+
<3> The content to encode in the barcode
|
146
|
+
|
147
|
+
By default the `content` field of the barcode macros will be interpreted as the barcode content.
|
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
|
+
If the `external` attribute is set on a barcode macro, the target is interpreted as a file path.
|
150
|
+
The barcode content will then be obtained by reading the contents of the referenced file.
|
151
|
+
|
122
152
|
=== Diagram Attributes
|
123
153
|
|
124
154
|
Certain diagram types allow image generation to be customized using attributes.
|
@@ -140,18 +170,28 @@ This is illustrated for the blockdiag `fontpath` attribute in the example below.
|
|
140
170
|
<1> Attributes can be specified for all diagram of a certain type at the document level by prefixing them with `<blocktype>-`.
|
141
171
|
In this example, the `fontpath` attribute is specified for all diagrams of type `blockdiag`.
|
142
172
|
<2> The first diagram does not specify an explicit value for `fontpath` so the global `blockdiag-fontpath` value will be used
|
143
|
-
<3> The second diagram does
|
173
|
+
<3> The second diagram does specify a `fontpath` value.
|
144
174
|
This overrides the global `blockdiag-fontpath` value.
|
145
175
|
|
146
176
|
Each attribute can either be specified at the block level or at the document level.
|
147
|
-
The attribute name at the
|
177
|
+
The attribute name at the document level should be prefixed with the diagram type name and a dash.
|
148
178
|
|
149
179
|
==== Shared Attributes
|
150
180
|
|
181
|
+
The set of shared attributes applies to all diagram types.
|
182
|
+
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.
|
183
|
+
|
151
184
|
[cols=">,<,<",options="header"]
|
152
185
|
|===
|
153
|
-
|Name
|
154
|
-
|svg-type
|
186
|
+
|Name |Default value |Description
|
187
|
+
|svg-type |unspecified |One of `static`, `inline` or `interactive`.
|
188
|
+
This determines the style of SVG embedding that's used in certain backends.
|
189
|
+
The xref:asciidoc:macros:image-svg.adoc[asciidoc spec] describes this in more detail.
|
190
|
+
|server-url |unspecified |External service to render diagram.
|
191
|
+
Usage removes the need to depend on external tools to be installed locally.
|
192
|
+
|server-type |unspecified |One of `plantuml` or `kroki_io`
|
193
|
+
|max-get-size |1024 |The maximum size of the URI path for HTTP GET requests.
|
194
|
+
If the maximum size is exceeded, POST requests are used instead
|
155
195
|
|===
|
156
196
|
|
157
197
|
==== AsciiToSVG
|
@@ -163,6 +203,20 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
163
203
|
|noblur |unspecified |Disable drop-shadow blurring
|
164
204
|
|===
|
165
205
|
|
206
|
+
[[barcode_attributes]]
|
207
|
+
==== Barcode
|
208
|
+
|
209
|
+
[cols=">,<,<",options="header"]
|
210
|
+
|===
|
211
|
+
|Name |Default value |Description
|
212
|
+
|height |100 |The height of the bars. (1D only, 2D uses ydim)
|
213
|
+
|xdim |1 |The width of the narrowest bar in a barcode. Thicker bars are multiples of the xdim.
|
214
|
+
|ydim |Same as xdim |This is the same as xdim, but for the height of the blocks in a 2D barcode.
|
215
|
+
|margin |10 |The width of the quiet zone around the barcode.
|
216
|
+
|foreground |black |The color of the bars specified as a 3 or 6 digit hex RGB value or HTML color name.
|
217
|
+
|background |white |The color of the background specified as a 3 or 6 digit hex RGB value or HTML color name.
|
218
|
+
|===
|
219
|
+
|
166
220
|
==== Blockdiag
|
167
221
|
|
168
222
|
[cols=">,<,<",options="header"]
|
@@ -180,6 +234,10 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
180
234
|
|width |1024 |The target width of the diagram. Does not apply for output type `svg`.
|
181
235
|
|===
|
182
236
|
|
237
|
+
==== Diagrams
|
238
|
+
|
239
|
+
No specific attributes.
|
240
|
+
|
183
241
|
==== Ditaa
|
184
242
|
|
185
243
|
[cols=">,<,<",options="header"]
|
@@ -261,6 +319,7 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
261
319
|
|===
|
262
320
|
|Name |Default value |Description
|
263
321
|
|config |unspecified |Path to a config file to pass to PlantUML.
|
322
|
+
|size-limit |4096 |The maximum dimensions (width and height) of generated diagrams.
|
264
323
|
|===
|
265
324
|
|
266
325
|
==== State Machine Cat
|
@@ -290,7 +349,7 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
290
349
|
|Name |Default value |Description
|
291
350
|
|heading |unspecifed |Diagram title
|
292
351
|
|scale |1 |A scale factor that is applied to the image.
|
293
|
-
|style
|
352
|
+
|style-file |unspecifed |Path to a style config file to pass to Syntrax.
|
294
353
|
|transparent |false |Makes the background of the image transparent instead of opaque white.
|
295
354
|
|===
|
296
355
|
|
@@ -300,4 +359,4 @@ The attribute name at the block level should be prefixed with the name of the di
|
|
300
359
|
|===
|
301
360
|
|Name |Default value |Description
|
302
361
|
|preamble |unspecified |Code definitions to pass to TikZ.
|
303
|
-
|===
|
362
|
+
|===
|
@@ -4,14 +4,14 @@ A diagram is written inside a literal block, which can accept several attributes
|
|
4
4
|
|
5
5
|
.Anatomy of a diagram
|
6
6
|
----
|
7
|
-
[diagram-type,
|
7
|
+
[diagram-type, target=output-file-name, format=output-format] // <1> <2> <3>
|
8
8
|
.... // <4>
|
9
9
|
Diagram in appropriate syntax
|
10
10
|
....
|
11
11
|
----
|
12
|
-
<1> The first
|
13
|
-
<2> The
|
14
|
-
<3> The
|
12
|
+
<1> The first value in the attribute list specifies the diagram syntax that is being used.
|
13
|
+
<2> The `target` attribute specifies the basename of the image file that will be generated. If this attribute is omitted an auto-generated name will be used instead.
|
14
|
+
<3> The `format` attribute determines the output image format to use. If a format is not specified, the default output format for the chosen diagram type will be used.
|
15
15
|
<4> Place the attribute list directly on top of the delimited literal block (+....+). You can also use an open block as an alternative (`--`).
|
16
16
|
|
17
17
|
The following diagram types and output formats are available:
|
@@ -20,37 +20,40 @@ The following diagram types and output formats are available:
|
|
20
20
|
|
21
21
|
[cols=">,5*^",options="header"]
|
22
22
|
|===
|
23
|
-
|Diagram Type
|
24
|
-
|{uri-a2s}[a2s]
|
25
|
-
|{uri-actdiag}[actdiag]
|
26
|
-
|
|
27
|
-
|{uri-
|
28
|
-
|{uri-
|
29
|
-
|{uri-
|
30
|
-
|{uri-
|
31
|
-
|{uri-
|
32
|
-
|{uri-
|
33
|
-
|{uri-
|
34
|
-
|
35
|
-
|{uri-
|
36
|
-
|{
|
37
|
-
|{uri-
|
38
|
-
|{uri-
|
39
|
-
|{uri-
|
40
|
-
|{uri-
|
41
|
-
|{uri-
|
42
|
-
|{uri-
|
43
|
-
|{uri-
|
44
|
-
|{uri-
|
45
|
-
|{uri-
|
46
|
-
|{uri-
|
47
|
-
|{uri-
|
48
|
-
|{uri-
|
49
|
-
|{uri-
|
50
|
-
|{uri-
|
51
|
-
|{uri-
|
52
|
-
|{uri-
|
53
|
-
|{uri-
|
23
|
+
|Diagram Type |gif |pdf |png |svg |txt
|
24
|
+
|{uri-a2s}[a2s] | | | |{check}|
|
25
|
+
|{uri-actdiag}[actdiag] | |{check}|{check}|{check}|
|
26
|
+
|<<barcode,barcode>> | | |{check}| |{check}
|
27
|
+
|{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
|
28
|
+
|{uri-bpmn}[bpmn] | |{check}|{check}|{check}|
|
29
|
+
|{uri-bytefield}[bytefield] | | | |{check}|
|
30
|
+
|{uri-diagrams}[diagrams] | |{check}|{check}|{check}|
|
31
|
+
|{uri-ditaa}[ditaa] | | |{check}|{check}|
|
32
|
+
|{uri-dpic}[dpic] | | | |{check}|
|
33
|
+
|{uri-erd}[erd] | | |{check}|{check}|
|
34
|
+
|{uri-gnuplot}[gnuplot] |{check}| |{check}|{check}|{check}
|
35
|
+
|{uri-dot}[graphviz] | |{check}|{check}|{check}|
|
36
|
+
|<<meme,meme>> |{check}| |{check}| |
|
37
|
+
|{uri-mermaid}[mermaid] | |{check}|{check}|{check}|
|
38
|
+
|{uri-mscgen}[msc] | | |{check}|{check}|
|
39
|
+
|{uri-nomnoml}[nomnoml] | | | |{check}|
|
40
|
+
|{uri-nwdiag}[nwdiag] | |{check}|{check}|{check}|
|
41
|
+
|{uri-packetdiag}[packetdiag] | |{check}|{check}|{check}|
|
42
|
+
|{uri-pikchr}[pikchr] | | | |{check}|
|
43
|
+
|{uri-plantuml}[plantuml] | | |{check}|{check}|{check}
|
44
|
+
|{uri-rackdiag}[rackdiag] | |{check}|{check}|{check}|
|
45
|
+
|{uri-seqdiag}[seqdiag] | |{check}|{check}|{check}|
|
46
|
+
|{uri-shaape}[shaape] | | |{check}|{check}|
|
47
|
+
|{uri-smcat}[smcat] | | | |{check}|
|
48
|
+
|{uri-svgbob}[svgbob] | | | |{check}|
|
49
|
+
|{uri-symbolator}[symbolator] | |{check}|{check}|{check}|
|
50
|
+
|{uri-syntrax}[syntrax] (Syntrax) | |{check}|{check}|{check}|
|
51
|
+
|{uri-jsyntrax}[syntrax] (JSyntrax)| | |{check}|{check}|
|
52
|
+
|{uri-tikz}[tikz] | |{check}| |{check}|
|
53
|
+
|{uri-umlet}[umlet] |{check}|{check}|{check}|{check}|
|
54
|
+
|{uri-vega}[vega] | | |{check}|{check}|
|
55
|
+
|{uri-vegalite}[vegalite] | | |{check}|{check}|
|
56
|
+
|{uri-wavedrom}[wavedrom] | | |{check}|{check}|
|
54
57
|
|===
|
55
58
|
|
56
59
|
:!check:
|
@@ -81,25 +84,25 @@ The example below illustrates the structure of a basic ditaa block written direc
|
|
81
84
|
....
|
82
85
|
----
|
83
86
|
|
84
|
-
The ditaa block above results in the following
|
87
|
+
The ditaa block above results in the following diagram.
|
85
88
|
|
86
89
|
.Rendered ditaa diagram
|
87
90
|
image::asciidoctor-diagram-process.png[Asciidoctor Diagram process diagram,650,319]
|
88
91
|
|
89
92
|
The rendered ditaa diagram above gets the file name `58372f7d2ceffae9e91fd0a7cbb080b6.png`.
|
90
93
|
That long number is the checksum of the source code calculated by asciidoctor-diagram.
|
91
|
-
If you want to give your
|
94
|
+
If you want to give your image files a more meaningful name, fill in the `target` attribute.
|
92
95
|
|
93
96
|
This can be done by either specifying it as the second positional attribute or as a named attribute.
|
94
97
|
Both examples below would result in a file called `ditaa-diagram.png`.
|
95
98
|
|
96
99
|
....
|
97
|
-
[ditaa, "ditaa-diagram"]
|
100
|
+
[ditaa, target="ditaa-diagram"]
|
98
101
|
----
|
99
102
|
<snip>
|
100
103
|
----
|
101
104
|
|
102
|
-
[ditaa,
|
105
|
+
[ditaa, "ditaa-diagram"]
|
103
106
|
----
|
104
107
|
<snip>
|
105
108
|
----
|
@@ -111,7 +114,7 @@ The example below illustrates the structure of a basic PlantUML block written di
|
|
111
114
|
.PlantUML Diagram Syntax
|
112
115
|
[source]
|
113
116
|
----
|
114
|
-
[plantuml, diagram-classes, png] // <1> <2> <3>
|
117
|
+
[plantuml, target=diagram-classes, format=png] // <1> <2> <3>
|
115
118
|
....
|
116
119
|
class BlockProcessor
|
117
120
|
class DiagramBlock
|
@@ -124,8 +127,8 @@ DiagramBlock <|-- PlantUmlBlock
|
|
124
127
|
....
|
125
128
|
----
|
126
129
|
<1> The diagram is written in PlantUML so the first positional attribute is assigned the `plantuml` diagram type.
|
127
|
-
<2> The name of the
|
128
|
-
<3> The output format is
|
130
|
+
<2> The name of the diagram file is given by the `target` attribute.
|
131
|
+
<3> The output format is specified using the `format` attribute
|
129
132
|
|
130
133
|
.Rendered PlantUML diagram
|
131
134
|
image::asciidoctor-diagram-classes.png[Asciidoctor Diagram classes diagram]
|
@@ -1,10 +1,11 @@
|
|
1
|
-
:uri-a2s: https://github.com/
|
1
|
+
:uri-a2s: https://github.com/asciitosvg/asciitosvg
|
2
2
|
:uri-actdiag: http://blockdiag.com/en/actdiag/index.html
|
3
3
|
:uri-asciidoctor-api: http://asciidoctor.org/docs/user-manual/#api
|
4
4
|
:uri-asciidoctor-extensions: http://asciidoctor.org/docs/user-manual/#extension-points
|
5
5
|
:uri-blockdiag: http://blockdiag.com
|
6
6
|
:uri-bpmn: https://github.com/gtudan/bpmn-js-cmd
|
7
7
|
:uri-bytefield: https://github.com/Deep-Symmetry/bytefield-svg
|
8
|
+
:uri-diagrams: https://diagrams.mingrammer.com
|
8
9
|
:uri-ditaa: http://ditaa.sourceforge.net/
|
9
10
|
:uri-dpic: https://gitlab.com/aplevich/dpic
|
10
11
|
:uri-dot: https://graphviz.gitlab.io/_pages/doc/info/lang.html
|
@@ -22,6 +23,7 @@
|
|
22
23
|
:uri-pikchr: https://pikchr.org
|
23
24
|
:uri-plantuml: http://plantuml.sourceforge.net
|
24
25
|
:uri-py-plantuml: https://code.google.com/p/asciidoc-plantuml/
|
26
|
+
:uri-python: https://www.python.org
|
25
27
|
:uri-rackdiag: http://blockdiag.com/en/nwdiag/index.html
|
26
28
|
:uri-seqdiag: http://blockdiag.com/en/seqdiag/index.html
|
27
29
|
:uri-shaape: https://github.com/christiangoltz/shaape
|
@@ -29,10 +31,11 @@
|
|
29
31
|
:uri-svgbob: https://github.com/ivanceras/svgbobrus
|
30
32
|
:uri-symbolator: https://github.com/kevinpt/symbolator
|
31
33
|
:uri-syntrax: https://kevinpt.github.io/syntrax/
|
34
|
+
:uri-jsyntrax: https://atp-mipt.github.io/jsyntrax/
|
32
35
|
:uri-tikz: https://github.com/pgf-tikz/pgf
|
33
36
|
:uri-umlet: http://www.umlet.com/
|
34
37
|
:uri-vega: https://vega.github.io/vega/
|
35
38
|
:uri-vegalite: https://vega.github.io/vega-lite/
|
36
39
|
:uri-wavedrom: http://wavedrom.com
|
37
40
|
:uri-wavedromeditor: https://github.com/wavedrom/wavedrom.github.io/releases
|
38
|
-
:uri-wavedromcli: https://github.com/wavedrom/cli
|
41
|
+
:uri-wavedromcli: https://github.com/wavedrom/cli
|
@@ -10,5 +10,9 @@ module Asciidoctor
|
|
10
10
|
class AsciiToSvgBlockMacroProcessor < DiagramBlockMacroProcessor
|
11
11
|
use_converter AsciiToSvgConverter
|
12
12
|
end
|
13
|
+
|
14
|
+
class AsciiToSvgInlineMacroProcessor < DiagramInlineMacroProcessor
|
15
|
+
use_converter AsciiToSvgConverter
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
@@ -4,4 +4,5 @@ require_relative 'a2s/extension'
|
|
4
4
|
Asciidoctor::Extensions.register do
|
5
5
|
block Asciidoctor::Diagram::AsciiToSvgBlockProcessor, :a2s
|
6
6
|
block_macro Asciidoctor::Diagram::AsciiToSvgBlockMacroProcessor, :a2s
|
7
|
+
inline_macro Asciidoctor::Diagram::AsciiToSvgInlineMacroProcessor, :a2s
|
7
8
|
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
require_relative '../diagram_converter'
|
2
|
+
require_relative 'dependencies'
|
3
|
+
|
4
|
+
module Asciidoctor
|
5
|
+
module Diagram
|
6
|
+
# @private
|
7
|
+
class BarcodeConverter
|
8
|
+
BARCODE_TYPES = [
|
9
|
+
:bookland,
|
10
|
+
:codabar,
|
11
|
+
:code25,
|
12
|
+
:code25iata,
|
13
|
+
:code25interleaved,
|
14
|
+
:code39,
|
15
|
+
:code93,
|
16
|
+
:code128,
|
17
|
+
:code128a,
|
18
|
+
:code128b,
|
19
|
+
:code128c,
|
20
|
+
:ean8,
|
21
|
+
:ean13,
|
22
|
+
:gs1_128,
|
23
|
+
:qrcode,
|
24
|
+
:upca,
|
25
|
+
]
|
26
|
+
|
27
|
+
include DiagramConverter
|
28
|
+
|
29
|
+
def supported_formats
|
30
|
+
[:png, :svg, :txt]
|
31
|
+
end
|
32
|
+
|
33
|
+
def collect_options(source)
|
34
|
+
options = {}
|
35
|
+
|
36
|
+
options[:xdim] = source.attr('xdim')
|
37
|
+
options[:ydim] = source.attr('ydim')
|
38
|
+
options[:margin] = source.attr('margin')
|
39
|
+
options[:height] = source.attr('height')
|
40
|
+
options[:foreground] = source.attr('foreground')
|
41
|
+
options[:background] = source.attr('background')
|
42
|
+
|
43
|
+
[:xdim, :ydim, :margin, :height].each { |o| options[o] = options[o].to_i if options[o] }
|
44
|
+
|
45
|
+
options
|
46
|
+
end
|
47
|
+
|
48
|
+
def convert(source, format, options)
|
49
|
+
BarcodeDependencies::BARCODE_DEPENDENCIES.each_pair { |n, v| source.ensure_gem(n, v) }
|
50
|
+
require 'barby'
|
51
|
+
|
52
|
+
code = source.code
|
53
|
+
type = source.config[:type]
|
54
|
+
|
55
|
+
case type
|
56
|
+
when :bookland
|
57
|
+
require 'barby/barcode/bookland'
|
58
|
+
barcode = Barby::Bookland.new(code)
|
59
|
+
when :codabar
|
60
|
+
require 'barby/barcode/codabar'
|
61
|
+
barcode = Barby::Codabar.new(code)
|
62
|
+
when :code25
|
63
|
+
require 'barby/barcode/code_25'
|
64
|
+
barcode = Barby::Code25.new(code)
|
65
|
+
when :code25iata
|
66
|
+
require 'barby/barcode/code_25_iata'
|
67
|
+
barcode = Barby::Code25IATA.new(code)
|
68
|
+
when :code25interleaved
|
69
|
+
require 'barby/barcode/code_25_interleaved'
|
70
|
+
barcode = Barby::Code25Interleaved.new(code)
|
71
|
+
when :code39
|
72
|
+
require 'barby/barcode/code_39'
|
73
|
+
barcode = Barby::Code39.new(code)
|
74
|
+
when :code93
|
75
|
+
require 'barby/barcode/code_93'
|
76
|
+
barcode = Barby::Code93.new(code)
|
77
|
+
when :code128
|
78
|
+
require 'barby/barcode/code_128'
|
79
|
+
barcode = Barby::Code128.new(code)
|
80
|
+
when :code128a
|
81
|
+
require 'barby/barcode/code_128'
|
82
|
+
barcode = Barby::Code128A.new(code)
|
83
|
+
when :code128b
|
84
|
+
require 'barby/barcode/code_128'
|
85
|
+
barcode = Barby::Code128B.new(code)
|
86
|
+
when :code128c
|
87
|
+
require 'barby/barcode/code_128'
|
88
|
+
barcode = Barby::Code128C.new(code)
|
89
|
+
when :ean8
|
90
|
+
require 'barby/barcode/ean_8'
|
91
|
+
barcode = Barby::EAN8.new(code)
|
92
|
+
when :ean13
|
93
|
+
require 'barby/barcode/ean_13'
|
94
|
+
barcode = Barby::EAN13.new(code)
|
95
|
+
when :gs1_128
|
96
|
+
require 'barby/barcode/code_128'
|
97
|
+
code = code.gsub /\([^)]+\)/ do |control|
|
98
|
+
case control.upcase
|
99
|
+
when '(FNC1)'
|
100
|
+
Barby::Code128::FNC1
|
101
|
+
when '(FNC2)'
|
102
|
+
Barby::Code128::FNC2
|
103
|
+
when '(FNC3)'
|
104
|
+
Barby::Code128::FNC3
|
105
|
+
when '(FNC4)'
|
106
|
+
Barby::Code128::FNC4
|
107
|
+
when '(CODEA)'
|
108
|
+
Barby::Code128::CODEA
|
109
|
+
when '(CODEB)'
|
110
|
+
Barby::Code128::CODEB
|
111
|
+
when '(CODEC)'
|
112
|
+
Barby::Code128::CODEC
|
113
|
+
when '(SHIFT)'
|
114
|
+
Barby::Code128::SHIFT
|
115
|
+
when '(SP)'
|
116
|
+
' '
|
117
|
+
else
|
118
|
+
control
|
119
|
+
end
|
120
|
+
end
|
121
|
+
code = code.gsub(/\s+/, '')
|
122
|
+
code = code.prepend(Barby::Code128::FNC1) unless code[0] == Barby::Code128::FNC1
|
123
|
+
barcode = Barby::Code128.new(code)
|
124
|
+
when :qrcode
|
125
|
+
BarcodeDependencies::QRCODE_DEPENDENCIES.each_pair { |n, v| source.ensure_gem(n, v) }
|
126
|
+
require 'barby/barcode/qr_code'
|
127
|
+
barcode = Barby::QrCode.new(code)
|
128
|
+
when :upca
|
129
|
+
require 'barby/barcode/ean_13'
|
130
|
+
barcode = Barby::UPCA.new(code)
|
131
|
+
else
|
132
|
+
raise "Unsupported barcode type: #{type}"
|
133
|
+
end
|
134
|
+
|
135
|
+
case format
|
136
|
+
when :png
|
137
|
+
BarcodeDependencies::PNG_DEPENDENCIES.each_pair { |n, v| source.ensure_gem(n, v) }
|
138
|
+
require 'barby/outputter/png_outputter'
|
139
|
+
require 'chunky_png/color'
|
140
|
+
options[:foreground] = ChunkyPNG::Color(options[:foreground]) if options[:foreground]
|
141
|
+
options[:background] = ChunkyPNG::Color(options[:background]) if options[:background]
|
142
|
+
barcode.to_png(options)
|
143
|
+
when :svg
|
144
|
+
require_relative 'svg_outputter'
|
145
|
+
options[:foreground] = "##{options[:foreground]}" if options[:foreground] =~ /^[0-9a-f]+$/i
|
146
|
+
options[:background] = "##{options[:background]}" if options[:background] =~ /^[0-9a-f]+$/i
|
147
|
+
barcode.to_svg(options)
|
148
|
+
when :txt
|
149
|
+
require 'barby/outputter/ascii_outputter'
|
150
|
+
barcode.to_ascii
|
151
|
+
else
|
152
|
+
raise "Unsupported format: #{format}"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|