asciidoctor-diagram 2.2.8 → 2.2.9

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: ea06a8ee298a0f1331527d528d1e03bb3e018dda9c0dc69fa52506fb086e6b48
4
- data.tar.gz: 26d12a8dd4da3cd38a6007d8e569b05892159c79c9538d99f3958d91be4792a2
3
+ metadata.gz: 9f5d112b2ce57cb2380687fce2fac5fe15f2f6d2c6198f722edd5aeaa08d6b7d
4
+ data.tar.gz: 8d45d7df6757adfb72c0c4c4b9ba95bab649fe6a1686418f2a4ffc49fc20facb
5
5
  SHA512:
6
- metadata.gz: e81762d1af76136b66f1d35fb60aa5ebdcdd2fca3ff9d09cbf59d36485ea82b7d8eab3c4656fb236ebbadd07975b545e1d1ed7e0a205e3d50d28a6377f9f8cc5
7
- data.tar.gz: 6e2a003aa9049b72d12b6e5f82dec010029bb6b2e9ccf31c4e66951e6a3beb90694601769c452a2535cef8e891736a7c633aefde39c477647eef3febfcb7427a
6
+ metadata.gz: 56d0bffc577cd54b56853b02454760767ff5642c935eb57e9909a0aad974ad598897e2d5f312c780471f55318de0789df39e760b917e846ec702ad0ee1640a7f
7
+ data.tar.gz: 67496690a923714ba8b3757781b674862dc318680797bb118ecc00d834125b42d27770465b57db440b47ce0df3e4eebab8658d7a2aec8e5cf610bef886005655
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,12 @@
1
1
  = Asciidoctor-diagram Changelog
2
2
 
3
+ == 2.2.9
4
+
5
+ Bugfixes::
6
+
7
+ * Issue #409: Second attempt at fixing handling of the D2 `sketch` attribute
8
+ * Issue #415: Resolve NoMethodError when using Structurizr blocks
9
+
3
10
  == 2.2.8
4
11
 
5
12
  Enhancements::
@@ -33,7 +33,7 @@ module Asciidoctor
33
33
  options.each_pair do |key, value|
34
34
  flag = "--#{key.to_s.gsub('_', '-')}"
35
35
 
36
- if key == :sketch && value != 'false'
36
+ if key == :sketch && !value.nil? && value != 'false'
37
37
  args << flag
38
38
  elsif key.to_s.start_with?('font') && !value.nil?
39
39
  args << Platform.native_path(value)
@@ -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)
@@ -193,6 +193,14 @@ module Asciidoctor
193
193
  name = [name] unless name.is_a?(Enumerable)
194
194
 
195
195
  value = name.lazy.map { |n| @attributes[n] }.reject { |v| v.nil? }.first
196
+ if value.nil?
197
+ attr_position = config[:positional_attrs] || 1
198
+ while value.nil? && !@attributes[attr_position].nil?
199
+ if @attributes[attr_position] == name
200
+ value = true
201
+ end
202
+ end
203
+ end
196
204
 
197
205
  if value.nil? && inherit
198
206
  inherited_values = name.lazy.map do |n|
@@ -17,7 +17,7 @@ module Asciidoctor
17
17
  ENV[CLASSPATH_ENV].split(File::PATH_SEPARATOR)
18
18
  elsif ENV.has_key?(CLI_HOME_ENV)
19
19
  lib_dir = File.expand_path('lib', ENV[CLI_HOME_ENV])
20
- Dir.children(lib_dir).select { |c| c.end_with? '.jar' }.map { |c| File.expand_path(c, lib_dir) }
20
+ Dir[File.join(lib_dir, '*.jar')]
21
21
  else
22
22
  nil
23
23
  end
@@ -52,7 +52,7 @@ module Asciidoctor
52
52
 
53
53
  response = Java.send_request(
54
54
  :url => '/structurizr',
55
- :body => source.to_s,
55
+ :body => source.code,
56
56
  :headers => headers
57
57
  )
58
58
 
@@ -14,7 +14,7 @@ module Asciidoctor
14
14
 
15
15
  def initialize(name = nil, config = nil)
16
16
  super
17
- @structurizr = StructurizrConvertBlockMacroProcessor.new(name)
17
+ @structurizr = StructurizrConvertBlockProcessor.new(name)
18
18
  @renderers = Renderers.new(name)
19
19
  end
20
20
 
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Diagram
3
- VERSION = "2.2.8"
3
+ VERSION = "2.2.9"
4
4
  end
5
5
  end
data/spec/a2s_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  A2S_CODE = <<-eos
4
4
  .--. .---. .---. .---. .---. .---. .---.
data/spec/barcode_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  BARCODES = {
4
4
  :bookland => '978-0-306-40615-7',
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  BLOCKDIAG_CODE = <<-eos
4
4
  blockdiag {
data/spec/bpmn_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  BPNM_CODE = <<EOF
4
4
  <?xml version="1.0" encoding="UTF-8"?>
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  BYTEFIELD_CODE = <<-eos
4
4
  ;; This the source for the sample diagram illustrated in the project Read Me.
data/spec/d2_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  D2_CODE = <<-eos
4
4
  # Actors
@@ -35,6 +35,31 @@ end
35
35
  describe Asciidoctor::Diagram::D2BlockProcessor, :broken_on_windows do
36
36
  include_examples "block", :d2, D2_CODE, [:svg]
37
37
 
38
+ it "should not use sketch mode by default" do
39
+ doc = <<-eos
40
+ = Hello, D2!
41
+ Doc Writer <doc@example.com>
42
+
43
+ == First Section
44
+
45
+ [d2]
46
+ ----
47
+ #{D2_CODE}
48
+ ----
49
+ eos
50
+
51
+ d = load_asciidoc doc
52
+ expect(d).to_not be_nil
53
+
54
+ b = d.find { |bl| bl.context == :image }
55
+ expect(b).to_not be_nil
56
+ target = b.attributes['target']
57
+ expect(target).to match(/\.svg$/)
58
+ expect(File.exist?(target)).to be true
59
+ svg = File.read(target, :encoding => Encoding::UTF_8)
60
+ expect(svg).to_not match(/class='.*?sketch-overlay-B5.*?'/)
61
+ end
62
+
38
63
  it "should support sketch mode" do
39
64
  doc = <<-eos
40
65
  = Hello, D2!
@@ -42,7 +67,7 @@ Doc Writer <doc@example.com>
42
67
 
43
68
  == First Section
44
69
 
45
- [d2, sketch=true]
70
+ [d2, foobar, svg, sketch]
46
71
  ----
47
72
  #{D2_CODE}
48
73
  ----
@@ -56,5 +81,7 @@ Doc Writer <doc@example.com>
56
81
  target = b.attributes['target']
57
82
  expect(target).to match(/\.svg$/)
58
83
  expect(File.exist?(target)).to be true
84
+ svg = File.read(target, :encoding => Encoding::UTF_8)
85
+ expect(svg).to match(/class='.*?sketch-overlay-B5.*?'/)
59
86
  end
60
87
  end
data/spec/dbml_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  DBML_CODE = <<-eos
4
4
  Table users {
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  DIAGRAMS_CODE = <<-eos
4
4
  from diagrams import Diagram
data/spec/ditaa_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  DITAA_CODE = <<-eos
4
4
  +--------+ +-------+ +-------+
data/spec/dpic_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  DPIC_CODE = <<-eos
4
4
  arrow "$u$" above
data/spec/erd_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  ERD_CODE = <<-eos
4
4
  title {label: "nfldb Entity-Relationship diagram (condensed)", size: "20"}
data/spec/gnuplot_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  GNUPLOT_CODE = <<-eos
4
4
  plot [0:5][0:20] x**2 title 'O(n^2)'
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  GRAPHVIZ_PY_CODE = <<-eos
4
4
  graph python_graph {
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  DOT_CODE = <<-eos
4
4
  digraph foo {
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  LILYPOND_CODE = <<-eos
4
4
  \\relative c' { f d f a d f e d cis a cis e a g f e }
data/spec/meme_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  describe Asciidoctor::Diagram::MemeBlockMacroProcessor do
4
4
  it "should generate PNG images when format is set to 'png'" do
data/spec/mermaid_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  MERMAID_CODE = <<-eos
4
4
  graph LR
data/spec/msc_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  MSC_CODE = <<-eos
4
4
  # MSC for some fictional process
data/spec/nomnoml_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  NOMNOML_CODE = <<-eos
4
4
  [Pirate
data/spec/pikchr_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  PIKCHR_CODE = <<-eos
4
4
  # Change from the original:
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  PLANTUML_CODE = <<-eos
4
4
  User -> (Start)
data/spec/shaape_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  SHAAPE_CODE = <<-eos
4
4
  +-->
@@ -1,4 +1,5 @@
1
- require_relative 'test_helper'
1
+ require 'rspec'
2
+ require_relative 'test_helper_methods'
2
3
 
3
4
  RSpec.shared_examples "block_macro" do |name, code, formats|
4
5
  formats.each do |format|
@@ -497,6 +498,7 @@ Doc Writer <doc@example.com>
497
498
 
498
499
  [#{name}, format="foobar"]
499
500
  ----
501
+ #{code}
500
502
  ----
501
503
  eos
502
504
 
data/spec/smcat_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  SMCAT_CODE = <<-eos
4
4
  initial,
@@ -0,0 +1,41 @@
1
+ require_relative 'test_helper_methods'
2
+
3
+ STRUCTURIZR_CODE = <<-eos
4
+ workspace {
5
+
6
+ model {
7
+ user = person "User"
8
+ softwareSystem = softwareSystem "Software System" {
9
+ webapp = container "Web Application" {
10
+ user -> this "Uses"
11
+ }
12
+ container "Database" {
13
+ webapp -> this "Reads from and writes to"
14
+ }
15
+ }
16
+ }
17
+
18
+ views {
19
+ systemContext softwareSystem {
20
+ include *
21
+ autolayout lr
22
+ }
23
+
24
+ container softwareSystem {
25
+ include *
26
+ autolayout lr
27
+ }
28
+
29
+ theme default
30
+ }
31
+
32
+ }
33
+ eos
34
+
35
+ describe Asciidoctor::Diagram::StructurizrBlockMacroProcessor, :broken_on_windows, :broken_on_github do
36
+ include_examples "block_macro", :structurizr, STRUCTURIZR_CODE, [:png, :png]
37
+ end
38
+
39
+ describe Asciidoctor::Diagram::StructurizrBlockProcessor, :broken_on_windows, :broken_on_github do
40
+ include_examples "block", :structurizr, STRUCTURIZR_CODE, [:png, :png]
41
+ end
data/spec/svgbob_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  SVGBOB_CODE = <<-eos
4
4
  .--. .---. .---. .---. .---. .---. .---.
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  SYMBOLATOR_CODE = <<-eos
4
4
  library ieee;
data/spec/syntrax_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  SYNTRAX_CODE = <<-eos
4
4
  indentstack(10,
@@ -1,3 +1,5 @@
1
+ require 'rspec'
2
+
1
3
  require 'asciidoctor'
2
4
  require 'asciidoctor/cli/invoker'
3
5
 
data/spec/tikz_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  TIKZ_CODE = <<-'eos'
4
4
  \begin{tikzpicture}[font=\LARGE]
data/spec/umlet_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  CODE = <<-eos
4
4
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
data/spec/vega_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  VEGA_CODE = <<-eos
4
4
  {
@@ -1,4 +1,4 @@
1
- require_relative 'test_helper'
1
+ require_relative 'test_helper_methods'
2
2
 
3
3
  WAVEDROM_CODE = <<-eos
4
4
  { signal : [
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: 2.2.8
4
+ version: 2.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pepijn Van Eeckhoudt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-30 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -284,10 +284,11 @@ files:
284
284
  - spec/shaape_spec.rb
285
285
  - spec/shared_examples.rb
286
286
  - spec/smcat_spec.rb
287
+ - spec/structurizr_spec.rb
287
288
  - spec/svgbob_spec.rb
288
289
  - spec/symbolator_spec.rb
289
290
  - spec/syntrax_spec.rb
290
- - spec/test_helper.rb
291
+ - spec/test_helper_methods.rb
291
292
  - spec/tikz_spec.rb
292
293
  - spec/umlet_spec.rb
293
294
  - spec/vega_spec.rb
@@ -301,7 +302,7 @@ metadata:
301
302
  documentation_uri: https://docs.asciidoctor.org/diagram-extension/latest/
302
303
  homepage_uri: https://github.com/asciidoctor/asciidoctor-diagram
303
304
  source_code_uri: https://github.com/asciidoctor/asciidoctor-diagram.git
304
- post_install_message:
305
+ post_install_message:
305
306
  rdoc_options: []
306
307
  require_paths:
307
308
  - lib
@@ -316,8 +317,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
317
  - !ruby/object:Gem::Version
317
318
  version: '0'
318
319
  requirements: []
319
- rubygems_version: 3.0.3.1
320
- signing_key:
320
+ rubygems_version: 3.4.13
321
+ signing_key:
321
322
  specification_version: 4
322
323
  summary: A family of Asciidoctor extensions that generate images from a broad range
323
324
  of embedded plain text diagram descriptions, including PlantUML, ditaa, Kroki, and
@@ -348,10 +349,11 @@ test_files:
348
349
  - spec/shaape_spec.rb
349
350
  - spec/shared_examples.rb
350
351
  - spec/smcat_spec.rb
352
+ - spec/structurizr_spec.rb
351
353
  - spec/svgbob_spec.rb
352
354
  - spec/symbolator_spec.rb
353
355
  - spec/syntrax_spec.rb
354
- - spec/test_helper.rb
356
+ - spec/test_helper_methods.rb
355
357
  - spec/tikz_spec.rb
356
358
  - spec/umlet_spec.rb
357
359
  - spec/vega_spec.rb