ruby-graphviz 0.9.11 → 0.9.12
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/AUTHORS +1 -0
- data/README.rdoc +49 -7
- data/bin/ruby2gv +2 -2
- data/examples/sample07.rb +2 -2
- data/examples/sample08.rb +7 -7
- data/examples/sample30.rb +1 -1
- data/examples/sample39.rb +11 -0
- data/examples/sample40.rb +13 -42
- data/examples/sample41.rb +8 -0
- data/examples/{p2p.rb → sample42.rb} +1 -1
- data/examples/{HTML-Labels.rb → sample43.rb} +2 -2
- data/examples/{arrowhead.rb → sample44.rb} +0 -0
- data/examples/{shapes.rb → sample45.rb} +1 -1
- data/examples/{testorder.rb → sample46.rb} +0 -0
- data/examples/{testxml.rb → sample47.rb} +1 -1
- data/examples/{graphviz.org/cluster.rb → sample48.rb} +1 -1
- data/examples/{graphviz.org/hello_world.rb → sample49.rb} +1 -1
- data/examples/{graphviz.org/lion_share.rb → sample50.rb} +1 -1
- data/examples/{graphviz.org/process.rb → sample51.rb} +1 -1
- data/examples/{graphviz.org/TrafficLights.rb → sample52.rb} +1 -1
- data/examples/sample53.rb +26 -0
- data/examples/sample54.rb +26 -0
- data/examples/sample99.rb +70 -0
- data/lib/graphviz.rb +31 -8
- data/lib/graphviz/attrs.rb +1 -1
- data/lib/graphviz/constants.rb +2 -2
- data/lib/graphviz/edge.rb +44 -20
- data/lib/graphviz/family_tree.rb +56 -5
- data/lib/graphviz/family_tree/couple.rb +16 -6
- data/lib/graphviz/family_tree/generation.rb +19 -5
- data/lib/graphviz/family_tree/person.rb +39 -13
- data/lib/graphviz/family_tree/sibling.rb +13 -0
- data/lib/graphviz/node.rb +11 -3
- data/lib/graphviz/nothugly.rb +42 -0
- data/lib/graphviz/nothugly/nothugly.xsl +321 -0
- data/lib/graphviz/parser.rb +1 -1
- data/lib/graphviz/xml.rb +1 -1
- data/test/test_examples.rb +4 -0
- metadata +44 -58
- data/examples/maketest.bat +0 -109
- data/examples/maketest.sh +0 -109
- data/examples/sample30.rb.ps +0 -923
- data/examples/sample37.rb.dot +0 -50
- data/examples/sample37.rb.png +0 -0
- data/test/output/sample01.rb.png +0 -0
- data/test/output/sample02.rb.png +0 -0
- data/test/output/sample03.rb.png +0 -0
- data/test/output/sample04.rb.png +0 -0
- data/test/output/sample05.rb.png +0 -0
- data/test/output/sample06.rb.png +0 -0
- data/test/output/sample07.rb.png +0 -0
- data/test/output/sample08.rb.png +0 -0
- data/test/output/sample09.rb.png +0 -0
- data/test/output/sample10.rb.png +0 -0
- data/test/output/sample11.rb.png +0 -0
- data/test/output/sample12.rb.png +0 -0
- data/test/output/sample13.rb.png +0 -0
- data/test/output/sample14.rb.png +0 -0
- data/test/output/sample15.rb.png +0 -0
- data/test/output/sample16.rb.png +0 -0
- data/test/output/sample17.rb.png +0 -0
- data/test/output/sample18.rb.png +0 -0
- data/test/output/sample19.rb.png +0 -0
- data/test/output/sample20.rb.png +0 -0
- data/test/output/sample21.rb.html +0 -3
- data/test/output/sample21.rb.png +0 -0
- data/test/output/sample22.rb.html +0 -5
- data/test/output/sample22.rb.png +0 -0
- data/test/output/sample23.rb.png +0 -0
- data/test/output/sample24.rb.png +0 -0
- data/test/output/sample25.rb.png +0 -0
- data/test/output/sample26.rb.png +0 -0
- data/test/output/sample28.rb.png +0 -0
- data/test/output/sample29.rb.svg +0 -21
- data/test/output/sample30.rb.ps +0 -268
- data/test/output/sample31.rb.png +0 -0
- data/test/output/sample32.rb.png +0 -0
- data/test/output/sample37.rb.dot +0 -50
- data/test/output/sample37.rb.png +0 -0
- data/test/output/sample38.rb.png +0 -0
- data/test/output/sample40.rb.png +0 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file use notugly.xsl: An XSL transform to pretty up the SVG output from Graphviz
|
2
|
+
#
|
3
|
+
# See: http://www.hokstad.com/making-graphviz-output-pretty-with-xsl.html
|
4
|
+
# And: http://www.hokstad.com/making-graphviz-output-pretty-with-xsl-updated.html
|
5
|
+
#
|
6
|
+
# By Vidar Hokstad and Ryan Shea; Contributions by Jonas Tingborn,
|
7
|
+
# Earl Cummings, Michael Kennedy (Graphviz 2.20.2 compatibility, bug fixes,
|
8
|
+
# testing, lots of gradients)
|
9
|
+
|
10
|
+
require 'rubygems'
|
11
|
+
require 'xml/xslt'
|
12
|
+
|
13
|
+
class GraphViz
|
14
|
+
# Transform to pretty up the SVG output
|
15
|
+
#
|
16
|
+
# For more information, see http://www.hokstad.com/making-graphviz-output-pretty-with-xsl.html
|
17
|
+
# and http://www.hokstad.com/making-graphviz-output-pretty-with-xsl-updated.html
|
18
|
+
#
|
19
|
+
# You can use the :nothugly option to GraphViz#output :
|
20
|
+
#
|
21
|
+
# graph.output( :svg => "myGraph.svg", :nothugly => true )
|
22
|
+
#
|
23
|
+
# Or directly on an SVG output graph :
|
24
|
+
#
|
25
|
+
# GraphViz.nothugly( "myGraph.svg" )
|
26
|
+
def self.nothugly( file, save = true )
|
27
|
+
xslt = XML::XSLT.new()
|
28
|
+
xslt.xml = file
|
29
|
+
xslt.xsl = File.join( File.dirname(File.expand_path(__FILE__)), "nothugly", "nothugly.xsl" )
|
30
|
+
|
31
|
+
out = xslt.serve()
|
32
|
+
|
33
|
+
if save
|
34
|
+
fname = File.join( File.dirname(File.expand_path(file)), File.basename(file))
|
35
|
+
File.open( fname, "w" ) { |io|
|
36
|
+
io.print out
|
37
|
+
}
|
38
|
+
else
|
39
|
+
return out
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,321 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
3
|
+
xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<xsl:output method="xml" indent="yes"
|
5
|
+
doctype-public="-//W3C//DTD SVG 1.0//EN"
|
6
|
+
doctype-system="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
|
7
|
+
|
8
|
+
<xsl:template match="@*|node()">
|
9
|
+
<xsl:copy>
|
10
|
+
<xsl:apply-templates select="@*|node()"/>
|
11
|
+
</xsl:copy>
|
12
|
+
</xsl:template>
|
13
|
+
|
14
|
+
<xsl:template match="svg:svg">
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
16
|
+
<!-- Order is important here, so the attributes below overrides the
|
17
|
+
originals, which are copied "wholesale" -->
|
18
|
+
<xsl:apply-templates select="@*" />
|
19
|
+
|
20
|
+
<defs>
|
21
|
+
<linearGradient id="white" x1="0%" y1="0%" x2="0%" y2="0%">
|
22
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
23
|
+
</linearGradient>
|
24
|
+
|
25
|
+
<linearGradient id="aquamarine" x1="0%" y1="0%" x2="100%" y2="100%">
|
26
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
27
|
+
<stop offset="100%" style="stop-color:rgb(127,255,212);stop-opacity:1"/>
|
28
|
+
</linearGradient>
|
29
|
+
|
30
|
+
<linearGradient id="azure" x1="0%" y1="0%" x2="100%" y2="100%">
|
31
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
32
|
+
<stop offset="100%" style="stop-color:rgb(240,255,255);stop-opacity:1"/>
|
33
|
+
</linearGradient>
|
34
|
+
|
35
|
+
<linearGradient id="blue" x1="0%" y1="0%" x2="100%" y2="100%">
|
36
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
37
|
+
<stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1"/>
|
38
|
+
</linearGradient>
|
39
|
+
|
40
|
+
<linearGradient id="blueviolet" x1="0%" y1="0%" x2="100%" y2="100%">
|
41
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
42
|
+
<stop offset="100%" style="stop-color:rgb(138,43,226);stop-opacity:1"/>
|
43
|
+
</linearGradient>
|
44
|
+
|
45
|
+
<linearGradient id="brown" x1="0%" y1="0%" x2="100%" y2="100%">
|
46
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
47
|
+
<stop offset="100%" style="stop-color:rgb(165,42,42);stop-opacity:1"/>
|
48
|
+
</linearGradient>
|
49
|
+
|
50
|
+
<linearGradient id="cadetblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
51
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
52
|
+
<stop offset="100%" style="stop-color:rgb(95,158,160);stop-opacity:1"/>
|
53
|
+
</linearGradient>
|
54
|
+
|
55
|
+
<linearGradient id="chocolate" x1="0%" y1="0%" x2="100%" y2="100%">
|
56
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
57
|
+
<stop offset="100%" style="stop-color:rgb(210,105,30);stop-opacity:1"/>
|
58
|
+
</linearGradient>
|
59
|
+
|
60
|
+
<linearGradient id="cornflowerblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
61
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
62
|
+
<stop offset="100%" style="stop-color:rgb(100,149,237);stop-opacity:1"/>
|
63
|
+
</linearGradient>
|
64
|
+
|
65
|
+
<linearGradient id="crimson" x1="0%" y1="0%" x2="100%" y2="100%">
|
66
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
67
|
+
<stop offset="100%" style="stop-color:rgb(220,20,60);stop-opacity:1"/>
|
68
|
+
</linearGradient>
|
69
|
+
|
70
|
+
<linearGradient id="cyan" x1="0%" y1="0%" x2="100%" y2="100%">
|
71
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
72
|
+
<stop offset="100%" style="stop-color:rgb(0,255,255);stop-opacity:1"/>
|
73
|
+
</linearGradient>
|
74
|
+
|
75
|
+
<linearGradient id="darkgreen" x1="0%" y1="0%" x2="100%" y2="100%">
|
76
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
77
|
+
<stop offset="100%" style="stop-color:rgb(0,100,0);stop-opacity:1"/>
|
78
|
+
</linearGradient>
|
79
|
+
|
80
|
+
<linearGradient id="darkorange" x1="0%" y1="0%" x2="100%" y2="100%">
|
81
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
82
|
+
<stop offset="100%" style="stop-color:rgb(255,140,0);stop-opacity:1"/>
|
83
|
+
</linearGradient>
|
84
|
+
|
85
|
+
<linearGradient id="gold" x1="0%" y1="0%" x2="100%" y2="100%">
|
86
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
87
|
+
<stop offset="100%" style="stop-color:rgb(255,215,0);stop-opacity:1"/>
|
88
|
+
</linearGradient>
|
89
|
+
|
90
|
+
<linearGradient id="gray" x1="0%" y1="0%" x2="100%" y2="100%">
|
91
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
92
|
+
<stop offset="100%" style="stop-color:rgb(192,192,192);stop-opacity:1"/>
|
93
|
+
</linearGradient>
|
94
|
+
|
95
|
+
<linearGradient id="greenyellow" x1="0%" y1="0%" x2="100%" y2="100%">
|
96
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
97
|
+
<stop offset="100%" style="stop-color:rgb(173,255,47);stop-opacity:1"/>
|
98
|
+
</linearGradient>
|
99
|
+
|
100
|
+
<linearGradient id="green" x1="0%" y1="0%" x2="100%" y2="100%">
|
101
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
102
|
+
<stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1"/>
|
103
|
+
</linearGradient>
|
104
|
+
|
105
|
+
<linearGradient id="grey" x1="0%" y1="0%" x2="100%" y2="100%">
|
106
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
107
|
+
<stop offset="100%" style="stop-color:rgb(192,192,192);stop-opacity:1"/>
|
108
|
+
</linearGradient>
|
109
|
+
|
110
|
+
<linearGradient id="hotpink" x1="0%" y1="0%" x2="100%" y2="100%">
|
111
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
112
|
+
<stop offset="100%" style="stop-color:rgb(255,105,180);stop-opacity:1"/>
|
113
|
+
</linearGradient>
|
114
|
+
|
115
|
+
<linearGradient id="indianred" x1="0%" y1="0%" x2="100%" y2="100%">
|
116
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
117
|
+
<stop offset="100%" style="stop-color:rgb(205,92,92);stop-opacity:1"/>
|
118
|
+
</linearGradient>
|
119
|
+
|
120
|
+
<linearGradient id="indigo" x1="0%" y1="0%" x2="100%" y2="100%">
|
121
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
122
|
+
<stop offset="100%" style="stop-color:rgb(75,0,130);stop-opacity:1"/>
|
123
|
+
</linearGradient>
|
124
|
+
|
125
|
+
<linearGradient id="lavender" x1="0%" y1="0%" x2="100%" y2="100%">
|
126
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
127
|
+
<stop offset="100%" style="stop-color:rgb(230,230,250);stop-opacity:1"/>
|
128
|
+
</linearGradient>
|
129
|
+
|
130
|
+
<linearGradient id="lightblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
131
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
132
|
+
<stop offset="100%" style="stop-color:rgb(173,216,230);stop-opacity:1"/>
|
133
|
+
</linearGradient>
|
134
|
+
|
135
|
+
<linearGradient id="lightgray" x1="0%" y1="0%" x2="100%" y2="100%">
|
136
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
137
|
+
<stop offset="100%" style="stop-color:rgb(211,211,211);stop-opacity:1"/>
|
138
|
+
</linearGradient>
|
139
|
+
|
140
|
+
<linearGradient id="lightgrey" x1="0%" y1="0%" x2="100%" y2="100%">
|
141
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
142
|
+
<stop offset="100%" style="stop-color:rgb(211,211,211);stop-opacity:1"/>
|
143
|
+
</linearGradient>
|
144
|
+
|
145
|
+
<linearGradient id="magenta" x1="0%" y1="0%" x2="100%" y2="100%">
|
146
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
147
|
+
<stop offset="100%" style="stop-color:rgb(255,0,255);stop-opacity:1"/>
|
148
|
+
</linearGradient>
|
149
|
+
|
150
|
+
<linearGradient id="maroon" x1="0%" y1="0%" x2="100%" y2="100%">
|
151
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
152
|
+
<stop offset="100%" style="stop-color:rgb(176,48,96);stop-opacity:1"/>
|
153
|
+
</linearGradient>
|
154
|
+
|
155
|
+
<linearGradient id="mediumblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
156
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
157
|
+
<stop offset="100%" style="stop-color:rgb(0,0,205);stop-opacity:1"/>
|
158
|
+
</linearGradient>
|
159
|
+
|
160
|
+
<linearGradient id="mediumpurple" x1="0%" y1="0%" x2="100%" y2="100%">
|
161
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
162
|
+
<stop offset="100%" style="stop-color:rgb(147,112,219);stop-opacity:1"/>
|
163
|
+
</linearGradient>
|
164
|
+
|
165
|
+
<linearGradient id="orange" x1="0%" y1="0%" x2="100%" y2="100%">
|
166
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
167
|
+
<stop offset="100%" style="stop-color:rgb(255,165,0);stop-opacity:1"/>
|
168
|
+
</linearGradient>
|
169
|
+
|
170
|
+
<linearGradient id="pink" x1="0%" y1="0%" x2="100%" y2="100%">
|
171
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
172
|
+
<stop offset="100%" style="stop-color:rgb(255,192,203);stop-opacity:1"/>
|
173
|
+
</linearGradient>
|
174
|
+
|
175
|
+
<linearGradient id="purple" x1="0%" y1="0%" x2="100%" y2="100%">
|
176
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
177
|
+
<stop offset="100%" style="stop-color:rgb(160,32,240);stop-opacity:1"/>
|
178
|
+
</linearGradient>
|
179
|
+
|
180
|
+
<linearGradient id="red" x1="0%" y1="0%" x2="100%" y2="100%">
|
181
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
182
|
+
<stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1"/>
|
183
|
+
</linearGradient>
|
184
|
+
|
185
|
+
<linearGradient id="steelblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
186
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
187
|
+
<stop offset="100%" style="stop-color:rgb(70,130,180);stop-opacity:1"/>
|
188
|
+
</linearGradient>
|
189
|
+
|
190
|
+
<linearGradient id="violet" x1="0%" y1="0%" x2="100%" y2="100%">
|
191
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
192
|
+
<stop offset="100%" style="stop-color:rgb(238,130,238);stop-opacity:1"/>
|
193
|
+
</linearGradient>
|
194
|
+
|
195
|
+
<linearGradient id="yellow" x1="0%" y1="0%" x2="100%" y2="100%">
|
196
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
197
|
+
<stop offset="100%" style="stop-color:rgb(255,255,0);stop-opacity:1"/>
|
198
|
+
</linearGradient>
|
199
|
+
|
200
|
+
<linearGradient id="none" x1="0%" y1="0%" x2="100%" y2="100%">
|
201
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
202
|
+
<stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
203
|
+
</linearGradient>
|
204
|
+
</defs>
|
205
|
+
|
206
|
+
<xsl:apply-templates />
|
207
|
+
</svg>
|
208
|
+
</xsl:template>
|
209
|
+
|
210
|
+
<!-- Match the top most "g" -->
|
211
|
+
<xsl:template match="/svg:svg/svg:g">
|
212
|
+
<g>
|
213
|
+
<xsl:apply-templates select="@*"/>
|
214
|
+
<!-- Graphviz uses a polygon as the background. Don't want a gradient there -->
|
215
|
+
<xsl:for-each select="svg:polygon">
|
216
|
+
<xsl:copy><xsl:apply-templates select="@*" /></xsl:copy>
|
217
|
+
</xsl:for-each>
|
218
|
+
<xsl:apply-templates select="svg:title|svg:g" />
|
219
|
+
</g>
|
220
|
+
</xsl:template>
|
221
|
+
|
222
|
+
|
223
|
+
<xsl:template match="svg:text">
|
224
|
+
<text>
|
225
|
+
<xsl:apply-templates select="@*" />
|
226
|
+
<xsl:attribute name="style">font-size:10px; font-family:Verdana</xsl:attribute>
|
227
|
+
<xsl:apply-templates select="text()"/>
|
228
|
+
</text>
|
229
|
+
</xsl:template>
|
230
|
+
|
231
|
+
|
232
|
+
<xsl:template match="svg:g">
|
233
|
+
<xsl:copy>
|
234
|
+
<xsl:apply-templates select="@*" />
|
235
|
+
|
236
|
+
<xsl:for-each select="svg:polygon|svg:ellipse">
|
237
|
+
<xsl:call-template name="poly-shadow" />
|
238
|
+
</xsl:for-each>
|
239
|
+
|
240
|
+
<xsl:choose>
|
241
|
+
<xsl:when test="@class='node'">
|
242
|
+
<xsl:for-each select="svg:path">
|
243
|
+
<xsl:call-template name="path-shadow" />
|
244
|
+
</xsl:for-each>
|
245
|
+
</xsl:when>
|
246
|
+
<xsl:otherwise>
|
247
|
+
<xsl:for-each select="svg:path">
|
248
|
+
<xsl:call-template name="path-shadow-edge" />
|
249
|
+
</xsl:for-each>
|
250
|
+
</xsl:otherwise>
|
251
|
+
</xsl:choose>
|
252
|
+
|
253
|
+
<xsl:for-each select="svg:polygon|svg:ellipse|svg:polyline">
|
254
|
+
<xsl:sort select="@ry" order="descending" />
|
255
|
+
<xsl:call-template name="poly-main" />
|
256
|
+
</xsl:for-each>
|
257
|
+
|
258
|
+
<xsl:choose>
|
259
|
+
<xsl:when test="@class='node'">
|
260
|
+
<xsl:for-each select="svg:path">
|
261
|
+
<xsl:call-template name="path-main" />
|
262
|
+
</xsl:for-each>
|
263
|
+
</xsl:when>
|
264
|
+
<xsl:otherwise>
|
265
|
+
<xsl:for-each select="svg:path">
|
266
|
+
<path><xsl:apply-templates select="@*" /></path>
|
267
|
+
</xsl:for-each>
|
268
|
+
</xsl:otherwise>
|
269
|
+
</xsl:choose>
|
270
|
+
|
271
|
+
<xsl:apply-templates select="svg:text" />
|
272
|
+
</xsl:copy>
|
273
|
+
</xsl:template>
|
274
|
+
|
275
|
+
<xsl:template name="poly-shadow">
|
276
|
+
<xsl:element name="{name()}">
|
277
|
+
<xsl:apply-templates select="@*"/>
|
278
|
+
<xsl:attribute name="style">fill: black; stroke: none; fill-opacity:0.3</xsl:attribute>
|
279
|
+
<xsl:attribute name="transform">translate(3,3)</xsl:attribute>
|
280
|
+
</xsl:element>
|
281
|
+
</xsl:template>
|
282
|
+
|
283
|
+
<xsl:template name="path-shadow">
|
284
|
+
<xsl:element name="{name()}">
|
285
|
+
<xsl:apply-templates select="@*"/>
|
286
|
+
<!-- For some reason this comes out twice, so the opacity is set to 0.15 instead of 0.3 -->
|
287
|
+
<xsl:attribute name="style">fill: black; stroke: none; fill-opacity:0.15</xsl:attribute>
|
288
|
+
<xsl:attribute name="transform">translate(3,3)</xsl:attribute>
|
289
|
+
</xsl:element>
|
290
|
+
</xsl:template>
|
291
|
+
|
292
|
+
<xsl:template name="path-shadow-edge">
|
293
|
+
<xsl:element name="{name()}">
|
294
|
+
<xsl:apply-templates select="@*"/>
|
295
|
+
<xsl:attribute name="style">fill: none; stroke: black; stroke-opacity:0.3</xsl:attribute>
|
296
|
+
<xsl:attribute name="transform">translate(3,3)</xsl:attribute>
|
297
|
+
</xsl:element>
|
298
|
+
</xsl:template>
|
299
|
+
|
300
|
+
<xsl:template name="poly-main">
|
301
|
+
<xsl:element name="{name()}">
|
302
|
+
<xsl:apply-templates select="@*" />
|
303
|
+
<xsl:choose>
|
304
|
+
<xsl:when test="@fill != ''">
|
305
|
+
<xsl:attribute name="style">fill:url(#<xsl:value-of select="@fill"/>);stroke:black;</xsl:attribute></xsl:when>
|
306
|
+
<xsl:otherwise><xsl:attribute name="style">fill:url(#<xsl:value-of select="normalize-space(substring-after(substring-before(@style,';'),'fill:'))"/>);stroke:<xsl:value-of select="normalize-space(substring-after(substring-after(@style,';'),'stroke:'))"/>;</xsl:attribute></xsl:otherwise>
|
307
|
+
</xsl:choose>
|
308
|
+
</xsl:element>
|
309
|
+
</xsl:template>
|
310
|
+
|
311
|
+
<xsl:template name="path-main">
|
312
|
+
<path>
|
313
|
+
<xsl:apply-templates select="@*" />
|
314
|
+
<!-- This is somewhat broken - the gradient is set based on the position/size of the element it is used with; as a result it doesn't line up properly with the main polygon -->
|
315
|
+
<xsl:attribute name="style">fill:url(#<xsl:value-of select="normalize-space(substring-after(substring-before(../svg:polygon/@style,';'),'fill:'))"/>);stroke:black;</xsl:attribute>
|
316
|
+
</path>
|
317
|
+
</xsl:template>
|
318
|
+
|
319
|
+
</xsl:stylesheet>
|
320
|
+
|
321
|
+
|
data/lib/graphviz/parser.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2009 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
1
|
+
# Copyright (C) 2009, 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
data/lib/graphviz/xml.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
1
|
+
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
data/test/test_examples.rb
CHANGED
@@ -50,6 +50,10 @@ class GraphVizTest < Test::Unit::TestCase
|
|
50
50
|
assert_output_pattern(/\Adigraph G \{.*\}\n\Z/m, '38')
|
51
51
|
end
|
52
52
|
|
53
|
+
def test_sample40
|
54
|
+
assert_output_pattern(/\Adigraph G \{.*\}\n\Z/m, '40')
|
55
|
+
end
|
56
|
+
|
53
57
|
|
54
58
|
#
|
55
59
|
# for every sample file in the examples directory that matches the
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-graphviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 35
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
9
|
+
- 12
|
10
|
+
version: 0.9.12
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Gregoire Lejeune
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-06-28 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: treetop
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -47,7 +50,6 @@ files:
|
|
47
50
|
- setup.rb
|
48
51
|
- bin/gem2gv
|
49
52
|
- bin/ruby2gv
|
50
|
-
- examples/arrowhead.rb
|
51
53
|
- examples/dot/cluster.dot
|
52
54
|
- examples/dot/dotgraph.dot
|
53
55
|
- examples/dot/fsm.dot
|
@@ -63,16 +65,7 @@ files:
|
|
63
65
|
- examples/dot/test.dot
|
64
66
|
- examples/dot/test_parse.rb
|
65
67
|
- examples/dot/unix.dot
|
66
|
-
- examples/graphviz.org/cluster.rb
|
67
|
-
- examples/graphviz.org/hello_world.rb
|
68
|
-
- examples/graphviz.org/lion_share.rb
|
69
|
-
- examples/graphviz.org/process.rb
|
70
|
-
- examples/graphviz.org/TrafficLights.rb
|
71
68
|
- examples/hello.png
|
72
|
-
- examples/HTML-Labels.rb
|
73
|
-
- examples/maketest.bat
|
74
|
-
- examples/maketest.sh
|
75
|
-
- examples/p2p.rb
|
76
69
|
- examples/rgv/rgv.ps
|
77
70
|
- examples/rgv/test_rgv.rb
|
78
71
|
- examples/rgv/test_rgv.rb.ps
|
@@ -106,7 +99,6 @@ files:
|
|
106
99
|
- examples/sample28.rb
|
107
100
|
- examples/sample29.rb
|
108
101
|
- examples/sample30.rb
|
109
|
-
- examples/sample30.rb.ps
|
110
102
|
- examples/sample31.rb
|
111
103
|
- examples/sample32.rb
|
112
104
|
- examples/sample33.rb
|
@@ -114,18 +106,29 @@ files:
|
|
114
106
|
- examples/sample35.rb
|
115
107
|
- examples/sample36.rb
|
116
108
|
- examples/sample37.rb
|
117
|
-
- examples/sample37.rb.dot
|
118
|
-
- examples/sample37.rb.png
|
119
109
|
- examples/sample38.rb
|
110
|
+
- examples/sample39.rb
|
120
111
|
- examples/sample40.rb
|
112
|
+
- examples/sample41.rb
|
113
|
+
- examples/sample42.rb
|
114
|
+
- examples/sample43.rb
|
115
|
+
- examples/sample44.rb
|
116
|
+
- examples/sample45.rb
|
117
|
+
- examples/sample46.rb
|
118
|
+
- examples/sample47.rb
|
119
|
+
- examples/sample48.rb
|
120
|
+
- examples/sample49.rb
|
121
|
+
- examples/sample50.rb
|
122
|
+
- examples/sample51.rb
|
123
|
+
- examples/sample52.rb
|
124
|
+
- examples/sample53.rb
|
125
|
+
- examples/sample54.rb
|
126
|
+
- examples/sample99.rb
|
121
127
|
- examples/sdlshapes/README
|
122
128
|
- examples/sdlshapes/sdl.ps
|
123
129
|
- examples/sdlshapes/sdlshapes.dot
|
124
|
-
- examples/shapes.rb
|
125
130
|
- examples/simpsons.gv
|
126
131
|
- examples/test.xml
|
127
|
-
- examples/testorder.rb
|
128
|
-
- examples/testxml.rb
|
129
132
|
- lib/graphviz/attrs.rb
|
130
133
|
- lib/graphviz/constants.rb
|
131
134
|
- lib/graphviz/core_ext.rb
|
@@ -134,51 +137,17 @@ files:
|
|
134
137
|
- lib/graphviz/family_tree/couple.rb
|
135
138
|
- lib/graphviz/family_tree/generation.rb
|
136
139
|
- lib/graphviz/family_tree/person.rb
|
140
|
+
- lib/graphviz/family_tree/sibling.rb
|
137
141
|
- lib/graphviz/family_tree.rb
|
138
142
|
- lib/graphviz/node.rb
|
143
|
+
- lib/graphviz/nothugly/nothugly.xsl
|
144
|
+
- lib/graphviz/nothugly.rb
|
139
145
|
- lib/graphviz/parser.rb
|
140
146
|
- lib/graphviz/types/esc_string.rb
|
141
147
|
- lib/graphviz/types/html_string.rb
|
142
148
|
- lib/graphviz/types.rb
|
143
149
|
- lib/graphviz/xml.rb
|
144
150
|
- lib/graphviz.rb
|
145
|
-
- test/output/sample01.rb.png
|
146
|
-
- test/output/sample02.rb.png
|
147
|
-
- test/output/sample03.rb.png
|
148
|
-
- test/output/sample04.rb.png
|
149
|
-
- test/output/sample05.rb.png
|
150
|
-
- test/output/sample06.rb.png
|
151
|
-
- test/output/sample07.rb.png
|
152
|
-
- test/output/sample08.rb.png
|
153
|
-
- test/output/sample09.rb.png
|
154
|
-
- test/output/sample10.rb.png
|
155
|
-
- test/output/sample11.rb.png
|
156
|
-
- test/output/sample12.rb.png
|
157
|
-
- test/output/sample13.rb.png
|
158
|
-
- test/output/sample14.rb.png
|
159
|
-
- test/output/sample15.rb.png
|
160
|
-
- test/output/sample16.rb.png
|
161
|
-
- test/output/sample17.rb.png
|
162
|
-
- test/output/sample18.rb.png
|
163
|
-
- test/output/sample19.rb.png
|
164
|
-
- test/output/sample20.rb.png
|
165
|
-
- test/output/sample21.rb.html
|
166
|
-
- test/output/sample21.rb.png
|
167
|
-
- test/output/sample22.rb.html
|
168
|
-
- test/output/sample22.rb.png
|
169
|
-
- test/output/sample23.rb.png
|
170
|
-
- test/output/sample24.rb.png
|
171
|
-
- test/output/sample25.rb.png
|
172
|
-
- test/output/sample26.rb.png
|
173
|
-
- test/output/sample28.rb.png
|
174
|
-
- test/output/sample29.rb.svg
|
175
|
-
- test/output/sample30.rb.ps
|
176
|
-
- test/output/sample31.rb.png
|
177
|
-
- test/output/sample32.rb.png
|
178
|
-
- test/output/sample37.rb.dot
|
179
|
-
- test/output/sample37.rb.png
|
180
|
-
- test/output/sample38.rb.png
|
181
|
-
- test/output/sample40.rb.png
|
182
151
|
- test/support.rb
|
183
152
|
- test/test_examples.rb
|
184
153
|
- test/test_init.rb
|
@@ -186,13 +155,26 @@ has_rdoc: true
|
|
186
155
|
homepage: http://raa.ruby-lang.org/project/ruby-graphviz/
|
187
156
|
licenses: []
|
188
157
|
|
189
|
-
post_install_message:
|
158
|
+
post_install_message: |
|
190
159
|
|
191
160
|
Since version 0.9.2, Ruby/GraphViz can use Open3.popen3 (or not)
|
192
161
|
On Windows, you can install 'win32-open3'
|
193
162
|
|
194
163
|
You need to install GraphViz (http://graphviz.org/) to use this Gem.
|
195
164
|
|
165
|
+
For more information about Ruby-Graphviz :
|
166
|
+
* Doc : http://rdoc.info/projects/glejeune/Ruby-Graphviz
|
167
|
+
* Sources : http://github.com/glejeune/Ruby-Graphviz
|
168
|
+
* NEW - Mailing List : http://groups.google.com/group/ruby-graphviz
|
169
|
+
|
170
|
+
/!\ Version 0.9.12 introduce a new solution to connect edges to node ports
|
171
|
+
For more information, see http://github.com/glejeune/Ruby-Graphviz/issues/#issue/13
|
172
|
+
So if you use node ports, maybe you need to change your code.
|
173
|
+
|
174
|
+
/!\ GraphViz::Node#name is deprecated and will be removed in version 1.0.0
|
175
|
+
|
176
|
+
/!\ :output and :file options are deprecated and will be removed in version 1.0.0
|
177
|
+
|
196
178
|
rdoc_options:
|
197
179
|
- --title
|
198
180
|
- Ruby/GraphViz
|
@@ -201,23 +183,27 @@ rdoc_options:
|
|
201
183
|
require_paths:
|
202
184
|
- lib
|
203
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
204
187
|
requirements:
|
205
188
|
- - ">="
|
206
189
|
- !ruby/object:Gem::Version
|
190
|
+
hash: 3
|
207
191
|
segments:
|
208
192
|
- 0
|
209
193
|
version: "0"
|
210
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
211
196
|
requirements:
|
212
197
|
- - ">="
|
213
198
|
- !ruby/object:Gem::Version
|
199
|
+
hash: 3
|
214
200
|
segments:
|
215
201
|
- 0
|
216
202
|
version: "0"
|
217
203
|
requirements: []
|
218
204
|
|
219
205
|
rubyforge_project: ruby-asp
|
220
|
-
rubygems_version: 1.3.
|
206
|
+
rubygems_version: 1.3.7
|
221
207
|
signing_key:
|
222
208
|
specification_version: 3
|
223
209
|
summary: Interface to the GraphViz graphing tool
|