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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd917dfffdfbdf86a9a2d1f94d67567adf0296b1e9b1e1b8e64e4dacfef06645
4
- data.tar.gz: e8b7f3554732fa3a051890a12fa943ea803a455d6a15281b86bd6df889312bfe
3
+ metadata.gz: 4de9d84055932e070c6726c178dd10aeb05e871edc2d511f957511f3f87fc073
4
+ data.tar.gz: c7e304a8620640a9fbbed81a52ccfb1d9e7900faeeb905a0dfbd92fe3346232e
5
5
  SHA512:
6
- metadata.gz: fee236ca6ef2e424d872be4517b9f6d27007a1d5177235678a20acd5533a34580234e469913468e697bb744b57411c386a29ad936597dcbdb4f9a226cf16c3d3
7
- data.tar.gz: 75b4a0a5981798b5af94ad2f0e9d8db9f509b6c460a4b5dd962d04fc179ddf454b9ad54b3c693afe2451bc5fcffd6cd5ad7dda187f459c6a7d5764eea45eff0c
6
+ metadata.gz: 4b5e2b48bd00c293e920d2a31b110b43f1f34d4f1d703d77fa512b4e0738b790704ac385eff37260f005b5ad9a1e77d6c2c105b2ef43a516f3e1d6c9e232616a
7
+ data.tar.gz: b5f136b19bd2f7fb3d7674b2e5fe1f8b63300ad21d44afe7d5694c7ef21148d16898c33aef04349d04cb2d77508577bff041057b6428cf20237ac4a48e6064f1
@@ -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
- format = source.attributes.delete('format') || source.attr('format', self.class.default_format, name)
108
- format = format.to_sym if format.respond_to?(:to_sym)
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
- raise "Format undefined" unless format
112
+ raise "Format undefined" unless format
111
113
 
112
- generator_info = self.class.formats[format]
114
+ generator_info = self.class.formats[format]
113
115
 
114
- raise "#{self.class.name} does not support output format #{format}" unless generator_info
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
- warn %(asciidoctor-diagram: ERROR: #{warn_msg})
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.option Asciidoctor::Diagram::Extensions::POSITIONAL_ATTRS_KEY, ['target', 'format']
304
- subclass.option :contexts, [:listing, :literal, :open]
305
- subclass.option :content_model, :simple
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.option Asciidoctor::Diagram::Extensions::POSITIONAL_ATTRS_KEY, ['target', 'format']
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
- option Asciidoctor::Diagram::Extensions::POSITIONAL_ATTRS_KEY, %w(top bottom target format)
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 "@start#{tag}"
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 )\s*[^<][^!\n\r]+/) do |match|
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
 
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "1.5.16"
3
+ VERSION = "1.5.17"
4
4
  end
5
5
  end
Binary file
@@ -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.16
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-03-23 00:00:00.000000000 Z
11
+ date: 2019-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler