graphvizml 0.4.5 → 0.5.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/graphvizml.rb +13 -72
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4bdf526de42c11fc8ce95cae6fb00ab33da0060
|
4
|
+
data.tar.gz: 95bbde7cc050c1505f6da0d1d88a115f4e12b587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 660a430841c9c74ee2a96c5d0c710368339fab5af3233337d8777040ce852eaec9addccae47558a0ad253f9563a175c625e4a73f54c92608eacb93cc30d373a8
|
7
|
+
data.tar.gz: 7446bdea1e72372999a5011fc3197ee8347689cb561953b06d105a2265316528b594b79c32b8723bc10f840dc071cce302369237d8271884fffca0d343a3899a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/graphvizml.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# file: graphvizml.rb
|
4
4
|
|
5
5
|
|
6
|
-
require '
|
6
|
+
require 'domle'
|
7
7
|
require 'graphviz'
|
8
8
|
|
9
9
|
|
@@ -15,7 +15,7 @@ class GraphVizML
|
|
15
15
|
|
16
16
|
@doc = if obj.is_a? String then
|
17
17
|
|
18
|
-
|
18
|
+
Domle.new(File.read @filename=obj)
|
19
19
|
|
20
20
|
elsif obj.is_a? Rexle
|
21
21
|
|
@@ -80,7 +80,8 @@ class GraphVizML
|
|
80
80
|
# shape options: box, ellipse, record, diamond, circle, polygon, point
|
81
81
|
shape = h.has_key?(:shape) ? h[:shape] : :box
|
82
82
|
#puts "adding node id: %s label: %s" % [id, label]
|
83
|
-
r.merge(id => [label, {shape: shape}, nil])
|
83
|
+
r.merge(id => [label, node.style.merge({shape: shape}), nil])
|
84
|
+
|
84
85
|
end
|
85
86
|
|
86
87
|
|
@@ -89,7 +90,6 @@ class GraphVizML
|
|
89
90
|
id_1 = e_edges.root.element('records/edge/records/node/attribute::gid').to_s
|
90
91
|
nodes[id_1][-1] = @g.add_node(nodes[id_1][0])
|
91
92
|
|
92
|
-
|
93
93
|
e_edges.root.xpath('records/edge').each do |edge|
|
94
94
|
|
95
95
|
id1, id2 = edge.xpath('records/node/attribute::gid').map(&:to_s)
|
@@ -97,80 +97,21 @@ class GraphVizML
|
|
97
97
|
label = edge.text('summary/label').to_s
|
98
98
|
#puts "adding edge id1: %s id2: %s label: %s" % [id1, id2, label]
|
99
99
|
nodes[id2][-1] ||= nodes[id1].last.add_node(nodes[id2][0])
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
stylesheet = style ? style.text : default_stylesheet()
|
109
|
-
|
110
|
-
|
111
|
-
# parse the stylesheet
|
112
|
-
|
113
|
-
a = stylesheet.split(/}/)[0..-2].map do |entry|
|
114
|
-
|
115
|
-
raw_selector,raw_styles = entry.split(/{/,2)
|
116
|
-
|
117
|
-
h = raw_styles.strip.split(/;/).inject({}) do |r, x|
|
118
|
-
k, v = x.split(/:/,2).map(&:strip)
|
119
|
-
r.merge(k.to_sym => v)
|
120
|
-
end
|
121
|
-
|
122
|
-
[raw_selector.split(/,\s*/).map(&:strip), h]
|
123
|
-
end
|
124
|
-
|
125
|
-
node_style = a.detect {|x| x.assoc 'node'}
|
126
|
-
|
100
|
+
attributes = edge.style.merge({label: label})
|
101
|
+
conn = nodes[id1][-1].connections.last
|
102
|
+
conn.attributes[:label] = label
|
103
|
+
edge.style.each {|key,val| conn.attributes[key] = val }
|
104
|
+
|
105
|
+
end
|
106
|
+
|
127
107
|
nodes.each do |id, x|
|
128
108
|
|
129
109
|
_, attributes, obj = x
|
130
|
-
attributes.each {|key, value| obj.attributes[key] = value }
|
131
|
-
node_style.last.each {|key, value| obj.attributes[key] = value } if node_style
|
110
|
+
attributes.each {|key, value| obj.attributes[key] = value }
|
132
111
|
|
133
112
|
end
|
134
|
-
|
135
|
-
edge_style = a.detect {|x| x.assoc 'edge'}
|
136
|
-
|
137
|
-
nodes.each do |id,x|
|
138
|
-
x.last.connections.each do |conn|
|
139
|
-
edge_style.last.each {|key, value| conn.attributes[key] = value } if edge_style
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
113
|
+
|
143
114
|
:build
|
144
115
|
end
|
145
116
|
|
146
|
-
private
|
147
|
-
|
148
|
-
def default_stylesheet()
|
149
|
-
|
150
|
-
<<STYLE
|
151
|
-
node {
|
152
|
-
color: #ddaa66;
|
153
|
-
fillcolor: #ffeeee;
|
154
|
-
fontcolor: #113377;
|
155
|
-
fontname: Trebuchet MS;
|
156
|
-
fontsize: 9;
|
157
|
-
margin: 0.1;
|
158
|
-
penwidth: 1.3;
|
159
|
-
shape: box;
|
160
|
-
style: filled;
|
161
|
-
}
|
162
|
-
|
163
|
-
edge {
|
164
|
-
arrowsize: 0.9;
|
165
|
-
color: #999999;
|
166
|
-
fontcolor: #444444;
|
167
|
-
fontname: Verdana;
|
168
|
-
fontsize: 9;
|
169
|
-
#{@type == :digraph ? 'dir: forward;' : ''}
|
170
|
-
weight: 1;
|
171
|
-
}
|
172
|
-
|
173
|
-
STYLE
|
174
|
-
end
|
175
|
-
|
176
117
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphvizml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -34,25 +34,25 @@ cert_chain:
|
|
34
34
|
date: 2017-09-05 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: domle
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '0.2'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.2.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '0.2'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 0.2.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: graphviz
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|