graph 2.5.2 → 2.5.3
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.
- data.tar.gz.sig +0 -0
- data/History.txt +11 -0
- data/lib/graph.rb +12 -3
- data/test/test_graph.rb +18 -0
- metadata +14 -14
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 2.5.3 / 2013-05-10
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added <> quoted labels.
|
6
|
+
* Added Graph.escape_label.
|
7
|
+
|
8
|
+
* 1 bug fix:
|
9
|
+
|
10
|
+
* Fixed issue with labels not escaping double quotes. (tenderlove)
|
11
|
+
|
1
12
|
=== 2.5.2 / 2013-02-07
|
2
13
|
|
3
14
|
* 1 minor enhancement:
|
data/lib/graph.rb
CHANGED
@@ -7,7 +7,7 @@ require "enumerator"
|
|
7
7
|
# dot format.
|
8
8
|
|
9
9
|
class Graph
|
10
|
-
VERSION = "2.5.
|
10
|
+
VERSION = "2.5.3" # :nodoc:
|
11
11
|
|
12
12
|
# :stopdoc:
|
13
13
|
|
@@ -288,11 +288,20 @@ class Graph
|
|
288
288
|
Attribute.new "fontsize = #{size}"
|
289
289
|
end
|
290
290
|
|
291
|
+
def self.escape_label s
|
292
|
+
s = s.gsub(/\n/, '\n').gsub(/\"/, '\\\"')
|
293
|
+
if s[0] == ?< and s[-1] == ?> then
|
294
|
+
s
|
295
|
+
else
|
296
|
+
"\"#{s}\""
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
291
300
|
##
|
292
301
|
# Shortcut method to set the graph's label. Usually used with subgraphs.
|
293
302
|
|
294
303
|
def label name
|
295
|
-
graph_attribs << "label =
|
304
|
+
graph_attribs << "label = #{Graph.escape_label name}"
|
296
305
|
end
|
297
306
|
|
298
307
|
##
|
@@ -493,7 +502,7 @@ class Graph
|
|
493
502
|
|
494
503
|
def label name
|
495
504
|
attributes.reject! { |s| s =~ /^label =/ }
|
496
|
-
attributes << "label =
|
505
|
+
attributes << "label = #{Graph.escape_label name}"
|
497
506
|
self
|
498
507
|
end
|
499
508
|
|
data/test/test_graph.rb
CHANGED
@@ -109,6 +109,18 @@ class TestGraph < MiniTest::Unit::TestCase
|
|
109
109
|
assert_graph graph, 'label = "blah"', '"a" -> "b"'
|
110
110
|
end
|
111
111
|
|
112
|
+
def test_label_html
|
113
|
+
graph.label "<<B>blah</B>>"
|
114
|
+
|
115
|
+
assert_graph graph, 'label = <<B>blah</B>>', '"a" -> "b"'
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_label_quote
|
119
|
+
graph.label 'blah"blah'
|
120
|
+
|
121
|
+
assert_graph graph, 'label = "blah\\"blah"', '"a" -> "b"'
|
122
|
+
end
|
123
|
+
|
112
124
|
def test_label_newline
|
113
125
|
graph.label "blah\nblah"
|
114
126
|
|
@@ -369,6 +381,12 @@ class TestNode < MiniTest::Unit::TestCase
|
|
369
381
|
assert_equal ["label = \"blah\""], n.attributes
|
370
382
|
end
|
371
383
|
|
384
|
+
def test_label_html
|
385
|
+
n.label "<<B>Foo</B>>"
|
386
|
+
|
387
|
+
assert_equal ["label = <<B>Foo</B>>"], n.attributes
|
388
|
+
end
|
389
|
+
|
372
390
|
def test_label_newline
|
373
391
|
n.label "blah\nblah"
|
374
392
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 2.5.
|
9
|
+
- 3
|
10
|
+
version: 2.5.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2013-
|
39
|
+
date: 2013-05-10 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
@@ -46,11 +46,11 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
hash:
|
49
|
+
hash: 31
|
50
50
|
segments:
|
51
|
-
- 4
|
52
51
|
- 5
|
53
|
-
|
52
|
+
- 0
|
53
|
+
version: "5.0"
|
54
54
|
type: :development
|
55
55
|
version_requirements: *id001
|
56
56
|
- !ruby/object:Gem::Dependency
|
@@ -61,11 +61,11 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ~>
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
64
|
+
hash: 27
|
65
65
|
segments:
|
66
|
-
-
|
67
|
-
-
|
68
|
-
version: "
|
66
|
+
- 4
|
67
|
+
- 0
|
68
|
+
version: "4.0"
|
69
69
|
type: :development
|
70
70
|
version_requirements: *id002
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -76,11 +76,11 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
79
|
+
hash: 11
|
80
80
|
segments:
|
81
81
|
- 3
|
82
|
-
-
|
83
|
-
version: "3.
|
82
|
+
- 6
|
83
|
+
version: "3.6"
|
84
84
|
type: :development
|
85
85
|
version_requirements: *id003
|
86
86
|
description: |-
|
metadata.gz.sig
CHANGED
Binary file
|