ruby-graphviz 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/sample73.rb +18 -0
- data/lib/graphviz.rb +2 -2
- data/lib/graphviz/constants.rb +9 -2
- data/lib/graphviz/dot2ruby.rb +1 -1
- data/lib/graphviz/types/lbl_string.rb +14 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3e2c6ea3129992d49749953d36d348aea8266e
|
4
|
+
data.tar.gz: 7d471149cc78c328ab5f676774e442910d432e4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27f49c9370581d707445cb64645e78f87393346c9d62f3f9d2d84e795d9960d636e443643f44ea9b4fef845e6242ce23ff8102cd351455eb677efbc36dc73d6b
|
7
|
+
data.tar.gz: 588e4688a8896e6ad530b57d4c81ead08a42de98b87e8a8ad05afd744d9eaf7b1612ae2f766b9dee6b3243ef7fa51ada8eccc46c351c51bf711b3d935de28dc4
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
$:.unshift( "../lib" )
|
4
|
+
require "graphviz"
|
5
|
+
|
6
|
+
g = nil
|
7
|
+
if ARGV[0]
|
8
|
+
g = GraphViz::new( "G", :path => ARGV[0] )
|
9
|
+
else
|
10
|
+
g = GraphViz::new( "G" )
|
11
|
+
end
|
12
|
+
|
13
|
+
g.add_nodes "HtmlOne", label: '<<b>This</b> is an<br/>HTML Node>'
|
14
|
+
g.add_nodes "HtmlTwo", label: '<This is also<br/>an HTML node>'
|
15
|
+
g.add_nodes "NotHtmlOne", label: '<this is not an HTML node>'
|
16
|
+
g.add_nodes "NotHtmlTwo", label: 'this is not an HTML node, too!'
|
17
|
+
|
18
|
+
g.output( :png => "#{$0}.png" )
|
data/lib/graphviz.rb
CHANGED
@@ -761,8 +761,8 @@ class GraphViz
|
|
761
761
|
# * :path : Program PATH
|
762
762
|
#
|
763
763
|
def self.parse_string( str, hOpts = {}, &block )
|
764
|
-
graph = Dot2Ruby::new(
|
765
|
-
yield(
|
764
|
+
graph = Dot2Ruby::new(hOpts[:path], nil, nil).eval_string(str)
|
765
|
+
yield(graph) if(block and graph)
|
766
766
|
return graph
|
767
767
|
end
|
768
768
|
|
data/lib/graphviz/constants.rb
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
#
|
42
42
|
class GraphViz
|
43
43
|
module Constants
|
44
|
-
RGV_VERSION = "1.
|
44
|
+
RGV_VERSION = "1.2.0"
|
45
45
|
|
46
46
|
## Const: Output formats
|
47
47
|
FORMATS = [
|
@@ -121,11 +121,12 @@ class GraphViz
|
|
121
121
|
"Damping" => { :usedBy => "G", :type => :GvDouble },
|
122
122
|
"K" => { :usedBy => "GC", :type => :GvDouble },
|
123
123
|
"URL" => { :usedBy => "ENGC", :type => :EscString },
|
124
|
+
"_background" => { :usedBy => "G", :type => :EscString },
|
124
125
|
"area" => { :usedBy => "NC", :type => :GvDouble },
|
125
126
|
"arrowhead" => { :usedBy => "E", :type => :ArrowType }, # arrowType
|
126
127
|
"arrowsize" => { :usedBy => "E", :type => :GvDouble },
|
127
128
|
"arrowtail" => { :usedBy => "E", :type => :ArrowType }, # arrowType
|
128
|
-
"aspect" => { :usedBy => "G", :type => :EscString }, # aspectType
|
129
|
+
#"aspect" => { :usedBy => "G", :type => :EscString }, # aspectType
|
129
130
|
"bb" => { :usedBy => "G", :type => :Rect }, # rect
|
130
131
|
"bgcolor" => { :usedBy => "GC", :type => :Color }, # color
|
131
132
|
"center" => { :usedBy => "G", :type => :GvBool }, # bool
|
@@ -162,6 +163,7 @@ class GraphViz
|
|
162
163
|
"gradientangle" => { :usedBy => "NCG", :type => :EscString }, # int
|
163
164
|
"group" => { :usedBy => "N", :type => :EscString }, # string
|
164
165
|
"headURL" => { :usedBy => "E", :type => :EscString },
|
166
|
+
"head_lp" => { :usedBy => "E", :type => :EscString }, #point
|
165
167
|
"headclip" => { :usedBy => "E", :type => :GvBool }, # bool
|
166
168
|
"headhref" => { :usedBy => "E", :type => :EscString },
|
167
169
|
"headlabel" => { :usedBy => "E", :type => :EscString }, # LblString
|
@@ -174,6 +176,7 @@ class GraphViz
|
|
174
176
|
"image" => { :usedBy => "N", :type => :EscString }, # string
|
175
177
|
"imagepath" => { :usedBy => "G", :type => :EscString }, # string
|
176
178
|
"imagescale" => { :usedBy => "N", :type => :EscString }, # bool, string
|
179
|
+
"inputscale" => { :usedBy => "G", :type => :GvDouble },
|
177
180
|
"label" => { :usedBy => "ENGC", :type => :LblString },
|
178
181
|
"labelURL" => { :usedBy => "E", :type => :EscString },
|
179
182
|
"label_scheme" => { :usedBy => "G", :type => :EscString }, # int
|
@@ -221,6 +224,7 @@ class GraphViz
|
|
221
224
|
"outputorder" => { :usedBy => "G", :type => :EscString }, # outputMode
|
222
225
|
"overlap" => { :usedBy => "G", :type => :EscString }, # string, bool
|
223
226
|
"overlap_scaling" => { :usedBy => "G", :type => :GvDouble },
|
227
|
+
"overlap_shrink" => { :usedBy => "G", :type => :GvBool },
|
224
228
|
"pack" => { :usedBy => "G", :type => :EscString }, # bool, int
|
225
229
|
"packmode" => { :usedBy => "G", :type => :EscString }, # packMode
|
226
230
|
"pad" => { :usedBy => "G", :type => :EscString }, # GvDouble , pointf
|
@@ -264,6 +268,7 @@ class GraphViz
|
|
264
268
|
"style" => { :usedBy => "ENCG", :type => :EscString }, # style
|
265
269
|
"stylesheet" => { :usedBy => "G", :type => :EscString }, # string
|
266
270
|
"tailURL" => { :usedBy => "E", :type => :EscString },
|
271
|
+
"tail_lp" => { :usedBy => "E", :type => :EscString }, #point
|
267
272
|
"tailclip" => { :usedBy => "E", :type => :GvBool }, # bool
|
268
273
|
"tailhref" => { :usedBy => "E", :type => :EscString },
|
269
274
|
"taillabel" => { :usedBy => "E", :type => :EscString }, # lblString
|
@@ -278,7 +283,9 @@ class GraphViz
|
|
278
283
|
"voro_margin" => { :usedBy => "G", :type => :GvDouble },
|
279
284
|
"weight" => { :usedBy => "E", :type => :GvDouble },
|
280
285
|
"width" => { :usedBy => "N", :type => :GvDouble },
|
286
|
+
"xdotversion" => { :usedBy => "G", :type => :EscString },
|
281
287
|
"xlabel" => { :usedBy => "EN", :type => :LblString },
|
288
|
+
"xlp" => { :usedBy => "EN", :type => :EscString }, # point
|
282
289
|
"z" => { :usedBy => "N", :type => :GvDouble }
|
283
290
|
}
|
284
291
|
|
data/lib/graphviz/dot2ruby.rb
CHANGED
@@ -24,7 +24,7 @@ class Dot2Ruby #:nodoc:
|
|
24
24
|
def initialize( xGVPath, xOutFile, xOutFormat = nil ) #:nodoc:
|
25
25
|
paths = (xGVPath.nil?) ? [] : [xGVPath]
|
26
26
|
@xGvprPath = find_executable( 'gvpr', paths )
|
27
|
-
if
|
27
|
+
if(@xGvprPath.nil?)
|
28
28
|
raise Exception, "GraphViz is not installed. Please be sure that 'gvpr' is on the search path'"
|
29
29
|
end
|
30
30
|
@xOutFile = xOutFile
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "rexml/document"
|
2
|
+
|
1
3
|
class GraphViz
|
2
4
|
class Types
|
3
5
|
class LblString < Common
|
@@ -6,9 +8,19 @@ class GraphViz
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def output
|
9
|
-
html = /^<(
|
11
|
+
html = /^<(.*)>$/m.match(@data.to_s)
|
10
12
|
if html != nil
|
11
|
-
"
|
13
|
+
xml = "<gv>" + html[1].to_s + "</gv>"
|
14
|
+
begin
|
15
|
+
doc = REXML::Document.new(xml)
|
16
|
+
unless doc.root.text == html[1].to_s
|
17
|
+
"<#{html[1]}>"
|
18
|
+
else
|
19
|
+
@data.to_s.inspect.gsub( "\\\\", "\\" )
|
20
|
+
end
|
21
|
+
rescue REXML::ParseException => _
|
22
|
+
@data.to_s.inspect.gsub( "\\\\", "\\" )
|
23
|
+
end
|
12
24
|
else
|
13
25
|
@data.to_s.inspect.gsub( "\\\\", "\\" )
|
14
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-graphviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregoire Lejeune
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- examples/sample70.rb
|
201
201
|
- examples/sample71.rb
|
202
202
|
- examples/sample72.rb
|
203
|
+
- examples/sample73.rb
|
203
204
|
- examples/sample99.rb
|
204
205
|
- examples/sdlshapes/README
|
205
206
|
- examples/sdlshapes/sdl.ps
|
@@ -295,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
296
|
version: '0'
|
296
297
|
requirements: []
|
297
298
|
rubyforge_project: ruby-asp
|
298
|
-
rubygems_version: 2.2.
|
299
|
+
rubygems_version: 2.2.2
|
299
300
|
signing_key:
|
300
301
|
specification_version: 4
|
301
302
|
summary: Interface to the GraphViz graphing tool
|