asciidoctor-diagram 2.2.7 → 2.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +101 -0
- data/README.adoc +14 -14
- data/lib/asciidoctor-diagram/a2s/converter.rb +4 -1
- data/lib/asciidoctor-diagram/barcode/converter.rb +83 -78
- data/lib/asciidoctor-diagram/blockdiag/converter.rb +12 -2
- data/lib/asciidoctor-diagram/bpmn/converter.rb +4 -1
- data/lib/asciidoctor-diagram/bytefield/converter.rb +4 -1
- data/lib/asciidoctor-diagram/d2/converter.rb +14 -6
- data/lib/asciidoctor-diagram/dbml/converter.rb +27 -0
- data/lib/asciidoctor-diagram/dbml/extension.rb +18 -0
- data/lib/asciidoctor-diagram/dbml.rb +8 -0
- data/lib/asciidoctor-diagram/diagram_processor.rb +28 -5
- data/lib/asciidoctor-diagram/diagram_source.rb +42 -32
- data/lib/asciidoctor-diagram/diagrams/converter.rb +4 -1
- data/lib/asciidoctor-diagram/ditaa/converter.rb +12 -6
- data/lib/asciidoctor-diagram/ditaa/{ditaa-1.3.21.jar → ditaa-2.1.0.jar} +0 -0
- data/lib/asciidoctor-diagram/dpic/converter.rb +4 -1
- data/lib/asciidoctor-diagram/erd/converter.rb +4 -1
- data/lib/asciidoctor-diagram/gnuplot/converter.rb +6 -1
- data/lib/asciidoctor-diagram/graphviz/converter.rb +4 -1
- data/lib/asciidoctor-diagram/graphviz_py/converter.rb +4 -1
- data/lib/asciidoctor-diagram/http/converter.rb +0 -1
- data/lib/asciidoctor-diagram/lilypond/converter.rb +3 -2
- data/lib/asciidoctor-diagram/meme/converter.rb +3 -3
- data/lib/asciidoctor-diagram/mermaid/converter.rb +4 -2
- data/lib/asciidoctor-diagram/msc/converter.rb +5 -1
- data/lib/asciidoctor-diagram/nomnoml/converter.rb +4 -1
- data/lib/asciidoctor-diagram/penrose/converter.rb +53 -0
- data/lib/asciidoctor-diagram/penrose/extension.rb +18 -0
- data/lib/asciidoctor-diagram/penrose.rb +8 -0
- data/lib/asciidoctor-diagram/pikchr/converter.rb +4 -1
- data/lib/asciidoctor-diagram/plantuml/converter.rb +22 -10
- data/lib/asciidoctor-diagram/plantuml/plantuml-2.1.1.jar +0 -0
- data/lib/asciidoctor-diagram/shaape/converter.rb +4 -1
- data/lib/asciidoctor-diagram/smcat/converter.rb +5 -1
- data/lib/asciidoctor-diagram/structurizr/converter.rb +69 -0
- data/lib/asciidoctor-diagram/structurizr/extension.rb +52 -0
- data/lib/asciidoctor-diagram/structurizr/renderers.rb +63 -0
- data/lib/asciidoctor-diagram/structurizr/structurizr-2.1.1.jar +0 -0
- data/lib/asciidoctor-diagram/structurizr.rb +7 -0
- data/lib/asciidoctor-diagram/svgbob/converter.rb +4 -1
- data/lib/asciidoctor-diagram/symbolator/converter.rb +4 -1
- data/lib/asciidoctor-diagram/syntrax/converter.rb +67 -17
- data/lib/asciidoctor-diagram/syntrax/syntrax-2.1.0.jar +0 -0
- data/lib/asciidoctor-diagram/tikz/converter.rb +4 -1
- data/lib/asciidoctor-diagram/umlet/converter.rb +4 -1
- data/lib/asciidoctor-diagram/util/cli.rb +10 -2
- data/lib/asciidoctor-diagram/util/cli_generator.rb +1 -0
- data/lib/asciidoctor-diagram/util/java_jruby.rb +4 -0
- data/lib/asciidoctor-diagram/util/java_socket.rb +4 -0
- data/lib/asciidoctor-diagram/util/{server-1.3.21.jar → server-2.1.0.jar} +0 -0
- data/lib/asciidoctor-diagram/vega/converter.rb +5 -3
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/asciidoctor-diagram/wavedrom/converter.rb +38 -24
- data/lib/asciidoctor-diagram.rb +3 -0
- metadata +24 -85
- data/Rakefile +0 -9
- data/docs/antora.yml +0 -3
- data/docs/modules/ROOT/images/asciidoctor-diagram-classes.png +0 -0
- data/docs/modules/ROOT/images/asciidoctor-diagram-process.png +0 -0
- data/docs/modules/ROOT/pages/index.adoc +0 -21
- data/docs/modules/ROOT/partials/advanced.adoc +0 -382
- data/docs/modules/ROOT/partials/create_diagram.adoc +0 -135
- data/docs/modules/ROOT/partials/generate.adoc +0 -15
- data/docs/modules/ROOT/partials/installation.adoc +0 -19
- data/docs/modules/ROOT/partials/uris.adoc +0 -44
- data/examples/Gemfile +0 -3
- data/examples/README.adoc +0 -18
- data/examples/design.adoc +0 -78
- data/examples/features.adoc +0 -189
- data/lib/asciidoctor-diagram/plantuml/plantuml-1.3.24.jar +0 -0
- data/spec/a2s_spec.rb +0 -33
- data/spec/barcode_spec.rb +0 -176
- data/spec/blockdiag_spec.rb +0 -20
- data/spec/bpmn_spec.rb +0 -60
- data/spec/bytefield_spec.rb +0 -96
- data/spec/d2_spec.rb +0 -37
- data/spec/diagrams_spec.rb +0 -27
- data/spec/ditaa_spec.rb +0 -191
- data/spec/dpic_spec.rb +0 -23
- data/spec/erd_spec.rb +0 -96
- data/spec/gnuplot_spec.rb +0 -229
- data/spec/graphviz_py_spec.rb +0 -33
- data/spec/graphviz_spec.rb +0 -24
- data/spec/lilypond_spec.rb +0 -17
- data/spec/man.jpg +0 -0
- data/spec/meme_spec.rb +0 -67
- data/spec/mermaid_spec.rb +0 -198
- data/spec/msc_spec.rb +0 -37
- data/spec/nomnoml_spec.rb +0 -36
- data/spec/pikchr_spec.rb +0 -73
- data/spec/plantuml_spec.rb +0 -800
- data/spec/shaape_spec.rb +0 -20
- data/spec/shared_examples.rb +0 -764
- data/spec/smcat_spec.rb +0 -30
- data/spec/svgbob_spec.rb +0 -33
- data/spec/symbolator_spec.rb +0 -27
- data/spec/syntrax_spec.rb +0 -22
- data/spec/test_helper.rb +0 -113
- data/spec/tikz_spec.rb +0 -181
- data/spec/umlet_spec.rb +0 -32
- data/spec/vega_spec.rb +0 -133
- data/spec/wavedrom_spec.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b7d586b723b3485288bc8127bbae0ce102fb2d6b07269a98790c01952aa2434
|
|
4
|
+
data.tar.gz: 97316ae03795b92cd09fd0baf9ecd86b5a68618a5a653e20d905fe3e66dd4c6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 498776729f7aa965ad47f6ff9fe11bd16a09e389eab45a060b80675fd638bd05c4917a686e1effa787afaa67002c549817cdb36c8453453cb9010b9c33effa68
|
|
7
|
+
data.tar.gz: 6d6dc3314c9163832907cf7a5a45a2802976de6c9c04ef737463cdb2ec7ecb0c87db5f79dcf6bc5001705a10ea959635d66a88af7aa2f8b72bdde40af658d26b
|
data/CHANGELOG.adoc
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
|
2
2
|
|
|
3
|
+
== 2.3.0
|
|
4
|
+
|
|
5
|
+
Enhancements::
|
|
6
|
+
|
|
7
|
+
* Issue #457: Relaxed Java version requirement from 11 to 1.8 (for tools that support it)
|
|
8
|
+
|
|
9
|
+
== 2.2.18
|
|
10
|
+
|
|
11
|
+
Enhancements::
|
|
12
|
+
|
|
13
|
+
* Add opt-in support for the PlantUML Smetana layout engine
|
|
14
|
+
|
|
15
|
+
== 2.2.17
|
|
16
|
+
|
|
17
|
+
Bugfixes::
|
|
18
|
+
|
|
19
|
+
* Issue #455: Fix regression in reading of UTF-8 source files introduced in 2.2.15
|
|
20
|
+
|
|
21
|
+
== 2.2.16
|
|
22
|
+
|
|
23
|
+
Bugfixes::
|
|
24
|
+
|
|
25
|
+
* Issue #453: Avoid internal error when WaveDrom cannot be located
|
|
26
|
+
|
|
27
|
+
== 2.2.15
|
|
28
|
+
|
|
29
|
+
Enhacements::
|
|
30
|
+
|
|
31
|
+
* Issue #453: Improve error message when WaveDrom cannot be located
|
|
32
|
+
|
|
33
|
+
Bugfixes::
|
|
34
|
+
|
|
35
|
+
* Issue #428: Improve support for reading UTF-16 encoded source files
|
|
36
|
+
* Issue #449: Fix resolving of relative `!include` paths in Structurizr DSL input.
|
|
37
|
+
|
|
38
|
+
== 2.2.14
|
|
39
|
+
|
|
40
|
+
Bugfixes::
|
|
41
|
+
|
|
42
|
+
* Issue #441: Fix regression in Wavedrom integration.
|
|
43
|
+
|
|
44
|
+
== 2.2.13
|
|
45
|
+
|
|
46
|
+
Enhancements::
|
|
47
|
+
|
|
48
|
+
* Issue #436: Allow diagram caching to be disabled using the `nocache` option.
|
|
49
|
+
|
|
50
|
+
Bugfixes::
|
|
51
|
+
|
|
52
|
+
* Issue #437: Set working directory when generating diagrams.
|
|
53
|
+
* Issue #439: Resolve errors when using relative imports in D2 diagrams
|
|
54
|
+
|
|
55
|
+
== 2.2.12
|
|
56
|
+
|
|
57
|
+
Enhancements::
|
|
58
|
+
|
|
59
|
+
* Issue #431: Reduce gem file size
|
|
60
|
+
* Resolve loading errors when loading the PlantUML and Struturizr extensions individually
|
|
61
|
+
|
|
62
|
+
== 2.2.11
|
|
63
|
+
|
|
64
|
+
Bugfixes::
|
|
65
|
+
|
|
66
|
+
* Issue #424: avoid invalid filename characters on Windows
|
|
67
|
+
|
|
68
|
+
== 2.2.10
|
|
69
|
+
|
|
70
|
+
Enhancements::
|
|
71
|
+
|
|
72
|
+
* The location of JSyntrax and Structurizr can now also be specified using Java system properties when using JRuby.
|
|
73
|
+
* Add initial https://penrose.cs.cmu.edu[Penrose] support
|
|
74
|
+
|
|
75
|
+
Bugfixes::
|
|
76
|
+
|
|
77
|
+
* Ensure Structurizr themes are loaded when rendering images
|
|
78
|
+
* Issue #416: Silence Asciidoctor warning when using inline macros
|
|
79
|
+
* Issue #417: Avoid reusing images when block type is different but source code is identical
|
|
80
|
+
* Remove usage of LilyPond's 'safe' option since it's no longer supported
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
== 2.2.9
|
|
84
|
+
|
|
85
|
+
Bugfixes::
|
|
86
|
+
|
|
87
|
+
* Resolve UTF-8 encoding error when generating SVG for GS1-128 barcodes
|
|
88
|
+
* Issue #409: Second attempt at fixing handling of the D2 `sketch` attribute
|
|
89
|
+
* Issue #415: Resolve NoMethodError when using Structurizr blocks
|
|
90
|
+
|
|
91
|
+
== 2.2.8
|
|
92
|
+
|
|
93
|
+
Enhancements::
|
|
94
|
+
|
|
95
|
+
* Add support for reusing JSyntrax subprocess instances to improve performance when rendering many syntax diagrams (@gitrbond, @inponomarev)
|
|
96
|
+
* Issue #386: Add basic https://structurizr.com[Structurizr] support
|
|
97
|
+
|
|
98
|
+
Bugfixes::
|
|
99
|
+
|
|
100
|
+
* Issue #409: Fix handling of the D2 `sketch` attribute
|
|
101
|
+
* Issue #410: Ensure current directory is always set to document base directory when invoking subprocesses
|
|
102
|
+
|
|
3
103
|
== 2.2.7
|
|
4
104
|
|
|
5
105
|
Enhancements::
|
|
@@ -25,6 +125,7 @@ Enhancements::
|
|
|
25
125
|
Enhancements::
|
|
26
126
|
|
|
27
127
|
* Issue #399: Add support for PlantUML theme attribute
|
|
128
|
+
* Add DBML support via https://github.com/softwaretechnik-berlin/dbml-renderer[dbml-renderer]
|
|
28
129
|
|
|
29
130
|
== 2.2.3
|
|
30
131
|
|
data/README.adoc
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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
4
|
|
|
5
|
-
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Linux%20unit%20tests/badge.svg?branch=
|
|
6
|
-
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/macOS%20unit%20tests/badge.svg?branch=
|
|
7
|
-
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Windows%20unit%20tests/badge.svg?branch=
|
|
5
|
+
image:https://github.com/asciidoctor/asciidoctor-diagram/workflows/Linux%20unit%20tests/badge.svg?branch=main["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=main["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=main["Windows Build Status", link="https://github.com/asciidoctor/asciidoctor-diagram/actions?query=workflow%3A%22Windows+unit+tests%22"]
|
|
8
8
|
image:https://badge.fury.io/rb/asciidoctor-diagram.svg[Gem Version, link=https://rubygems.org/gems/asciidoctor-diagram]
|
|
9
9
|
|
|
10
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.
|
|
@@ -23,19 +23,19 @@ The example below shows an embedded Ditaa diagram block.
|
|
|
23
23
|
---------
|
|
24
24
|
[ditaa]
|
|
25
25
|
----
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
+--------+
|
|
34
|
-
| adoc
|
|
35
|
-
+--------+
|
|
26
|
+
+-------------+
|
|
27
|
+
| asciidoctor |---------------+
|
|
28
|
+
| diagram | |
|
|
29
|
+
+-------------+ | image
|
|
30
|
+
^ |
|
|
31
|
+
| diagram source |
|
|
32
|
+
| v
|
|
33
|
+
+--------+ +------+------+ /--------------\
|
|
34
|
+
| adoc |------>+ asciidoctor +------->| HTML + image |
|
|
35
|
+
+--------+ +-------------+ html \--------------/
|
|
36
36
|
----
|
|
37
37
|
---------
|
|
38
38
|
|
|
39
39
|
After processing by Asciidoctor, the output file will show a rendered version of the diagram instead of the diagram source code.
|
|
40
40
|
|
|
41
|
-
image::docs/modules/ROOT/images/asciidoctor-diagram-process.png[]
|
|
41
|
+
image::docs/modules/ROOT/images/asciidoctor-diagram-process.png[]
|
|
@@ -27,7 +27,7 @@ module Asciidoctor
|
|
|
27
27
|
include DiagramConverter
|
|
28
28
|
|
|
29
29
|
def supported_formats
|
|
30
|
-
[:
|
|
30
|
+
[:svg, :png, :txt]
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def collect_options(source)
|
|
@@ -52,84 +52,88 @@ module Asciidoctor
|
|
|
52
52
|
code = source.code
|
|
53
53
|
type = source.config[:type]
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
55
|
+
begin
|
|
56
|
+
case type
|
|
57
|
+
when :bookland
|
|
58
|
+
require 'barby/barcode/bookland'
|
|
59
|
+
barcode = Barby::Bookland.new(code)
|
|
60
|
+
when :codabar
|
|
61
|
+
require 'barby/barcode/codabar'
|
|
62
|
+
barcode = Barby::Codabar.new(code)
|
|
63
|
+
when :code25
|
|
64
|
+
require 'barby/barcode/code_25'
|
|
65
|
+
barcode = Barby::Code25.new(code)
|
|
66
|
+
when :code25iata
|
|
67
|
+
require 'barby/barcode/code_25_iata'
|
|
68
|
+
barcode = Barby::Code25IATA.new(code)
|
|
69
|
+
when :code25interleaved
|
|
70
|
+
require 'barby/barcode/code_25_interleaved'
|
|
71
|
+
barcode = Barby::Code25Interleaved.new(code)
|
|
72
|
+
when :code39
|
|
73
|
+
require 'barby/barcode/code_39'
|
|
74
|
+
barcode = Barby::Code39.new(code)
|
|
75
|
+
when :code93
|
|
76
|
+
require 'barby/barcode/code_93'
|
|
77
|
+
barcode = Barby::Code93.new(code)
|
|
78
|
+
when :code128
|
|
79
|
+
require 'barby/barcode/code_128'
|
|
80
|
+
barcode = Barby::Code128.new(code)
|
|
81
|
+
when :code128a
|
|
82
|
+
require 'barby/barcode/code_128'
|
|
83
|
+
barcode = Barby::Code128A.new(code)
|
|
84
|
+
when :code128b
|
|
85
|
+
require 'barby/barcode/code_128'
|
|
86
|
+
barcode = Barby::Code128B.new(code)
|
|
87
|
+
when :code128c
|
|
88
|
+
require 'barby/barcode/code_128'
|
|
89
|
+
barcode = Barby::Code128C.new(code)
|
|
90
|
+
when :ean8
|
|
91
|
+
require 'barby/barcode/ean_8'
|
|
92
|
+
barcode = Barby::EAN8.new(code)
|
|
93
|
+
when :ean13
|
|
94
|
+
require 'barby/barcode/ean_13'
|
|
95
|
+
barcode = Barby::EAN13.new(code)
|
|
96
|
+
when :gs1_128
|
|
97
|
+
require 'barby/barcode/code_128'
|
|
98
|
+
gs1_code = code.gsub /\([^)]+\)/ do |control|
|
|
99
|
+
case control.upcase
|
|
100
|
+
when '(FNC1)'
|
|
101
|
+
Barby::Code128::FNC1
|
|
102
|
+
when '(FNC2)'
|
|
103
|
+
Barby::Code128::FNC2
|
|
104
|
+
when '(FNC3)'
|
|
105
|
+
Barby::Code128::FNC3
|
|
106
|
+
when '(FNC4)'
|
|
107
|
+
Barby::Code128::FNC4
|
|
108
|
+
when '(CODEA)'
|
|
109
|
+
Barby::Code128::CODEA
|
|
110
|
+
when '(CODEB)'
|
|
111
|
+
Barby::Code128::CODEB
|
|
112
|
+
when '(CODEC)'
|
|
113
|
+
Barby::Code128::CODEC
|
|
114
|
+
when '(SHIFT)'
|
|
115
|
+
Barby::Code128::SHIFT
|
|
116
|
+
when '(SP)'
|
|
117
|
+
' '
|
|
118
|
+
else
|
|
119
|
+
control
|
|
120
|
+
end
|
|
119
121
|
end
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
gs1_code = gs1_code.gsub(/\s+/, '')
|
|
123
|
+
gs1_code = gs1_code.prepend(Barby::Code128::FNC1) unless gs1_code[0] == Barby::Code128::FNC1
|
|
124
|
+
barcode = Barby::Code128.new(gs1_code)
|
|
125
|
+
when :qrcode
|
|
126
|
+
BarcodeDependencies::QRCODE_DEPENDENCIES.each_pair { |n, v| source.ensure_gem(n, v) }
|
|
127
|
+
require 'barby/barcode/qr_code'
|
|
128
|
+
barcode = Barby::QrCode.new(code)
|
|
129
|
+
when :upca
|
|
130
|
+
require 'barby/barcode/ean_13'
|
|
131
|
+
barcode = Barby::UPCA.new(code)
|
|
132
|
+
else
|
|
133
|
+
raise "Unsupported barcode type: #{type}"
|
|
134
|
+
end
|
|
135
|
+
rescue ArgumentError
|
|
136
|
+
raise "Invalid #{type} data"
|
|
133
137
|
end
|
|
134
138
|
|
|
135
139
|
case format
|
|
@@ -142,6 +146,7 @@ module Asciidoctor
|
|
|
142
146
|
barcode.to_png(options)
|
|
143
147
|
when :svg
|
|
144
148
|
require_relative 'svg_outputter'
|
|
149
|
+
options[:title] = code
|
|
145
150
|
options[:foreground] = "##{options[:foreground]}" if options[:foreground] =~ /^[0-9a-f]+$/i
|
|
146
151
|
options[:background] = "##{options[:background]}" if options[:background] =~ /^[0-9a-f]+$/i
|
|
147
152
|
barcode.to_svg(options)
|
|
@@ -13,19 +13,29 @@ module Asciidoctor
|
|
|
13
13
|
[:png, :pdf, :svg]
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def collect_options(source)
|
|
17
|
+
{
|
|
18
|
+
:font_path => source.attr('fontpath')
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
|
|
16
22
|
def convert(source, format, options)
|
|
17
23
|
# On Debian based systems the Python 3.x packages python3-(act|block|nw|seq)diag executables with
|
|
18
24
|
# a '3' suffix.
|
|
19
25
|
cmd_name = self.class.const_get(:TOOL)
|
|
20
26
|
alt_cmd_name = "#{cmd_name}3"
|
|
21
27
|
|
|
22
|
-
font_path =
|
|
28
|
+
font_path = options[:font_path]
|
|
23
29
|
|
|
24
30
|
generate_stdin(source.find_command(cmd_name, :alt_cmds => [alt_cmd_name]), format.to_s, source.to_s) do |tool_path, output_path|
|
|
25
31
|
args = [tool_path, '-a', '-o', Platform.native_path(output_path), "-T#{format.to_s}"]
|
|
26
32
|
args << "-f#{Platform.native_path(font_path)}" if font_path
|
|
27
33
|
args << '-'
|
|
28
|
-
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
:args => args,
|
|
37
|
+
:chdir => source.base_dir
|
|
38
|
+
}
|
|
29
39
|
end
|
|
30
40
|
end
|
|
31
41
|
end
|
|
@@ -18,7 +18,10 @@ module Asciidoctor
|
|
|
18
18
|
bytefield_path = source.find_command('bytefield-svg')
|
|
19
19
|
|
|
20
20
|
generate_stdin(bytefield_path, format.to_s, source.to_s) do |tool_path, output_path|
|
|
21
|
-
|
|
21
|
+
{
|
|
22
|
+
:args => [tool_path, "--output", Platform.native_path(output_path)],
|
|
23
|
+
:chdir => source.base_dir
|
|
24
|
+
}
|
|
22
25
|
end
|
|
23
26
|
end
|
|
24
27
|
end
|
|
@@ -23,25 +23,33 @@ module Asciidoctor
|
|
|
23
23
|
:font_regular => source.attr('font-regular'),
|
|
24
24
|
:font_italic => source.attr('font-italic'),
|
|
25
25
|
:font_bold => source.attr('font-bold')
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def convert(source, format, options)
|
|
30
|
-
|
|
30
|
+
generate_stdin(source.find_command('d2'), format.to_s, source.code) do |tool_path, output_path|
|
|
31
31
|
args = [tool_path, '--browser', 'false']
|
|
32
32
|
|
|
33
33
|
options.each_pair do |key, value|
|
|
34
|
-
|
|
34
|
+
flag = "--#{key.to_s.gsub('_', '-')}"
|
|
35
35
|
|
|
36
|
-
if key.
|
|
36
|
+
if key == :sketch && !value.nil? && value != 'false'
|
|
37
|
+
args << flag
|
|
38
|
+
elsif key.to_s.start_with?('font') && !value.nil?
|
|
37
39
|
args << Platform.native_path(value)
|
|
38
|
-
|
|
40
|
+
elsif !value.nil?
|
|
41
|
+
args << flag
|
|
39
42
|
args << value
|
|
40
43
|
end
|
|
41
44
|
end
|
|
42
45
|
|
|
43
|
-
args <<
|
|
46
|
+
args << '-'
|
|
44
47
|
args << Platform.native_path(output_path)
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
:args => args,
|
|
51
|
+
:chdir => source.base_dir
|
|
52
|
+
}
|
|
45
53
|
end
|
|
46
54
|
end
|
|
47
55
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require_relative '../diagram_converter'
|
|
2
|
+
require_relative '../util/cli_generator'
|
|
3
|
+
require_relative '../util/platform'
|
|
4
|
+
|
|
5
|
+
module Asciidoctor
|
|
6
|
+
module Diagram
|
|
7
|
+
# @private
|
|
8
|
+
class DbmlConverter
|
|
9
|
+
include DiagramConverter
|
|
10
|
+
include CliGenerator
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def supported_formats
|
|
14
|
+
[:svg]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def convert(source, format, options)
|
|
18
|
+
generate_stdin_stdout(source.find_command('dbml-renderer'), source.code) do |tool|
|
|
19
|
+
{
|
|
20
|
+
:args => [tool],
|
|
21
|
+
:chdir => source.base_dir
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require_relative 'converter'
|
|
2
|
+
require_relative '../diagram_processor'
|
|
3
|
+
|
|
4
|
+
module Asciidoctor
|
|
5
|
+
module Diagram
|
|
6
|
+
class DbmlBlockProcessor < DiagramBlockProcessor
|
|
7
|
+
use_converter DbmlConverter
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class DbmlBlockMacroProcessor < DiagramBlockMacroProcessor
|
|
11
|
+
use_converter DbmlConverter
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class DbmlInlineMacroProcessor < DiagramInlineMacroProcessor
|
|
15
|
+
use_converter DbmlConverter
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
require 'asciidoctor/extensions'
|
|
2
|
+
require_relative 'dbml/extension'
|
|
3
|
+
|
|
4
|
+
Asciidoctor::Extensions.register do
|
|
5
|
+
block Asciidoctor::Diagram::DbmlBlockProcessor, :dbml
|
|
6
|
+
block_macro Asciidoctor::Diagram::DbmlBlockMacroProcessor, :dbml
|
|
7
|
+
inline_macro Asciidoctor::Diagram::DbmlInlineMacroProcessor, :dbml
|
|
8
|
+
end
|
|
@@ -64,6 +64,12 @@ module Asciidoctor
|
|
|
64
64
|
location = parent.document.reader.cursor_at_mark
|
|
65
65
|
|
|
66
66
|
normalised_attributes = attributes.inject({}) { |h, (k, v)| h[normalise_attribute_name(k)] = v; h }
|
|
67
|
+
pos_attr_index = config.fetch(:positional_attrs, []).length + 1
|
|
68
|
+
until attributes[pos_attr_index].nil?
|
|
69
|
+
normalised_attributes[attributes[pos_attr_index]] = 'true'
|
|
70
|
+
pos_attr_index = pos_attr_index + 1
|
|
71
|
+
end
|
|
72
|
+
|
|
67
73
|
converter = config[:converter].new
|
|
68
74
|
|
|
69
75
|
supported_formats = supported_formats(converter)
|
|
@@ -159,7 +165,9 @@ module Asciidoctor
|
|
|
159
165
|
image_file = parent.normalize_system_path(image_name, image_output_dir(parent))
|
|
160
166
|
metadata_file = parent.normalize_system_path("#{image_name}.cache", cache_dir(source, parent))
|
|
161
167
|
|
|
162
|
-
|
|
168
|
+
use_cache = !source.global_opt('nocache')
|
|
169
|
+
|
|
170
|
+
if use_cache && File.exist?(metadata_file)
|
|
163
171
|
metadata = File.open(metadata_file, 'r') {|f| JSON.load(f, nil, :symbolize_names => true, :create_additions => false) }
|
|
164
172
|
else
|
|
165
173
|
metadata = {}
|
|
@@ -185,14 +193,18 @@ module Asciidoctor
|
|
|
185
193
|
metadata = source.create_image_metadata
|
|
186
194
|
metadata[:options] = options
|
|
187
195
|
|
|
188
|
-
allow_image_optimisation = source.
|
|
196
|
+
allow_image_optimisation = !source.global_opt('nooptimise')
|
|
189
197
|
result, metadata[:width], metadata[:height] = params[:decoder].post_process_image(result, allow_image_optimisation)
|
|
190
198
|
|
|
191
199
|
FileUtils.mkdir_p(File.dirname(image_file)) unless Dir.exist?(File.dirname(image_file))
|
|
192
200
|
File.open(image_file, 'wb') {|f| f.write result}
|
|
193
201
|
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
if use_cache
|
|
203
|
+
FileUtils.mkdir_p(File.dirname(metadata_file)) unless Dir.exist?(File.dirname(metadata_file))
|
|
204
|
+
File.open(metadata_file, 'w') { |f| JSON.dump(metadata, f) }
|
|
205
|
+
else
|
|
206
|
+
File.delete(metadata_file) if File.exist?(metadata_file)
|
|
207
|
+
end
|
|
196
208
|
end
|
|
197
209
|
|
|
198
210
|
scale = image_attributes['scale']
|
|
@@ -356,6 +368,7 @@ module Asciidoctor
|
|
|
356
368
|
include DiagramProcessor
|
|
357
369
|
|
|
358
370
|
def self.inherited(subclass)
|
|
371
|
+
subclass.use_dsl
|
|
359
372
|
subclass.name_positional_attributes ['target', 'format']
|
|
360
373
|
subclass.contexts [:listing, :literal, :open]
|
|
361
374
|
subclass.content_model :simple
|
|
@@ -374,6 +387,7 @@ module Asciidoctor
|
|
|
374
387
|
include DiagramProcessor
|
|
375
388
|
|
|
376
389
|
def self.inherited(subclass)
|
|
390
|
+
subclass.use_dsl
|
|
377
391
|
subclass.name_positional_attributes ['format']
|
|
378
392
|
end
|
|
379
393
|
|
|
@@ -415,7 +429,16 @@ module Asciidoctor
|
|
|
415
429
|
block = generate_block(parent, reader_or_target, attributes)
|
|
416
430
|
attrs = block.attributes.dup
|
|
417
431
|
target = attrs.delete('target')
|
|
418
|
-
|
|
432
|
+
|
|
433
|
+
# Don't let the asciidoctor try to apply substitutions.
|
|
434
|
+
# The text of inline macros is nil which will cause an error
|
|
435
|
+
attrs.delete('subs')
|
|
436
|
+
|
|
437
|
+
if block.context == :image
|
|
438
|
+
create_inline(parent, :image, nil, :type => 'image', :target => target, :attributes => attrs)
|
|
439
|
+
else
|
|
440
|
+
create_inline(parent, :quoted, block.source, :type => :monospaced, :attributes => attrs)
|
|
441
|
+
end
|
|
419
442
|
end
|
|
420
443
|
|
|
421
444
|
def supported_formats(converter)
|