asciidoctor-diagram 2.0.2 → 2.1.2

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 +78 -1
  3. data/README.adoc +25 -507
  4. data/Rakefile +1 -1
  5. data/docs/antora.yml +3 -0
  6. data/{images → docs/modules/ROOT/images}/asciidoctor-diagram-classes.png +0 -0
  7. data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
  8. data/docs/modules/ROOT/pages/index.adoc +21 -0
  9. data/docs/modules/ROOT/partials/advanced.adoc +319 -0
  10. data/docs/modules/ROOT/partials/create_diagram.adoc +132 -0
  11. data/docs/modules/ROOT/partials/generate.adoc +15 -0
  12. data/docs/modules/ROOT/partials/installation.adoc +19 -0
  13. data/docs/modules/ROOT/partials/uris.adoc +40 -0
  14. data/examples/features.adoc +1 -1
  15. data/lib/asciidoctor-diagram.rb +4 -0
  16. data/lib/asciidoctor-diagram/a2s/converter.rb +10 -6
  17. data/lib/asciidoctor-diagram/blockdiag/converter.rb +1 -1
  18. data/lib/asciidoctor-diagram/bpmn/converter.rb +3 -3
  19. data/lib/asciidoctor-diagram/diagram_converter.rb +9 -1
  20. data/lib/asciidoctor-diagram/diagram_processor.rb +92 -48
  21. data/lib/asciidoctor-diagram/diagram_source.rb +71 -24
  22. data/lib/asciidoctor-diagram/diagrams.rb +7 -0
  23. data/lib/asciidoctor-diagram/diagrams/converter.rb +49 -0
  24. data/lib/asciidoctor-diagram/diagrams/extension.rb +14 -0
  25. data/lib/asciidoctor-diagram/ditaa/converter.rb +20 -7
  26. data/lib/asciidoctor-diagram/ditaa/ditaa-1.3.20.jar +0 -0
  27. data/lib/asciidoctor-diagram/dpic.rb +7 -0
  28. data/lib/asciidoctor-diagram/dpic/converter.rb +30 -0
  29. data/lib/asciidoctor-diagram/dpic/extension.rb +14 -0
  30. data/lib/asciidoctor-diagram/gnuplot/converter.rb +8 -8
  31. data/lib/asciidoctor-diagram/graphviz/converter.rb +2 -2
  32. data/lib/asciidoctor-diagram/http/converter.rb +52 -14
  33. data/lib/asciidoctor-diagram/http/server.rb +11 -6
  34. data/lib/asciidoctor-diagram/lilypond/converter.rb +13 -3
  35. data/lib/asciidoctor-diagram/meme/converter.rb +22 -16
  36. data/lib/asciidoctor-diagram/mermaid/converter.rb +45 -14
  37. data/lib/asciidoctor-diagram/msc/converter.rb +2 -2
  38. data/lib/asciidoctor-diagram/pikchr.rb +7 -0
  39. data/lib/asciidoctor-diagram/pikchr/converter.rb +33 -0
  40. data/lib/asciidoctor-diagram/pikchr/extension.rb +14 -0
  41. data/lib/asciidoctor-diagram/plantuml/converter.rb +68 -43
  42. data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.20.jar +0 -0
  43. data/lib/asciidoctor-diagram/smcat/converter.rb +3 -3
  44. data/lib/asciidoctor-diagram/svgbob/converter.rb +6 -2
  45. data/lib/asciidoctor-diagram/symbolator.rb +7 -0
  46. data/lib/asciidoctor-diagram/symbolator/converter.rb +23 -0
  47. data/lib/asciidoctor-diagram/symbolator/extension.rb +14 -0
  48. data/lib/asciidoctor-diagram/syntrax/converter.rb +9 -6
  49. data/lib/asciidoctor-diagram/tikz/converter.rb +20 -1
  50. data/lib/asciidoctor-diagram/umlet/converter.rb +11 -2
  51. data/lib/asciidoctor-diagram/util/cli.rb +16 -1
  52. data/lib/asciidoctor-diagram/util/cli_generator.rb +30 -8
  53. data/lib/asciidoctor-diagram/util/gif.rb +2 -2
  54. data/lib/asciidoctor-diagram/util/java.rb +118 -3
  55. data/lib/asciidoctor-diagram/util/java_jruby.rb +4 -1
  56. data/lib/asciidoctor-diagram/util/java_socket.rb +8 -109
  57. data/lib/asciidoctor-diagram/util/pdf.rb +2 -2
  58. data/lib/asciidoctor-diagram/util/png.rb +2 -2
  59. data/lib/{server-1.3.15.jar → asciidoctor-diagram/util/server-1.3.20.jar} +0 -0
  60. data/lib/asciidoctor-diagram/util/svg.rb +66 -18
  61. data/lib/asciidoctor-diagram/vega/converter.rb +2 -2
  62. data/lib/asciidoctor-diagram/version.rb +1 -1
  63. data/spec/a2s_spec.rb +6 -144
  64. data/spec/blockdiag_spec.rb +6 -204
  65. data/spec/bpmn_spec.rb +52 -92
  66. data/spec/bytefield_spec.rb +6 -144
  67. data/spec/diagrams_spec.rb +23 -0
  68. data/spec/ditaa_spec.rb +6 -144
  69. data/spec/dpic_spec.rb +19 -0
  70. data/spec/erd_spec.rb +6 -203
  71. data/spec/gnuplot_spec.rb +10 -263
  72. data/spec/graphviz_spec.rb +6 -145
  73. data/spec/lilypond_spec.rb +6 -144
  74. data/spec/mermaid_spec.rb +69 -211
  75. data/spec/msc_spec.rb +6 -203
  76. data/spec/nomnoml_spec.rb +7 -145
  77. data/spec/pikchr_spec.rb +69 -0
  78. data/spec/plantuml_spec.rb +63 -553
  79. data/spec/shaape_spec.rb +12 -224
  80. data/spec/shared_examples.rb +603 -0
  81. data/spec/smcat_spec.rb +6 -144
  82. data/spec/svgbob_spec.rb +6 -144
  83. data/spec/symbolator_spec.rb +23 -0
  84. data/spec/syntrax_spec.rb +7 -217
  85. data/spec/test_helper.rb +4 -29
  86. data/spec/tikz_spec.rb +68 -18
  87. data/spec/umlet_spec.rb +3 -59
  88. data/spec/vega_spec.rb +6 -119
  89. data/spec/wavedrom_spec.rb +3 -200
  90. metadata +82 -18
  91. data/README_zh-CN.adoc +0 -336
  92. data/images/asciidoctor-diagram-process.png +0 -0
  93. data/lib/batik-all-1.10.jar +0 -0
  94. data/lib/ditaa-1.3.15.jar +0 -0
  95. data/lib/ditaamini-0.12.jar +0 -0
  96. data/lib/jlatexmath-minimal-1.0.5.jar +0 -0
  97. data/lib/plantuml-1.3.15.jar +0 -0
  98. data/lib/plantuml.jar +0 -0
  99. data/spec/bpmn-example.xml +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09488e585ecab52e38188d04020d60aa17873bea47c3043055f8f59770f9d1aa'
4
- data.tar.gz: ab9eab53cc00fc988ccd4518ac62e91f815ea06cfc3d3615824a24d63efb07a7
3
+ metadata.gz: 9c999abc157686ce7101a23d06b8e3cdf83ec0244f1d9697343ec7e9a6afe946
4
+ data.tar.gz: 44349c53eefb7e2eb330348a29e2f1a4ee6b60ed1ec5548dc4b3c99ab6fcab5a
5
5
  SHA512:
6
- metadata.gz: 7e75194b60961b932b7ca141448948c92404db4557b83611c28786de97fb7b36e30d434189815729a4aab79620dd6a1e90d7eb0281c1a5a3a66356730f319892
7
- data.tar.gz: d7b8c2f8d8678e6299dd309292cc524d704830d6a882ae9228620d466862f0e37c9b1540a57090641f04f3499fcfcbf46f08933febfaa0dbb15579d33c3d1c64
6
+ metadata.gz: afd079eab9fbfd29a76690012e699c9fa5e45ab14f35b9469defb3a46060e3011b814913af1d5c5365c63157ee8def0101a41ba6b6368d154ad26fe36440ac75
7
+ data.tar.gz: e994d6101f63d0fcfde7b04c4763aa43a9eac167cb19295777124cbc25b3042c132869d47597fd33c107b7da583442697bd80852faa9db641d91155cd8b86edd
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,82 @@
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
+
13
+ == 2.1.1
14
+
15
+ Enhancements::
16
+
17
+ * Issue #335: The PlantUML preprocessor is now run locally before delegating rendering to Kroki.
18
+ This avoids file not found errors when using the PlantUML `!include` directive.
19
+ * Issue #339: Add support for a `size-limit` attribute on PlantUML blocks that controls the maximum size of PlantUML diagrams.
20
+ * Issue #341: Add support for https://diagrams.mingrammer.com[Minigrammer Diagrams].
21
+
22
+ Bug Fixes::
23
+
24
+ * Issue #343: The PlantUML preprocessor is now used to resolve `!include` statements instead of using the previous logic provided by this gem.
25
+
26
+ == 2.1.0
27
+
28
+ Enhancements::
29
+
30
+ * Issue #226: Add initial support to delegate rendering of diagrams to https://kroki.io[kroki.io]. Add `:diagram-server-url: https://kroki.io/` and `:diagram-server-type: kroki_io` to your document to enable this.
31
+ * Issue #296: Support referring to the mmdc batch script on Windows using the `mmdc` (Mermaid) document attribute.
32
+ * Issue #312: Update PlantUML to v1.2021.0. +
33
+ Starting with version 2.1.0 you can now also override the bundled version of PlantUML with a different version.
34
+ If the `DIAGRAM_PLANTUML_CLASSPATH` environment variable is set, asciidoctor-diagram will parse this value as a series of paths to JAR files separated by the native path separator (`:` or `;`) and use those JAR files instead of the bundled ones.
35
+
36
+ Bug Fixes::
37
+
38
+ * Issue #308: Avoid changing the semantics of SVG documents during post processing.
39
+ * Issue #313: Remove unneeded dependency on bigdecimal.
40
+
41
+ == 2.0.5
42
+
43
+ Enhancements::
44
+
45
+ * Improve internal target path resolution logic
46
+ * TikZ diagrams can now add content to the LaTeX preamble by setting the `preamble` block attribute to `true`.
47
+ The preamble and diagram should be separated by a line consisting of `\~~~~`. (@colbyn)
48
+ * The `scale` attribute is now passed on to Mermaid. (@gustav-b)
49
+ * Issue #271: Launch UMLet directly using `java` instead of using the UMLet wrapper scripts or executables
50
+
51
+ Bug Fixes::
52
+
53
+ * Issue #294: Treat the first positional parameter of diagram block macros as the desired output format rather than as the target.
54
+
55
+ == 2.0.4
56
+
57
+ Enhancements::
58
+
59
+ * Issue #110: Added support for an experimental attribute `diagram-autoimagesdir` that sets per image node `imagesdir` values.
60
+
61
+ Bug Fixes::
62
+
63
+ * Issue #292: A regression in 2.0.3 caused SVG diagrams to get a zero width and height when documents were regenerated.
64
+
65
+ == 2.0.3
66
+
67
+ Enhancements::
68
+
69
+ * Issue #261: Ensure generated SVG diagrams always specify a view box
70
+ * Issue #284: Add support for HTTP redirect responses when using a rendering server
71
+ * Issue #290: Add support for Pikchr
72
+ * Add support for dpic
73
+ * Add support for Symbolator (@gsmecher)
74
+
75
+ Bug Fixes::
76
+
77
+ * Issue #247: Fix `svg-type`/`diagram-svg-type`.
78
+ * Issue #257: Avoid potential hangs when generating Mermaid diagrams
79
+
3
80
  == 2.0.2
4
81
 
5
82
  Enhancements::
@@ -338,7 +415,7 @@ Enhancements::
338
415
 
339
416
  * Add support for `graphviz` blocks which may contain diagrams specified using the Graphviz DOT language
340
417
  * The location of the Graphviz `dot` executable can now be specified using the `graphvizdot` document attribute
341
- * Add support for `ditaa`, `graphivz` and `plantuml` block macros
418
+ * Add support for `ditaa`, `graphviz` and `plantuml` block macros
342
419
 
343
420
  == 1.0.1
344
421
 
data/README.adoc CHANGED
@@ -1,523 +1,41 @@
1
1
  = Asciidoctor Diagram
2
2
  Pepijn Van_Eeckhoudt <https://github.com/pepijnve[@pepijnve]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
3
  :description: README for the Asciidoctor Diagram extension for Asciidoctor.
4
- ifdef::env-github[:toc: macro]
5
- ifndef::env-site[:toc: preamble]
6
- ifndef::imagesdir[:imagesdir: images]
7
- :icons: font
8
- :source-highlighter: coderay
9
- :source-language: asciidoc
10
- :table-caption!:
11
- :example-caption!:
12
- :figure-caption!:
13
- :check: icon:check[]
14
- ifdef::env-github[:check: :ballot_box_with_check:]
15
- ifndef::env-site[:status:]
16
- :uri-a2s: https://github.com/dhobsd/asciitosvg
17
- :uri-actdiag: http://blockdiag.com/en/actdiag/index.html
18
- :uri-asciidoctor-api: http://asciidoctor.org/docs/user-manual/#api
19
- :uri-asciidoctor-extensions: http://asciidoctor.org/docs/user-manual/#extension-points
20
- :uri-blockdiag: http://blockdiag.com
21
- :uri-bpmn: https://github.com/gtudan/bpmn-js-cmd
22
- :uri-bytefield: https://github.com/Deep-Symmetry/bytefield-svg
23
- :uri-ditaa: http://ditaa.sourceforge.net/
24
- :uri-dot: https://graphviz.gitlab.io/_pages/doc/info/lang.html
25
- :uri-erd: https://github.com/BurntSushi/erd
26
- :uri-gnuplot: http://gnuplot.info
27
- :uri-graphviz: https://graphviz.gitlab.io
28
- :uri-imagemagick: http://www.imagemagick.org
29
- :uri-java: http://java.sun.com
30
- :uri-mermaid: https://github.com/mermaidjs/mermaid.cli
31
- :uri-mscgen: http://www.mcternan.me.uk/mscgen/
32
- :uri-nomnoml: http://nomnoml.com
33
- :uri-nwdiag: http://blockdiag.com/en/nwdiag/index.html
34
- :uri-packetdiag: http://blockdiag.com/en/nwdiag/index.html
35
- :uri-phantomjs: http://phantomjs.org
36
- :uri-plantuml: http://plantuml.sourceforge.net
37
- :uri-py-plantuml: https://code.google.com/p/asciidoc-plantuml/
38
- :uri-rackdiag: http://blockdiag.com/en/nwdiag/index.html
39
- :uri-seqdiag: http://blockdiag.com/en/seqdiag/index.html
40
- :uri-shaape: https://github.com/christiangoltz/shaape
41
- :uri-smcat: https://github.com/sverweij/state-machine-cat
42
- :uri-svgbob: https://github.com/ivanceras/svgbobrus
43
- :uri-syntrax: https://kevinpt.github.io/syntrax/
44
- :uri-umlet: http://www.umlet.com/
45
- :uri-vega: https://vega.github.io/vega/
46
- :uri-vegalite: https://vega.github.io/vega-lite/
47
- :uri-wavedrom: http://wavedrom.com
48
- :uri-wavedromeditor: https://github.com/wavedrom/wavedrom.github.io/releases
49
- :uri-wavedromcli: https://github.com/wavedrom/cli
50
4
 
51
- Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document.
52
-
53
- 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-erd}[Erd], {uri-gnuplot}[Gnuplot], {uri-dot}[GraphViz], {uri-mermaid}[Mermaid], {uri-mscgen}[Msc], {uri-nomnoml}[Nomnoml], {uri-plantuml}[PlantUML], {uri-shaape}[Shaape], {uri-smcat}[State Machine Cat], {uri-svgbob}[SvgBob], {uri-syntrax}[Syntrax], {uri-umlet}[UMLet], {uri-vega}[Vega], {uri-vegalite}[Vega-Lite] and {uri-wavedrom}[WaveDrom] syntax.
54
-
55
- Each extension runs the diagram processor to generate an SVG, PNG, or TXT file from the input text.
56
- The generated file is then inserted into your converted document.
57
-
58
- Asciidoctor Diagram was inspired by the {uri-py-plantuml}[AsciiDoc PlantUML filter].
59
-
60
- ifndef::env-site[]
61
- Translations of the document are available in the following languages:
62
-
63
- * link:README_zh-CN.adoc[汉语]
64
- endif::[]
65
-
66
- ifdef::status[]
67
- [discrete]
68
- == Status
69
-
70
- image:https://travis-ci.org/asciidoctor/asciidoctor-diagram.svg?branch=master["Linux Build Status", link="https://travis-ci.org/asciidoctor/asciidoctor-diagram"]
71
- image:https://ci.appveyor.com/api/projects/status/4r4gkk5gy3igs6nh/branch/master?svg=true["Windows Build Status", link="https://ci.appveyor.com/project/asciidoctor/asciidoctor-diagram"]
5
+ image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Linux%20unit%20tests/badge.svg?branch=master["Linux Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Linux+unit+tests%22"]
6
+ image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/macOS%20unit%20tests/badge.svg?branch=master["macOS Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22macOS+unit+tests%22"]
7
+ image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Windows%20unit%20tests/badge.svg?branch=master["Windows Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Windows+unit+tests%22"]
72
8
  image:https://badge.fury.io/rb/asciidoctor-diagram.svg[Gem Version, link=https://rubygems.org/gems/asciidoctor-diagram]
73
- endif::status[]
74
-
75
- ifeval::["{toc-placement}" == "macro"]
76
- [discrete]
77
- == Contents
78
-
79
- toc::[title={blank}]
80
- endif::[]
81
-
82
- == Installation
83
-
84
- Asciidoctor Diagram is a RubyGem, which can be installed using the `gem` or `bundle` commands.
85
-
86
- You can install the Asciidoctor Diagram gem by typing `gem install` in the CLI.
87
-
88
- $ gem install asciidoctor-diagram
89
-
90
- by first adding the following entry to your project's [.path]_Gemfile_.
91
9
 
92
- .Gemfile
93
- [source,ruby]
94
- ----
95
- gem 'asciidoctor-diagram'
96
- ----
97
-
98
- Then execute `bundle` in the CLI.
99
-
100
- $ bundle
101
-
102
- == Creating a Diagram
10
+ Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document.
11
+ The extension will run the appropriate diagram processor to generate an image from the input text.
12
+ The generated image is then inserted into your converted document.
103
13
 
104
- A diagram is written inside a literal block, which can accept several attributes.
14
+ Detailed usage instructions can be found on the https://docs.asciidoctor.org/diagram-extension/latest/[Asciidoctor documentation site].
105
15
 
106
- .Anatomy of a diagram
107
- ----
108
- [diagram-type, generated-file-name, generated-image-format] // <1> <2> <3>
109
- .... // <4>
110
- Diagram in appropriate syntax
111
- ....
112
- ----
113
- <1> The first positional attribute in the attribute list specifies the diagram that is being used.
114
- <2> The second, optional positional attribute assigns a file name (i.e. `target`) to the generated diagram. If a target is not specified an auto-generated name will be used.
115
- <3> The third, optional positional attribute specifies the image format to create, specified as a three character file extension.
116
- <4> Place the attribute list directly on top of the delimited literal block (+....+). You can also use an open block as an alternative (`--`).
16
+ Asciidoctor Diagram was inspired by the https://code.google.com/p/asciidoc-plantuml/[AsciiDoc PlantUML filter].
117
17
 
118
- The following diagram types and output formats are available:
18
+ == Example
119
19
 
120
- [cols=">,5*^",options="header"]
121
- |===
122
- |Diagram Type |gif |pdf |png |svg |txt
123
- |{uri-a2s}[a2s] | | | |{check}|
124
- |{uri-actdiag}[actdiag] | |{check}|{check}|{check}|
125
- |{uri-blockdiag}[blockdiag] | |{check}|{check}|{check}|
126
- |{uri-bpmn}[bpmn] | |{check}|{check}|{check}|
127
- |{uri-bytefield}[bytefield] | | | |{check}|
128
- |{uri-ditaa}[ditaa] | | |{check}|{check}|
129
- |{uri-erd}[erd] | | |{check}|{check}|
130
- |{uri-gnuplot}[gnuplot] |{check}| |{check}|{check}|{check}
131
- |{uri-dot}[graphviz] | |{check}|{check}|{check}|
132
- |<<meme,meme>> |{check}| |{check}| |
133
- |{uri-mermaid}[mermaid] | |{check}|{check}|{check}|
134
- |{uri-mscgen}[msc] | | |{check}|{check}|
135
- |{uri-nomnoml}[nomnoml] | | | |{check}|
136
- |{uri-nwdiag}[nwdiag] | |{check}|{check}|{check}|
137
- |{uri-packetdiag}[packetdiag]| |{check}|{check}|{check}|
138
- |{uri-plantuml}[plantuml] | | |{check}|{check}|{check}
139
- |{uri-rackdiag}[rackdiag] | |{check}|{check}|{check}|
140
- |{uri-seqdiag}[seqdiag] | |{check}|{check}|{check}|
141
- |{uri-shaape}[shaape] | | |{check}|{check}|
142
- |{uri-smcat}[smcat] | | | |{check}|
143
- |{uri-svgbob}[svgbob] | | | |{check}|
144
- |{uri-syntrax}[syntrax] | |{check}|{check}|{check}|
145
- |{uri-umlet}[umlet] |{check}|{check}|{check}|{check}|
146
- |{uri-vega}[vega] | | |{check}|{check}|
147
- |{uri-vegalite}[vegalite] | | |{check}|{check}|
148
- |{uri-wavedrom}[wavedrom] | | |{check}|{check}|
149
- |===
20
+ The Asciidoctor Diagram enables you to embed a plain text diagram as a block in your document.
21
+ The example below shows an embedded Ditaa diagram block.
150
22
 
151
- The example below illustrates the structure of a basic ditaa block written directly in an AsciiDoc document.
152
-
153
- .Basic ditaa block
154
- [source]
155
- ----
23
+ ---------
156
24
  [ditaa]
157
- ....
158
- +-------------+
159
- | Asciidoctor |-------+
160
- | diagram | |
161
- +-------------+ | PNG out
162
- ^ |
163
- | ditaa in |
164
- | v
165
- +--------+ +--------+----+ /---------------\
166
- | | --+ Asciidoctor +--> | |
167
- | Text | +-------------+ | Beautiful |
168
- |Document| | !magic! | | Output |
169
- | {d}| | | | |
170
- +---+----+ +-------------+ \---------------/
171
- : ^
172
- | Lots of work |
173
- +-----------------------------------+
174
- ....
175
25
  ----
176
-
177
- The ditaa block above results in the following generated diagram.
178
-
179
- .Rendered ditaa diagram
180
- image::asciidoctor-diagram-process.png[Asciidoctor Diagram process diagram,650,319]
181
-
182
- The rendered ditaa diagram above gets the file name `58372f7d2ceffae9e91fd0a7cbb080b6.png`.
183
- That long number is the checksum of the source code calculated by asciidoctor-diagram.
184
- If you want to give your generated files a more meaningful name, fill in the `target` attribute.
185
-
186
- This can be done by either specifying it as the second positional attribute or as a named attribute.
187
- Both examples below would result in a file called `ditaa-diagram.png`.
188
-
189
- ....
190
- [ditaa, "ditaa-diagram"]
26
+ +-------------+
27
+ | asciidoctor |-----------+
28
+ | diagram | |
29
+ +-------------+ | image
30
+ ^ |
31
+ | diagram source |
32
+ | v
33
+ +--------+ +-----+-------+ /---------------\
34
+ | adoc |-->+ asciidoctor + | HTML + image |
35
+ +--------+ +-------------+ \---------------/
191
36
  ----
192
- <snip>
193
- ----
194
-
195
- [ditaa, target="ditaa-diagram"]
196
- ----
197
- <snip>
198
- ----
199
- ....
200
-
201
-
202
- The example below illustrates the structure of a basic PlantUML block written directly in an AsciiDoc document.
203
-
204
- .PlantUML Diagram Syntax
205
- [source]
206
- ----
207
- [plantuml, diagram-classes, png] // <1> <2> <3>
208
- ....
209
- class BlockProcessor
210
- class DiagramBlock
211
- class DitaaBlock
212
- class PlantUmlBlock
213
-
214
- BlockProcessor <|-- DiagramBlock
215
- DiagramBlock <|-- DitaaBlock
216
- DiagramBlock <|-- PlantUmlBlock
217
- ....
218
- ----
219
- <1> The diagram is written in PlantUML so the first positional attribute is assigned the `plantuml` diagram type.
220
- <2> The name of the generated diagram file (target) is written in the second positional attribute.
221
- <3> The output format is entered in the third positional attribute.
222
-
223
- .Rendered PlantUML diagram
224
- image::asciidoctor-diagram-classes.png[Asciidoctor Diagram classes diagram]
225
-
226
- == Generating a Diagram from a Terminal
227
-
228
- You can load Asciidoctor diagram in a terminal using the `-r` flag.
229
-
230
- $ asciidoctor -r asciidoctor-diagram sample.adoc
231
-
232
- You can also use Asciidoctor diagram with other converters, such as Asciidoctor EPUB.
233
- Asciidoctor-epub3 is also loaded with the `-r` flag.
234
-
235
- $ asciidoctor -r asciidoctor-diagram -r asciidoctor-epub3 -b epub3 sample.adoc
236
-
237
- Or, you can invoke Asciidoctor and the EPUB converter with the `asciidoctor-epub3` command.
238
- The command implicitly sets the `-r` and `-b` flags for EPUB3 output.
239
-
240
- $ asciidoctor-epub3 -r asciidoctor-diagram sample.adoc
241
-
242
- == Advanced Usage
243
-
244
- === Enabling Extensions
245
-
246
- In your program, you can either load and register the entire set of diagram extensions
247
-
248
- [source,ruby]
249
- ----
250
- require 'asciidoctor-diagram'
251
- ----
252
-
253
- or load and register each extension individually.
254
-
255
- [source,ruby]
256
- ----
257
- require 'asciidoctor-diagram/<extension_name>'
258
- ----
259
-
260
- `<extension_name>` can be one of `a2s`, `blockdiag`, `bytefield`, `ditaa`, `erd`, `gnuplot`, `graphviz`, `meme`, `mermaid`, `msc`, `plantuml`, `shaape`, `smcat`, `svgbob`, `syntrax`, `umlet`, `vega` or `wavedrom`.
261
-
262
- Requiring one or more of these files will automatically register the extensions for all processed documents.
263
-
264
- If you need more fine grained control over when the extensions are enabled, `asciidoctor-diagram/<extension_name>/extension` can be used instead.
265
- This loads the extensions but does not register it in the Asciidoctor extension registry.
266
- You can then manually register the extensions at the appropriate times using the `Asciidoctor::Extensions` API.
267
-
268
- This document explains the various features of asciidoctor-diagram blocks using ditaa diagrams as an example.
269
-
270
- === Diagram Block Macro
271
-
272
- The diagram extensions can also be used in in block macro form.
273
-
274
- .Anatomy of a diagram block macro
275
- ----
276
- block-name::source-file-name[generated-file-extension] // <1> <2> <3>
277
- ----
278
- <1> The macro name is the same as the block name in the block form.
279
- <2> The source file name specifies the external file that contains the diagram source code.
280
- <3> The first, optional, positional attribute assigns the file extension (i.e. `format`) to the generated diagram.
281
-
282
- When the source file name is a relative path it is resolved with respect to the location of the document being processed.
283
-
284
- === Image Output Location
285
-
286
- When Asciidoctor Diagram writes images to disk it will go over the following options in order to determine where to write the files.
287
-
288
- . `\{imagesoutdir\}` if the `imagesoutdir` attribute has been specified
289
- . `\{outdir\}/\{imagesdir\}` if the `outdir` attribute has been specified
290
- . `\{to_dir\}/\{imagesdir\}` if the `to_dir` attribute has been specified
291
- . `\{base_dir\}/\{imagesdir\}`
292
-
293
- === Specifying Diagram Generator Paths
294
-
295
- Asciidoctor Diagram depends on external tools to generates images.
296
- In most cases it will locate these tools automatically for you by looking for specific executables in each directory in the `PATH` environment variable.
297
- In case you've installed a tool in a way where the executable is not in the `PATH`, you can override its location manually using document attributes.
298
- The following table lists the tools that are required for each diagram type, the location where they can be downloaded and the document attribute you can use to override their locations.
299
-
300
- [cols=">,2*<",options="header"]
301
- |===
302
- |Diagram Type |Tool |Attribute
303
- |a2s |{uri-a2s}[AsciiToSvg] |`a2s`
304
- |actdiag |{uri-actdiag}[ActDiag] |`actdiag`
305
- |blockdiag |{uri-blockdiag}[BlockDiag] |`blockdiag`
306
- |bpmn |{uri-bpmn}[bpmn-js-cmd] |`bpmn`
307
- |bytefield |{uri-bytefield}[bytefield-svg] |`bytefield-svg`
308
- |ditaa |{uri-java}[Java] |`java`
309
- |erd |{uri-erd}[Erd] |`erd`
310
- |gnuplot |{uri-gnuplot}[Gnuplot] |`gnuplot`
311
- |graphviz |{uri-graphviz}[GraphViz] |`dot` or `graphvizdot`
312
- |meme |{uri-imagemagick}[ImageMagick] |`convert` and `identify`
313
- |mermaid |{uri-mermaid}[Mermaid.cli] |`mermaid`
314
- |msc |{uri-mscgen}[Mscgen] |`mscgen`
315
- |nomnoml |{uri-nomnoml}[Nomnoml] |`nomnoml`
316
- |nwdiag |{uri-nwdiag}[NwDiag] |`nwdiag`
317
- |packetdiag |{uri-nwdiag}[NwDiag] |`packetdiag`
318
- |plantuml |{uri-java}[Java] |`java`
319
- |rackdiag |{uri-nwdiag}[NwDiag] |`rackdiag`
320
- |seqdiag |{uri-seqdiag}[SeqDiag] |`seqdiag`
321
- |shaape |{uri-shaape}[Shaape] |`shaape`
322
- |smcat |{uri-smcat}[State Machine Cat] |`smcat`
323
- |svgbob |{uri-svgbob}[SvgBob] |`svgbob`
324
- |syntrax |{uri-syntrax}[Syntrax] |`syntrax`
325
- |umlet |{uri-umlet}[Umlet] |`umlet`
326
- |vega |{uri-vega}[vg2png] and/or {uri-vega}[vg2png] |`vg2png` and `vg2svg`
327
- |vegalite |{uri-vegalite}[vl2vg] and {uri-vega}[vg2png] and/or {uri-vega}[vg2svg]|`vl2vg`, `vg2png` and `vg2svg`
328
- .2+|wavedrom |{uri-wavedromeditor}[WaveDrom Editor] |`wavedrom`
329
- |{uri-wavedromcli}[WaveDrom CLI] (and {uri-phantomjs}[PhantomJS] for WaveDrom CLI v1) |`wavedrom` (and `phantomjs`)
330
- |===
331
-
332
- If for instance you installed `actdiag` in `/home/me/actdiag/bin` and this path is not included in the `PATH` you can specify its location on the command line
333
-
334
- $ asciidoctor -a actdiag=/home/me/actdiag/bin/actdiag -r asciidoctor-diagram sample.adoc
335
-
336
- [[meme]]
337
- === The Meme Extension
338
-
339
- The meme extension provides a basic '`Advice Animal`' style image generator.
340
- It's usage is easiest to explain with an example.
341
-
342
- ----
343
- meme::yunoguy.jpg[Doc writers,Y U NO // AsciiDoc]
344
- ----
345
-
346
- The target of the block macro tells the extension which image to use as background.
347
- The first two positional attributes are `top` and `bottom` and are used for the top and bottom label.
348
- Occurrences of `//` surrounded by whitespace are interpreted as line breaks.
349
-
350
- === Diagram Attributes
351
-
352
- Certain diagram types allow image generation to be customized using attributes.
353
- Each attribute can be specified per individual diagram block or for all blocks of a given diagram type in a document level.
354
- This is illustrated for the blockdiag `fontpath` attribute in the example below.
355
-
356
- ----
357
- = Asciidoctor Diagram
358
- :blockdiag-fontpath: /path/to/font.ttf <1>
359
-
360
- [blockdiag] <2>
361
- ....
362
- ....
363
-
364
- [blockdiag, fontpath="/path/to/otherfont.ttf"] <3>
365
- ....
366
- ....
367
- ----
368
- <1> Attributes can be specified for all diagram of a certain type at the document level by prefixing them with `<blocktype>-`.
369
- In this example, the `fontpath` attribute is specified for all diagrams of type `blockdiag`.
370
- <2> The first diagram does not specify an explicit value for `fontpath` so the global `blockdiag-fontpath` value will be used
371
- <3> The second diagram does specifie a `fontpath` value.
372
- This overrides the global `blockdiag-fontpath` value.
373
-
374
- Each attribute can either be specified at the block level or at the document level.
375
- The attribute name at the block level should be prefixed with the name of the diagram type and a dash.
376
-
377
- ==== Shared Attributes
378
-
379
- [cols=">,<,<",options="header"]
380
- |===
381
- |Name |Default value |Description
382
- |svg-type |unspecified |One of `static`, `inline` or `interactive`. This determines the style of SVG embedding that's used in certain backends. The https://asciidoctor.org/docs/user-manual/#taming-svgs[asciidoctor user guide] describes this in more detail.
383
- |===
384
-
385
- ==== AsciiToSVG
386
-
387
- [cols=">,<,<",options="header"]
388
- |===
389
- |Name |Default value |Description
390
- |fontfamily |unspecified |The font family to use in the generated SVG image
391
- |noblur |unspecified |Disable drop-shadow blurring
392
- |===
393
-
394
- ==== Blockdiag
395
-
396
- [cols=">,<,<",options="header"]
397
- |===
398
- |Name |Default value |Description
399
- |fontpath |unspecified |The path to the font that should be used by blockdiag
400
- |===
401
-
402
- ==== BPMN
403
-
404
- [cols=">,<,<",options="header"]
405
- |===
406
- |Name |Default value |Description
407
- |height |786 |The target height of the diagram. Does not apply for output type `svg`.
408
- |width |1024 |The target width of the diagram. Does not apply for output type `svg`.
409
- |===
410
-
411
- ==== Ditaa
412
-
413
- [cols=">,<,<",options="header"]
414
- |===
415
- |Name |Default value |Description
416
- |scale |1 |A scale factor that is applied to the image.
417
- |tabs |8 |An integer value that specifies the tab size as a number of spaces.
418
- |background |FFFFFF |The background colour of the image. The format should be a six-digit hexadecimal number (as in HTML, FF0000 for red). Pass an eight-digit hex to define transparency.
419
- |antialias |true |Enables or disables anti-aliasing.
420
- |separation |true |Prevents the separation of common edges of shapes.
421
- |round-corners|false |Causes all corners to be rendered as round corners.
422
- |shadows |true |Enables or disable drop shadows.
423
- |debug |false |Renders the debug grid over the resulting image.
424
- |fixed-slope |false |Makes sides of parallelograms and trapezoids fixed slope instead of fixed width.
425
- |transparent |false |Makes the background of the image transparent instead of using the background color.
426
- |===
427
-
428
- ==== Gnuplot
429
-
430
- [cols=">,<,<",options="header"]
431
- |===
432
- |Name |Default value |Description
433
- |background |unspecified |Background color, e.g. `red`, `#FF0000`. Does not work with `txt`.
434
- |height |unspecified |The height of the plot. Must be specified together with `width`.
435
- |width |unspecified |The width of the plot. Must be specified together with `height`.
436
- |crop |unspecified |Trims blank space from the edges of the completed plot (true/false). Does not work with `svg`, `pdf`.
437
- |transparent |unspecified |Generate transparent background (true/false). Does not work with `svg`, `pdf`, `txt`.
438
- |font |unspecified |The font face with optional font size to use for the text, e.g. `font="Arial"`, `font="Arial,11"`. Does not work with `txt`.
439
- |fontscale |unspecified |Scales all label for given factor. Does not work with `txt`.
440
- |===
441
-
442
- ==== GraphViz
443
-
444
- [cols=">,<,<",options="header"]
445
- |===
446
- |Name |Default value |Description
447
- |layout |unspecified |The graphviz layout engine to use (dot -K option).
448
- |===
449
-
450
- ==== Meme
451
-
452
- [cols=">,<,<",options="header"]
453
- |===
454
- |Name |Default value |Description
455
- |fill-color |white |The fill color for the text.
456
- |stroke-color |black |The outline color for the text
457
- |stroke-width |2 |The width of the text outline.
458
- |font |Impact |The font face to use for the text.
459
- |options |unspecified |a comma separate list of flags that modify the image rendering. Currently only `noupcase` is supported which disable upper casing the labels.
460
- |===
461
-
462
- ==== Mermaid
463
-
464
- [cols=">,<,<",options="header"]
465
- |===
466
- |Name |Default value |Description
467
- |background |FFFFFF |The background colour of the image. The format should be a six-digit hexadecimal number (as in HTML, FF0000 for red). Pass an eight-digit hex to define transparency.
468
- |css |unspecified |Path to a CSS file to pass to mermaid.
469
- |config |unspecified |Path to a JSON config file to pass to mermaid.
470
- |gantt-config |unspecified |Path to a gantt config file to pass to mermaid.
471
- |puppeteer-config|unspecified |Path to a puppeteer config file to pass to mermaid.
472
- |sequence-config |unspecified |Path to a sequence config file to pass to mermaid.
473
- |theme |unspecified |Theme of the chart, could be default, forest, dark or neutral.
474
- |width |unspecified |Width of the page.
475
- |height |unspecified |Height of the page.
476
- |===
477
-
478
- ==== Msc
479
-
480
- [cols=">,<,<",options="header"]
481
- |===
482
- |Name |Default value |Description
483
- |font |unspecified |The name of the font that should be used by mscgen
484
- |===
485
-
486
- ==== PlantUML
487
-
488
- [cols=">,<,<",options="header"]
489
- |===
490
- |Name |Default value |Description
491
- |config |unspecified |Path to a config file to pass to PlantUML.
492
- |===
493
-
494
- ==== State Machine Cat
495
-
496
- [cols=">,<,<",options="header"]
497
- |===
498
- |Name |Default value |Description
499
- |direction |unspecifed |The direction of the state machine diagram. One of `top-down`, `bottom-top`, `left-right` or `right-left`.
500
- |engine |unspecified |The layout engine to use. One of `dot`, `circo`, `fdp`, `neato`, `osage`, or `twopi`
501
- |===
502
-
503
- ==== svgbob
504
-
505
- [cols=">,<,<",options="header"]
506
- |===
507
- |Name |Default value |Description
508
- |font-family |arial |text will be rendered with this font
509
- |font-size |14 |text will be rendered with this font size
510
- |scale |1 |scale the entire svg (dimensions, font size, stroke width) by this factor
511
- |stroke-width |2 |stroke width for all lines
512
- |===
37
+ ---------
513
38
 
514
- ==== Syntrax
39
+ After processing by Asciidoctor, the output file will show a rendered version of the diagram instead of the diagram source code.
515
40
 
516
- [cols=">,<,<",options="header"]
517
- |===
518
- |Name |Default value |Description
519
- |heading |unspecifed |Diagram title
520
- |scale |1 |A scale factor that is applied to the image.
521
- |style |unspecifed |Path to a style config file to pass to Syntrax.
522
- |transparent |false |Makes the background of the image transparent instead of opaque white.
523
- |===
41
+ image::docs/modules/ROOT/images/asciidoctor-diagram-process.png[]