graphvizml 0.1.2 → 0.2.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 +30 -19
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: fa1a602a47c8fd18ef15dca1bade19d3fff91b4f
|
4
|
+
data.tar.gz: e720cce356fe7729149af89fe81e3ac4ae8490b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44f4558ce01e9cd7d72a484fb081c754ed7c6c1db5c4a04ce89be1b08a501a8be7bf6b49f556c0cb53eea9281a56734e873aed8bd471288e3bccbc109c3c7cbf
|
7
|
+
data.tar.gz: 98a20cd7ae810889f8755aa98cc69f1179d3277821aa12dfb6e794403cd6d02877ce41ca6d27e123551b59a23475dadf9ed71ba0db01a5f7918cb01df5720a2d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/graphvizml.rb
CHANGED
@@ -25,26 +25,43 @@ class GraphVizML
|
|
25
25
|
@doc = obj
|
26
26
|
|
27
27
|
end
|
28
|
+
|
29
|
+
build()
|
28
30
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def to_png(filename=@filename.sub(/\.xml$/,'.png'))
|
32
|
-
|
33
|
-
|
34
|
+
@g.output( png: filename )
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def build
|
40
|
+
|
41
|
+
stylesheet = @doc.root.element('style').text
|
34
42
|
e_nodes = @doc.root.element 'nodes'
|
35
43
|
e_edges = @doc.root.element 'edges'
|
36
44
|
|
37
|
-
#
|
45
|
+
# parse the stylesheet
|
38
46
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
47
|
+
a = stylesheet.split(/}/)[0..-2].map do |entry|
|
48
|
+
|
49
|
+
raw_selector,raw_styles = entry.split(/{/,2)
|
50
|
+
|
51
|
+
h = raw_styles.strip.split(/;/).inject({}) do |r, x|
|
52
|
+
k, v = x.split(/:/,2).map(&:strip)
|
53
|
+
r.merge(k.to_sym => v)
|
54
|
+
end
|
55
|
+
|
56
|
+
[raw_selector.split(/,\s*/).map(&:strip), h]
|
57
|
+
end
|
58
|
+
|
59
|
+
node_style = a.detect {|x| x.assoc 'node'}
|
60
|
+
node_style.last.each {|key, value| @g.node[key] = value } if node_style
|
61
|
+
|
62
|
+
edge_style = a.detect {|x| x.assoc 'edge'}
|
63
|
+
edge_style.last.each {|key, value| @g.edge[key] = value } if edge_style
|
43
64
|
|
44
|
-
xpath_edge = "records/option[summary/type='edge']/records/attribute"
|
45
|
-
e_options.root.xpath(xpath_edge).each do |attribute|
|
46
|
-
@g.edge[attribute.text('name').to_sym] = attribute.text('value')
|
47
|
-
end
|
48
65
|
|
49
66
|
# add the nodes
|
50
67
|
|
@@ -59,13 +76,7 @@ class GraphVizML
|
|
59
76
|
a = edge.xpath('records/node')
|
60
77
|
@g.add_edge(a[0].attribute('id').to_s,
|
61
78
|
a[1].attribute('id').to_s).label = edge.text('summary/label').to_s
|
62
|
-
end
|
63
|
-
|
64
|
-
# output the file
|
65
|
-
|
66
|
-
out_type = e_edges.root.text('summary/output_type')
|
67
|
-
out_file = e_edges.root.text('summary/output_file')
|
68
|
-
@g.output( png: filename )
|
79
|
+
end
|
69
80
|
end
|
70
81
|
|
71
|
-
end
|
82
|
+
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
0fBBWVqwHyWs77T9gCuDZmQrw2NmfyhNWhBw0iljBXo7WLDNB3x0nP6mYTzk47O8
|
32
32
|
sL5FGYJNgQqFlw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-01-
|
34
|
+
date: 2017-01-07 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexle
|
metadata.gz.sig
CHANGED
Binary file
|