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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a4d3708575a2d09c566a858d93ce6efd035a3bd
4
- data.tar.gz: 4c21543085c6bc222da02dc95b9e4b98824356b1
3
+ metadata.gz: 86acea43cf9f96125e9e319effb7e0b5cfd83dbe
4
+ data.tar.gz: 0d9ce484c6e2a4d5078f586a5e8de88fb48786ae
5
5
  SHA512:
6
- metadata.gz: 3d28d16296d0ada31fc9bac6a47a3ea7a1a93b455e188e2f242b6c7075101f3a3fa8c35bf66f2078caf3b6aa50bd94ffccb209e450c6ef8835eead2642080bea
7
- data.tar.gz: d6cc57b32c57cc27902d427085a79965515a4396866b311e6b40d9de90ccffdb5aa1584b9cc134ffb0b9d1e363d17f66f6b041f80838fa3f622ebcf28227872f
6
+ metadata.gz: aa0642cb0fbb8fb0ff3ff1ad80c1b5ff52dc887630382d2e8eca790431ea0cdb82118f0539464f32bb332f7c18bb1262c86c769143e521fe714bc0f87e536b34
7
+ data.tar.gz: f50bf997cd60c46469ef0465a7999b3eef0afac3aa0b2ede4514c24627fd93558d1c1d895426ef3a5af248970f38d6c571b0aa54fda0d6ec263bf668b3795897
@@ -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| %(#{k}="#{v}").gsub("\n", "\\n") }
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
 
@@ -1,3 +1,3 @@
1
1
  class Gviz
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -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.1
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-09 00:00:00.000000000 Z
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec