asciidoctor-plantuml 0.0.7 → 0.0.8

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: 7718a31ed4888ccbacef471e5e5fda271b371336
4
- data.tar.gz: 7cf588d1ff45b671122be55961f007dcce2fdbb7
3
+ metadata.gz: c25b4e32ecf70068397ea52deddddd097660da66
4
+ data.tar.gz: 9608a7e5e741c82d4a7dc778639acda1f4dd5df7
5
5
  SHA512:
6
- metadata.gz: bc542c286ccb6e1a9379560d3e3caa6dee8087de7f4f3d14cd0d43f27cef34df5e75a1051c9185f4376b9ba82b23f1a24656456ee90682024c81c322976f2f4a
7
- data.tar.gz: 8fce5b5f981e13e0fd4dcad119b73a6685e64a58ad2ec2678e849bb2b58776cc98ea8288c8670346ea5c96dc0086b1ff23b8ca565f5a09128b290675efdf716b
6
+ metadata.gz: 14f45816129d36158f4c704c1950f4b6ab7b7a84dc0371b4904892d5fa1d763fe2a3306fb7a45ed2ba4512fab5ddfa3e6a8255114ae08ccc82a5897122e5d808
7
+ data.tar.gz: 804afa9408568fb49611a736155e9d83723749d66e6f1a41c9470b73acfff91f88cb353e2b453d6b6485734019bc374fbe311006a1b229de540d7acd643bdfdb
@@ -250,6 +250,11 @@ module Asciidoctor
250
250
 
251
251
  class BlockProcessor < Asciidoctor::Extensions::BlockProcessor
252
252
 
253
+ use_dsl
254
+ named :plantuml
255
+ on_context :listing
256
+ content_model :simple
257
+
253
258
  def process(parent, target, attrs)
254
259
 
255
260
  lines = target.lines
@@ -264,15 +269,15 @@ module Asciidoctor
264
269
 
265
270
  content = Processor.plantuml_content(lines.join("\n"), attrs)
266
271
 
267
- return create_plantuml_block(parent, content)
272
+ return create_plantuml_block(parent, content, attrs)
268
273
 
269
274
  end
270
275
 
271
276
  private
272
277
 
273
- def create_plantuml_block(parent, content)
274
- Asciidoctor::Block.new parent, :pass, :content_model => :raw,
275
- :source => content, :subs => :default
278
+ def create_plantuml_block(parent, content, attrs)
279
+ Asciidoctor::Block.new parent, :pass, { content_model: :raw,
280
+ source: content, subs: :default }.merge(attrs)
276
281
  end
277
282
 
278
283
  end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module PlantUML
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -8,83 +8,115 @@ DOC_BASIC = <<-eos
8
8
  = Hello PlantUML!
9
9
 
10
10
  [plantuml, format="png"]
11
- --
11
+ .Title Of this
12
+ ----
12
13
  User -> (Start)
13
14
  User --> (Use the application) : Label
14
- --
15
+ ----
15
16
  eos
16
17
 
17
18
  DOC_BASIC2 = <<-eos
18
19
  = Hello PlantUML!
19
20
 
20
21
  [plantuml, format="png"]
22
+ .Title Of this
23
+ [[fig-xref]]
24
+ ----
21
25
  @startuml
22
26
  User -> (Start)
23
27
  User --> (Use the application) : Label
24
28
  @enduml
29
+ ----
30
+ eos
31
+
32
+ DOC_BASIC3 = <<-eos
33
+ = Hello Compound PlantUML!
34
+
35
+ [plantuml, format="png"]
36
+ ----
37
+ [COMP1]
38
+ [COMP2]
39
+ [COMP1] -> [COMP2]
40
+ [COMP2] --> [COMP3]
41
+ ----
25
42
  eos
26
43
 
27
44
  DOC_ID = <<-eos
28
45
  = Hello PlantUML!
29
46
 
30
47
  [plantuml, format="png", id="myId"]
48
+ ----
31
49
  User -> (Start)
32
50
  User --> (Use the application) : Label
51
+ ----
33
52
  eos
34
53
 
35
54
  DOC_DIM = <<-eos
36
55
  = Hello PlantUML!
37
56
 
38
57
  [plantuml, format="png", width="100px", height="50px"]
58
+ ----
39
59
  User -> (Start)
40
60
  User --> (Use the application) : Label
61
+ ----
41
62
  eos
42
63
 
43
64
  DOC_ALT = <<-eos
44
65
  = Hello PlantUML!
45
66
 
46
67
  [plantuml, format="png", alt="alt"]
68
+ ----
47
69
  User -> (Start)
48
70
  User --> (Use the application) : Label
71
+ ----
49
72
  eos
50
73
 
51
74
  DOC_BAD_FORMAT = <<-eos
52
75
  = Hello PlantUML!
53
76
 
54
77
  [plantuml, format="jpg"]
78
+ ----
55
79
  User -> (Start)
56
80
  User --> (Use the application) : Label
81
+ ----
57
82
  eos
58
83
 
59
84
  DOC_MULTI = <<-eos
60
85
  = Hello PlantUML!
61
86
 
62
87
  [plantuml, format="png"]
88
+ ----
63
89
  User -> (Start)
64
90
  User --> (Use the application) : Label
91
+ ----
65
92
 
66
93
  [plantuml, format="png"]
94
+ ----
67
95
  User -> (Start)
68
96
  User --> (Use the application) : Label
97
+ ----
69
98
 
70
99
  [plantuml, format="txt"]
100
+ ----
71
101
  User -> (Start)
72
102
  User --> (Use the application) : Label
103
+ ----
73
104
  eos
74
105
 
75
106
  DOC_TXT = <<-eos
76
107
  = Hello PlantUML!
77
108
 
78
109
  [plantuml, format="txt"]
79
- --
110
+ ----
80
111
  User -> (Start)
81
112
  User --> (Use the application) : Label
82
- --
113
+ ----
83
114
  eos
84
115
 
85
116
  class PlantUmlTest < Test::Unit::TestCase
86
117
 
87
118
  GENURL = "http://localhost:8080/plantuml/png/U9npA2v9B2efpStX2YrEBLBGjLFG20Q9Q4Bv804WIw4a8rKXiQ0W9pCviIGpFqzJmKh19p4fDOVB8JKl1QWT05kd5wq0"
119
+ GENURL2 = "http://localhost:8080/plantuml/png/U9npA2v9B2efpStXYdRszmqmZ8NGHh4mleAkdGAAa15G22Pc7Clba9gN0jGE00W75Cm0"
88
120
 
89
121
  def setup
90
122
  Asciidoctor::PlantUml.configure do |c|
@@ -120,6 +152,19 @@ class PlantUmlTest < Test::Unit::TestCase
120
152
  assert_equal GENURL, element["src"]
121
153
  end
122
154
 
155
+ def test_plantuml_block_processor3
156
+ html = ::Asciidoctor.convert(StringIO.new(DOC_BASIC3), backend: "html5")
157
+ page = Nokogiri::HTML(html)
158
+
159
+ elements = page.css('img.plantuml')
160
+
161
+ assert_equal elements.size, 1
162
+
163
+ element = elements.first
164
+
165
+ assert_equal GENURL2, element["src"]
166
+ end
167
+
123
168
  def test_plantuml_id_attribute
124
169
 
125
170
  html = ::Asciidoctor.convert(StringIO.new(DOC_ID), backend: "html5")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-plantuml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Horacio Sanson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler