asciidoctor-diagram 1.5.16 → 1.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +7 -0
- data/lib/asciidoctor-diagram/extensions.rb +19 -16
- data/lib/asciidoctor-diagram/meme/extension.rb +1 -1
- data/lib/asciidoctor-diagram/plantuml/extension.rb +2 -2
- data/lib/asciidoctor-diagram/version.rb +1 -1
- data/lib/plantuml.jar +0 -0
- data/spec/plantuml_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4de9d84055932e070c6726c178dd10aeb05e871edc2d511f957511f3f87fc073
|
4
|
+
data.tar.gz: c7e304a8620640a9fbbed81a52ccfb1d9e7900faeeb905a0dfbd92fe3346232e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5e2b48bd00c293e920d2a31b110b43f1f34d4f1d703d77fa512b4e0738b790704ac385eff37260f005b5ad9a1e77d6c2c105b2ef43a516f3e1d6c9e232616a
|
7
|
+
data.tar.gz: b5f136b19bd2f7fb3d7674b2e5fe1f8b63300ad21d44afe7d5694c7ef21148d16898c33aef04349d04cb2d77508577bff041057b6428cf20237ac4a48e6064f1
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= Asciidoctor-diagram Changelog
|
2
2
|
|
3
|
+
== 1.5.17
|
4
|
+
|
5
|
+
Enhancements::
|
6
|
+
* Issue #173: Apply path resolution to PlantUML `!includesub` directives
|
7
|
+
* Issue #222: Update PlantUML to 1.2019.6
|
8
|
+
* Issue #223: Log diagram processing errors using Asciidoctor logging infrastructure
|
9
|
+
|
3
10
|
== 1.5.16
|
4
11
|
|
5
12
|
Enhancements::
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'asciidoctor' unless defined? ::Asciidoctor::VERSION
|
2
2
|
require 'asciidoctor/extensions'
|
3
|
+
require 'asciidoctor/logging'
|
3
4
|
require 'digest'
|
4
5
|
require 'json'
|
5
6
|
require 'fileutils'
|
@@ -13,11 +14,6 @@ require_relative 'util/svg'
|
|
13
14
|
module Asciidoctor
|
14
15
|
module Diagram
|
15
16
|
module Extensions
|
16
|
-
if Asciidoctor::VERSION =~ /^1\.*/
|
17
|
-
POSITIONAL_ATTRS_KEY = :pos_attrs
|
18
|
-
else
|
19
|
-
POSITIONAL_ATTRS_KEY = :positional_attrs
|
20
|
-
end
|
21
17
|
|
22
18
|
# Provides the means for diagram processors to register supported output formats and image
|
23
19
|
# generation routines
|
@@ -69,6 +65,8 @@ module Asciidoctor
|
|
69
65
|
# Mixin that provides the basic machinery for image generation.
|
70
66
|
# When this module is included it will include the FormatRegistry into the singleton class of the target class.
|
71
67
|
module DiagramProcessor
|
68
|
+
include Asciidoctor::Logging
|
69
|
+
|
72
70
|
IMAGE_PARAMS = {
|
73
71
|
:svg => {
|
74
72
|
:encoding => Encoding::UTF_8,
|
@@ -89,6 +87,7 @@ module Asciidoctor
|
|
89
87
|
}
|
90
88
|
|
91
89
|
def self.included(mod)
|
90
|
+
mod.enable_dsl
|
92
91
|
class << mod
|
93
92
|
include FormatRegistry
|
94
93
|
end
|
@@ -102,18 +101,20 @@ module Asciidoctor
|
|
102
101
|
# @param attributes [Hash] the attributes of the block or block macro
|
103
102
|
# @return [Asciidoctor::AbstractBlock] a new block that replaces the original block or block macro
|
104
103
|
def process(parent, reader_or_target, attributes)
|
104
|
+
location = parent.document.reader.cursor_at_mark
|
105
|
+
|
105
106
|
source = create_source(parent, reader_or_target, attributes.dup)
|
106
107
|
|
107
|
-
|
108
|
-
|
108
|
+
begin
|
109
|
+
format = source.attributes.delete('format') || source.attr('format', self.class.default_format, name)
|
110
|
+
format = format.to_sym if format.respond_to?(:to_sym)
|
109
111
|
|
110
|
-
|
112
|
+
raise "Format undefined" unless format
|
111
113
|
|
112
|
-
|
114
|
+
generator_info = self.class.formats[format]
|
113
115
|
|
114
|
-
|
116
|
+
raise "#{self.class.name} does not support output format #{format}" unless generator_info
|
115
117
|
|
116
|
-
begin
|
117
118
|
title = source.attributes.delete 'title'
|
118
119
|
caption = source.attributes.delete 'caption'
|
119
120
|
|
@@ -137,7 +138,9 @@ module Asciidoctor
|
|
137
138
|
if $VERBOSE
|
138
139
|
warn_msg << "\n" << e.backtrace.join("\n")
|
139
140
|
end
|
140
|
-
|
141
|
+
|
142
|
+
logger.error message_with_context warn_msg, source_location: location
|
143
|
+
|
141
144
|
text << "\n"
|
142
145
|
text << source.code
|
143
146
|
Asciidoctor::Block.new parent, :listing, :source => text, :attributes => attributes
|
@@ -300,9 +303,9 @@ module Asciidoctor
|
|
300
303
|
include DiagramProcessor
|
301
304
|
|
302
305
|
def self.inherited(subclass)
|
303
|
-
subclass.
|
304
|
-
subclass.
|
305
|
-
subclass.
|
306
|
+
subclass.positional_attributes ['target', 'format']
|
307
|
+
subclass.contexts [:listing, :literal, :open]
|
308
|
+
subclass.content_model :simple
|
306
309
|
end
|
307
310
|
|
308
311
|
# Creates a ReaderSource from the given reader.
|
@@ -318,7 +321,7 @@ module Asciidoctor
|
|
318
321
|
include DiagramProcessor
|
319
322
|
|
320
323
|
def self.inherited(subclass)
|
321
|
-
subclass.
|
324
|
+
subclass.positional_attributes ['target', 'format']
|
322
325
|
end
|
323
326
|
|
324
327
|
def apply_target_subs(parent, target)
|
@@ -118,7 +118,7 @@ module Asciidoctor
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
|
121
|
+
positional_attributes %w(top bottom target format)
|
122
122
|
|
123
123
|
def create_source(parent, target, attributes)
|
124
124
|
attributes = attributes.dup
|
@@ -57,13 +57,13 @@ module Asciidoctor
|
|
57
57
|
code = source.to_s
|
58
58
|
base_dir = source.base_dir
|
59
59
|
|
60
|
-
code = "@start#{tag}\n#{code}\n@end#{tag}" unless code.index
|
60
|
+
code = "@start#{tag}\n#{code}\n@end#{tag}" unless code.index("@start") && code.index("@end")
|
61
61
|
|
62
62
|
code.gsub!(/(?<=<img:)[^>]+(?=>)/) do |match|
|
63
63
|
resolve_path(match, parent, parent.attr('imagesdir'))
|
64
64
|
end
|
65
65
|
|
66
|
-
code.gsub!(/(?<=!include
|
66
|
+
code.gsub!(/(?:(?<=!include\s)|(?<=!includesub\s))\s*[^<][^!\n\r]+/) do |match|
|
67
67
|
resolve_path(match.lstrip, parent, base_dir)
|
68
68
|
end
|
69
69
|
|
data/lib/plantuml.jar
CHANGED
Binary file
|
data/spec/plantuml_spec.rb
CHANGED
@@ -832,8 +832,22 @@ List : int size()
|
|
832
832
|
List : void clear()
|
833
833
|
eos
|
834
834
|
|
835
|
+
sub = <<-eos
|
836
|
+
@startuml
|
837
|
+
A -> A : stuff1
|
838
|
+
!startsub BASIC
|
839
|
+
B -> B : stuff2
|
840
|
+
!endsub
|
841
|
+
C -> C : stuff3
|
842
|
+
!startsub BASIC
|
843
|
+
D -> D : stuff4
|
844
|
+
!endsub
|
845
|
+
@enduml
|
846
|
+
eos
|
847
|
+
|
835
848
|
Dir.mkdir('dir')
|
836
849
|
File.write('dir/List.iuml', included)
|
850
|
+
File.write('dir/Sub.iuml', sub)
|
837
851
|
|
838
852
|
creole_doc = <<-eos
|
839
853
|
= Hello, PlantUML!
|
@@ -844,6 +858,7 @@ Doc Writer <doc@example.com>
|
|
844
858
|
[plantuml, format="svg"]
|
845
859
|
----
|
846
860
|
!include dir/List.iuml
|
861
|
+
!includesub dir/Sub.iuml!BASIC
|
847
862
|
List <|.. ArrayList
|
848
863
|
----
|
849
864
|
eos
|
@@ -860,6 +875,7 @@ List <|.. ArrayList
|
|
860
875
|
|
861
876
|
content = File.read(target, :encoding => Encoding::UTF_8)
|
862
877
|
expect(content).to_not include('!include')
|
878
|
+
expect(content).to_not include('!includesub')
|
863
879
|
end
|
864
880
|
|
865
881
|
it 'should not resolve stdlib !include directives' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-diagram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pepijn Van Eeckhoudt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|