asciidoctor-diagram 1.1.6-java → 1.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +6 -0
- data/examples/README.adoc +15 -3
- data/lib/asciidoctor-diagram/blockdiag.rb +2 -2
- data/lib/asciidoctor-diagram/blockdiag/extension.rb +1 -1
- data/lib/asciidoctor-diagram/ditaa.rb +2 -2
- data/lib/asciidoctor-diagram/ditaa/extension.rb +1 -1
- data/lib/asciidoctor-diagram/graphviz.rb +2 -2
- data/lib/asciidoctor-diagram/graphviz/extension.rb +5 -7
- data/lib/asciidoctor-diagram/plantuml.rb +3 -2
- data/lib/asciidoctor-diagram/plantuml/extension.rb +1 -1
- data/lib/asciidoctor-diagram/plantuml/generator.rb +5 -0
- data/lib/asciidoctor-diagram/shaape.rb +3 -2
- data/lib/asciidoctor-diagram/shaape/extension.rb +1 -1
- data/lib/asciidoctor-diagram/util/diagram.rb +62 -60
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/spec/plantuml_spec.rb +1 -1
- metadata +3 -4
- data/examples/build_example.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b96d5a431581be8bf355db36824853b11e0e3a36
|
4
|
+
data.tar.gz: 831efee428dad02cf3d13428b7ecd3a1264e48d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24e10af295c6b2f3c886f3fd0c9b986a74f3b5805df3d2649d41916ffc77f40d20d0e653d63acf9a9c6873228125260a9cd4d94cd7d9a0299a7d3dace9a2cbba
|
7
|
+
data.tar.gz: 0eaf95d9a2a1683d7d7b1798f055b23882ca56435162ef7b071d638ef6bcb1aba027ae4e79ba7b257c4b467993fdab06b48a807e55f942c28a6ecf44f2393830
|
data/CHANGELOG.adoc
CHANGED
data/examples/README.adoc
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
= Asciidoctor-diagram Examples
|
2
2
|
|
3
3
|
This directory contains a number of example files that illustrate how to use the asciidoctor-diagram extension.
|
4
|
-
|
5
|
-
In order to
|
6
|
-
This
|
4
|
+
|
5
|
+
In order to build the examples correctly the asciidoctor-diagram extension should be loaded.
|
6
|
+
This can be done using bundler by running
|
7
|
+
|
8
|
+
----
|
9
|
+
bundle exec asciidoctor -r asciidoctor-diagram <asciidoc file>
|
10
|
+
----
|
11
|
+
|
12
|
+
If you do not want to use bundler you can alternatively run
|
13
|
+
|
14
|
+
----
|
15
|
+
asciidoctor -r asciidoctor-diagram -I ../lib <asciidoc file>
|
16
|
+
----
|
17
|
+
|
18
|
+
This variant requires you to explicitly specify the load path from which asciidoctor-diagram can be loaded.
|
@@ -3,6 +3,6 @@ require_relative 'version'
|
|
3
3
|
|
4
4
|
Asciidoctor::Extensions.register do
|
5
5
|
require_relative 'blockdiag/extension'
|
6
|
-
block
|
7
|
-
block_macro
|
6
|
+
block Asciidoctor::Diagram::BlockDiagBlock, :blockdiag
|
7
|
+
block_macro Asciidoctor::Diagram::BlockDiagBlockMacro, :blockdiag
|
8
8
|
end
|
@@ -4,7 +4,7 @@ require_relative '../util/diagram'
|
|
4
4
|
module Asciidoctor
|
5
5
|
module Diagram
|
6
6
|
['BlockDiag', 'SeqDiag', 'ActDiag', 'NwDiag', 'RackDiag', 'PacketDiag'].each do |tool|
|
7
|
-
|
7
|
+
define_processors(tool) do
|
8
8
|
[:png, :svg].each do |f|
|
9
9
|
register_format(f, :image) do |c, p|
|
10
10
|
CliGenerator.generate(tool.downcase, p, c) do |tool_path, output_path|
|
@@ -3,6 +3,6 @@ require_relative 'version'
|
|
3
3
|
|
4
4
|
Asciidoctor::Extensions.register do
|
5
5
|
require_relative 'ditaa/extension'
|
6
|
-
block
|
7
|
-
block_macro
|
6
|
+
block Asciidoctor::Diagram::DitaaBlock, :ditaa
|
7
|
+
block_macro Asciidoctor::Diagram::DitaaBlockMacro, :ditaa
|
8
8
|
end
|
@@ -3,6 +3,6 @@ require_relative 'version'
|
|
3
3
|
|
4
4
|
Asciidoctor::Extensions.register do
|
5
5
|
require_relative 'graphviz/extension'
|
6
|
-
block
|
7
|
-
block_macro
|
6
|
+
block Asciidoctor::Diagram::GraphvizBlock, :graphviz
|
7
|
+
block_macro Asciidoctor::Diagram::GraphvizBlockMacro, :graphviz
|
8
8
|
end
|
@@ -3,13 +3,11 @@ require_relative '../util/diagram'
|
|
3
3
|
|
4
4
|
module Asciidoctor
|
5
5
|
module Diagram
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
[tool_path, "-o#{output_path}", "-T#{f.to_s}"]
|
12
|
-
end
|
6
|
+
define_processors('Graphviz') do
|
7
|
+
[:png, :svg].each do |f|
|
8
|
+
register_format(f, :image) do |c, p|
|
9
|
+
CliGenerator.generate('dot', p, c) do |tool_path, output_path|
|
10
|
+
[tool_path, "-o#{output_path}", "-T#{f.to_s}"]
|
13
11
|
end
|
14
12
|
end
|
15
13
|
end
|
@@ -3,6 +3,7 @@ require_relative 'version'
|
|
3
3
|
|
4
4
|
Asciidoctor::Extensions.register do
|
5
5
|
require_relative 'plantuml/extension'
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
block Asciidoctor::Diagram::PlantUmlBlock, :plantuml
|
8
|
+
block_macro Asciidoctor::Diagram::PlantUmlBlockMacro, :plantuml
|
8
9
|
end
|
@@ -22,6 +22,11 @@ module Asciidoctor
|
|
22
22
|
|
23
23
|
flags += ['-charset', 'UTF-8', '-failonerror', '-graphvizdot', @graphvizdot]
|
24
24
|
|
25
|
+
config_file = parent.document.attributes['plantumlconfig']
|
26
|
+
if config_file
|
27
|
+
flags += ['-config', File.expand_path(config_file, parent.document.attributes['docdir'])]
|
28
|
+
end
|
29
|
+
|
25
30
|
option = Java.new_object( Java.net.sourceforge.plantuml.Option, '[Ljava.lang.String;', Java.array_to_java_array(flags, :string) )
|
26
31
|
source_reader = Java.new_object( Java.net.sourceforge.plantuml.SourceStringReader,
|
27
32
|
'Lnet.sourceforge.plantuml.preproc.Defines;Ljava.lang.String;Ljava.util.List;',
|
@@ -3,6 +3,7 @@ require_relative 'version'
|
|
3
3
|
|
4
4
|
Asciidoctor::Extensions.register do
|
5
5
|
require_relative 'shaape/extension'
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
block Asciidoctor::Diagram::ShaapeBlock, :shaape
|
8
|
+
block_macro Asciidoctor::Diagram::ShaapeBlockMacro, :shaape
|
8
9
|
end
|
@@ -3,7 +3,7 @@ require_relative '../util/diagram'
|
|
3
3
|
|
4
4
|
module Asciidoctor
|
5
5
|
module Diagram
|
6
|
-
|
6
|
+
define_processors('Shaape') do
|
7
7
|
[:png, :svg].each do |f|
|
8
8
|
register_format(f, :image) do |c, p|
|
9
9
|
CliGenerator.generate('shaape', p, c) do |tool_path, output_path|
|
@@ -8,83 +8,85 @@ require_relative 'svg'
|
|
8
8
|
|
9
9
|
module Asciidoctor
|
10
10
|
module Diagram
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
:decoder => SVG
|
16
|
-
},
|
17
|
-
:png => {
|
18
|
-
:encoding => Encoding::ASCII_8BIT,
|
19
|
-
:decoder => PNG
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
module ClassMethods
|
24
|
-
#
|
25
|
-
# Registers a supported format. The first registered format becomes the default format for the block processor.
|
26
|
-
#
|
27
|
-
# +format+ is a symbol with the format name
|
28
|
-
# +type+ is a symbol and should be either :image or :literal
|
29
|
-
# +block+ is a block that produces the diagrams from code. The block receives the parent asciidoc block and the diagram code as arguments
|
30
|
-
#
|
31
|
-
def register_format(format, type, &block)
|
32
|
-
unless @default_format
|
33
|
-
@default_format = format
|
34
|
-
end
|
35
|
-
|
36
|
-
formats[format] = {
|
37
|
-
:type => type,
|
38
|
-
:generator => block
|
39
|
-
}
|
11
|
+
def self.define_processors(name, &init)
|
12
|
+
block = Class.new(Asciidoctor::Extensions::BlockProcessor) do
|
13
|
+
class << self
|
14
|
+
include FormatRegistry
|
40
15
|
end
|
16
|
+
include DiagramProcessor
|
41
17
|
|
42
|
-
|
43
|
-
|
44
|
-
|
18
|
+
option :pos_attrs, ['target', 'format']
|
19
|
+
option :contexts, [:listing, :literal, :open]
|
20
|
+
option :content_model, :simple
|
45
21
|
|
46
|
-
def
|
47
|
-
|
22
|
+
def process(parent, reader, attributes)
|
23
|
+
generate_block(parent, ReaderSource.new(reader), attributes)
|
48
24
|
end
|
49
|
-
end
|
50
25
|
|
51
|
-
|
52
|
-
base.extend ClassMethods
|
26
|
+
self.instance_eval &init
|
53
27
|
end
|
54
28
|
|
55
|
-
|
56
|
-
|
57
|
-
include
|
29
|
+
block_macro = Class.new(Asciidoctor::Extensions::BlockMacroProcessor) do
|
30
|
+
class << self
|
31
|
+
include FormatRegistry
|
32
|
+
end
|
33
|
+
include DiagramProcessor
|
58
34
|
|
59
|
-
|
60
|
-
option :contexts, [:listing, :literal, :open]
|
61
|
-
option :content_model, :simple
|
35
|
+
option :pos_attrs, ['target', 'format']
|
62
36
|
|
63
|
-
|
64
|
-
|
65
|
-
|
37
|
+
def process(parent, target, attributes)
|
38
|
+
source = FileSource.new(File.expand_path(target, parent.document.attributes['docdir']))
|
39
|
+
attributes['target'] ||= File.basename(target, File.extname(target))
|
66
40
|
|
67
|
-
|
41
|
+
generate_block(parent, source, attributes)
|
68
42
|
end
|
69
43
|
|
70
|
-
|
71
|
-
|
44
|
+
self.instance_eval &init
|
45
|
+
end
|
72
46
|
|
73
|
-
|
47
|
+
Asciidoctor::Diagram.const_set("#{name}Block", block)
|
48
|
+
Asciidoctor::Diagram.const_set("#{name}BlockMacro", block_macro)
|
49
|
+
end
|
74
50
|
|
75
|
-
|
76
|
-
|
77
|
-
|
51
|
+
module FormatRegistry
|
52
|
+
#
|
53
|
+
# Registers a supported format. The first registered format becomes the default format for the block processor.
|
54
|
+
#
|
55
|
+
# +format+ is a symbol with the format name
|
56
|
+
# +type+ is a symbol and should be either :image or :literal
|
57
|
+
# +block+ is a block that produces the diagrams from code. The block receives the parent asciidoc block and the diagram code as arguments
|
58
|
+
#
|
59
|
+
def register_format(format, type, &block)
|
60
|
+
unless @default_format
|
61
|
+
@default_format = format
|
62
|
+
end
|
78
63
|
|
79
|
-
|
80
|
-
|
64
|
+
formats[format] = {
|
65
|
+
:type => type,
|
66
|
+
:generator => block
|
67
|
+
}
|
68
|
+
end
|
81
69
|
|
82
|
-
|
83
|
-
|
70
|
+
def formats
|
71
|
+
@formats ||= {}
|
72
|
+
end
|
84
73
|
|
85
|
-
|
86
|
-
|
74
|
+
def default_format
|
75
|
+
@default_format
|
87
76
|
end
|
77
|
+
end
|
78
|
+
|
79
|
+
module DiagramProcessor
|
80
|
+
IMAGE_PARAMS = {
|
81
|
+
:svg => {
|
82
|
+
:encoding => Encoding::UTF_8,
|
83
|
+
:decoder => SVG
|
84
|
+
},
|
85
|
+
:png => {
|
86
|
+
:encoding => Encoding::ASCII_8BIT,
|
87
|
+
:decoder => PNG
|
88
|
+
}
|
89
|
+
}
|
88
90
|
|
89
91
|
private
|
90
92
|
|
@@ -197,7 +199,7 @@ module Asciidoctor
|
|
197
199
|
end
|
198
200
|
|
199
201
|
def code
|
200
|
-
@code ||= @reader.lines.join
|
202
|
+
@code ||= @reader.lines.join("\n")
|
201
203
|
end
|
202
204
|
end
|
203
205
|
|
data/spec/plantuml_spec.rb
CHANGED
@@ -127,7 +127,7 @@ User --> (Use the application) : Label
|
|
127
127
|
b = d.find { |b| b.context == :literal }
|
128
128
|
expect(b).to_not be_nil
|
129
129
|
|
130
|
-
expect(b.content_model).to eq :
|
130
|
+
expect(b.content_model).to eq :verbatim
|
131
131
|
|
132
132
|
expect(b.attributes['target']).to be_nil
|
133
133
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-diagram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Pepijn Van Eeckhoudt
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.5.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.5.0
|
69
69
|
description: Asciidoctor diagramming extension
|
70
70
|
email:
|
71
71
|
- pepijn@vaneeckhoudt.net
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- Rakefile
|
80
80
|
- examples/Gemfile
|
81
81
|
- examples/README.adoc
|
82
|
-
- examples/build_example.rb
|
83
82
|
- examples/design.adoc
|
84
83
|
- examples/features.adoc
|
85
84
|
- lib/asciidoctor-diagram.rb
|