asciidoctor-diagram 1.1.6-java → 1.2.0-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09829992d77c04af14ead06c234d1bd419290c63
4
- data.tar.gz: 35a0b6376b1546967d093fb1e26acefce3cb7c08
3
+ metadata.gz: b96d5a431581be8bf355db36824853b11e0e3a36
4
+ data.tar.gz: 831efee428dad02cf3d13428b7ecd3a1264e48d2
5
5
  SHA512:
6
- metadata.gz: c0cc883aeeb61dad988639e95cdcb24cd7019d328c57dfdcc20078d07e9830078d0a5ffc292cdfaef9ad577c9ac1b0b6cbda0c8dc8b34fe33d100f2506548cea
7
- data.tar.gz: 1a113811b3b33ba6529aba3973a9f2359544c07fcafebe9f58339b794beb16706dd82fdfb312f592a825e954c5a3e440b69cedfd22b7bcaaa175ce42171a3bec
6
+ metadata.gz: 24e10af295c6b2f3c886f3fd0c9b986a74f3b5805df3d2649d41916ffc77f40d20d0e653d63acf9a9c6873228125260a9cd4d94cd7d9a0299a7d3dace9a2cbba
7
+ data.tar.gz: 0eaf95d9a2a1683d7d7b1798f055b23882ca56435162ef7b071d638ef6bcb1aba027ae4e79ba7b257c4b467993fdab06b48a807e55f942c28a6ecf44f2393830
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 1.2.0
4
+
5
+ Enhancements::
6
+
7
+ * Updated to Asciidoctor 1.5.0
8
+
3
9
  == 1.1.6
4
10
 
5
11
  Enhancements::
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
- Asciidoctor 0.1.4 does not support loading extensions via the command line.
5
- In order to process the examples correctly you should use the `build-example.rb` script.
6
- This wraps the regular `asciidoctor` command line tool and automatically loads the asciidoctor-diagram extension.
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 :blockdiag, Asciidoctor::Diagram::BlockDiagBlock
7
- block_macro :blockdiag, Asciidoctor::Diagram::BlockDiagBlockMacro
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
- DiagramProcessor.define_processors(tool) do
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 :ditaa, Asciidoctor::Diagram::DitaaBlock
7
- block_macro :ditaa, Asciidoctor::Diagram::DitaaBlockMacro
6
+ block Asciidoctor::Diagram::DitaaBlock, :ditaa
7
+ block_macro Asciidoctor::Diagram::DitaaBlockMacro, :ditaa
8
8
  end
@@ -27,7 +27,7 @@ module Asciidoctor
27
27
  end
28
28
  end
29
29
 
30
- DiagramProcessor.define_processors('Ditaa') do
30
+ define_processors('Ditaa') do
31
31
  register_format(:png, :image) do |c|
32
32
  DitaaGenerator.ditaa(c)
33
33
  end
@@ -3,6 +3,6 @@ require_relative 'version'
3
3
 
4
4
  Asciidoctor::Extensions.register do
5
5
  require_relative 'graphviz/extension'
6
- block :graphviz, Asciidoctor::Diagram::GraphvizBlock
7
- block_macro :graphviz, Asciidoctor::Diagram::GraphvizBlockMacro
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
- module Diagram
7
- DiagramProcessor.define_processors('Graphviz') do
8
- [:png, :svg].each do |f|
9
- register_format(f, :image) do |c, p|
10
- CliGenerator.generate('dot', p, c) do |tool_path, output_path|
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
- block :plantuml, Asciidoctor::Diagram::PlantUmlBlock
7
- block_macro :plantuml, Asciidoctor::Diagram::PlantUmlBlockMacro
6
+
7
+ block Asciidoctor::Diagram::PlantUmlBlock, :plantuml
8
+ block_macro Asciidoctor::Diagram::PlantUmlBlockMacro, :plantuml
8
9
  end
@@ -3,7 +3,7 @@ require_relative 'generator'
3
3
 
4
4
  module Asciidoctor
5
5
  module Diagram
6
- DiagramProcessor.define_processors('PlantUml') do
6
+ define_processors('PlantUml') do
7
7
  def config_args(parent)
8
8
  config_args = []
9
9
  config = parent.document.attributes['plantumlconfig']
@@ -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
- block :shaape, Asciidoctor::Diagram::ShaapeBlock
7
- block_macro :shaape, Asciidoctor::Diagram::ShaapeBlockMacro
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
- DiagramProcessor.define_processors('Shaape') do
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
- module DiagramProcessor
12
- IMAGE_PARAMS = {
13
- :svg => {
14
- :encoding => Encoding::UTF_8,
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
- def formats
43
- @formats ||= {}
44
- end
18
+ option :pos_attrs, ['target', 'format']
19
+ option :contexts, [:listing, :literal, :open]
20
+ option :content_model, :simple
45
21
 
46
- def default_format
47
- @default_format
22
+ def process(parent, reader, attributes)
23
+ generate_block(parent, ReaderSource.new(reader), attributes)
48
24
  end
49
- end
50
25
 
51
- def self.included base
52
- base.extend ClassMethods
26
+ self.instance_eval &init
53
27
  end
54
28
 
55
- def self.define_processors(name, &init)
56
- block = Class.new(Asciidoctor::Extensions::BlockProcessor) do
57
- include DiagramProcessor
29
+ block_macro = Class.new(Asciidoctor::Extensions::BlockMacroProcessor) do
30
+ class << self
31
+ include FormatRegistry
32
+ end
33
+ include DiagramProcessor
58
34
 
59
- option :pos_attrs, ['target', 'format']
60
- option :contexts, [:listing, :literal, :open]
61
- option :content_model, :simple
35
+ option :pos_attrs, ['target', 'format']
62
36
 
63
- def process(parent, reader, attributes)
64
- generate_block(parent, ReaderSource.new(reader), attributes)
65
- end
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
- self.instance_eval &init
41
+ generate_block(parent, source, attributes)
68
42
  end
69
43
 
70
- block_macro = Class.new(Asciidoctor::Extensions::BlockMacroProcessor) do
71
- include DiagramProcessor
44
+ self.instance_eval &init
45
+ end
72
46
 
73
- option :pos_attrs, ['target', 'format']
47
+ Asciidoctor::Diagram.const_set("#{name}Block", block)
48
+ Asciidoctor::Diagram.const_set("#{name}BlockMacro", block_macro)
49
+ end
74
50
 
75
- def process(parent, target, attributes)
76
- source = FileSource.new(File.expand_path(target, parent.document.attributes['docdir']))
77
- attributes['target'] ||= File.basename(target, File.extname(target))
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
- generate_block(parent, source, attributes)
80
- end
64
+ formats[format] = {
65
+ :type => type,
66
+ :generator => block
67
+ }
68
+ end
81
69
 
82
- self.instance_eval &init
83
- end
70
+ def formats
71
+ @formats ||= {}
72
+ end
84
73
 
85
- Asciidoctor::Diagram.const_set("#{name}Block", block)
86
- Asciidoctor::Diagram.const_set("#{name}BlockMacro", block_macro)
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
 
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "1.1.6"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -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 :simple
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.1.6
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: 0.1.4
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: 0.1.4
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
@@ -1,9 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- require 'asciidoctor'
5
- require 'asciidoctor/cli/options'
6
- require 'asciidoctor/cli/invoker'
7
- require 'asciidoctor-diagram'
8
-
9
- Asciidoctor::Cli::Invoker.new(*ARGV).invoke!