gviz 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gviz/core.rb +7 -1
- data/lib/gviz/version.rb +1 -1
- data/spec/gviz_spec.rb +31 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86acea43cf9f96125e9e319effb7e0b5cfd83dbe
|
4
|
+
data.tar.gz: 0d9ce484c6e2a4d5078f586a5e8de88fb48786ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa0642cb0fbb8fb0ff3ff1ad80c1b5ff52dc887630382d2e8eca790431ea0cdb82118f0539464f32bb332f7c18bb1262c86c769143e521fe714bc0f87e536b34
|
7
|
+
data.tar.gz: f50bf997cd60c46469ef0465a7999b3eef0afac3aa0b2ede4514c24627fd93558d1c1d895426ef3a5af248970f38d6c571b0aa54fda0d6ec263bf668b3795897
|
data/lib/gviz/core.rb
CHANGED
@@ -241,7 +241,13 @@ class Gviz
|
|
241
241
|
|
242
242
|
def build_attrs(attrs, join=true)
|
243
243
|
return nil if attrs.empty?
|
244
|
-
arr = attrs.map { |k, v|
|
244
|
+
arr = attrs.map { |k, v|
|
245
|
+
if v.match(/^\s*<.*>\s*$/) # accept HTML labels
|
246
|
+
"#{k}=<#{v}>".gsub("\n", '').gsub(/\s+</, '<')
|
247
|
+
else
|
248
|
+
%(#{k}="#{v}").gsub("\n", "\\n")
|
249
|
+
end
|
250
|
+
}
|
245
251
|
join ? '[' + arr.join(',') + ']' : arr
|
246
252
|
end
|
247
253
|
|
data/lib/gviz/version.rb
CHANGED
data/spec/gviz_spec.rb
CHANGED
@@ -422,7 +422,37 @@ describe Gviz do
|
|
422
422
|
EOS
|
423
423
|
end
|
424
424
|
end
|
425
|
-
|
425
|
+
|
426
|
+
context "when a label include HTML-like tags" do
|
427
|
+
before { gv.node(:a, label:'<TABLE><TR><TD><IMG SRC="logo.gif" /></TD></TR></TABLE>') }
|
428
|
+
subject { gv.to_s }
|
429
|
+
it do
|
430
|
+
should eql ~<<-EOS
|
431
|
+
digraph G {
|
432
|
+
a[label=<<TABLE><TR><TD><IMG SRC="logo.gif" /></TD></TR></TABLE>>];
|
433
|
+
}
|
434
|
+
EOS
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
context "when a label include HTML-like tags with heredoc" do
|
439
|
+
before { gv.node(:a, label:<<-HTML) }
|
440
|
+
<TABLE>
|
441
|
+
<TR>
|
442
|
+
<TD><IMG SRC="logo2.gif" /></TD>
|
443
|
+
</TR>
|
444
|
+
</TABLE>
|
445
|
+
HTML
|
446
|
+
subject { gv.to_s }
|
447
|
+
it do
|
448
|
+
should eql ~<<-EOS
|
449
|
+
digraph G {
|
450
|
+
a[label=<<TABLE><TR><TD><IMG SRC="logo2.gif" /></TD></TR></TABLE>>];
|
451
|
+
}
|
452
|
+
EOS
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
426
456
|
context "take ports on edges" do
|
427
457
|
before do
|
428
458
|
gv.route(:a => [:b, :c])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kyoendo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01
|
11
|
+
date: 2014-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|