pxgraphviz 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5567498ebd46ecaf176741b68bc9dd42199d9ac33bae825518f85934f893d33
4
- data.tar.gz: c1ffe2da02b87e4700734520858133931311533a075036ff1d0ab354a144a80c
3
+ metadata.gz: 8ec769baa44cc90b7da7bb62a0856f87da40246ffaa5096051e58eed34d783b1
4
+ data.tar.gz: d471f35e76cc4993a38405c5dba1e162401402811661a8b71148c41f746e2760
5
5
  SHA512:
6
- metadata.gz: da79778a85611f9151eed784f10c0a6e4df50aa7d3727814d5a174573e63d11cfa8ad8327d31cbeacf5ba96239b68e004cb97ea6c93391a1025132144106746e
7
- data.tar.gz: 329ff7530bbb92da72f41a52395a7d7875564f8200538ad19fd06b9195df6388a0df256cf03d67bb3aaa4467c007da76bf35ac26ed21dba711a921d502d4fe04
6
+ metadata.gz: 807f06da5f13d2194f8a0c75444c62ac59bc06990956282a71d075e1c70df86cc8c83a2daf21531757a1e137ed2f2edfea269a61f43fd1823f1d526d4b33321e
7
+ data.tar.gz: dea35e397915adc20147b7884b649b01563d616884e9a8f06856f93074071cb646ff42357bf8f391237c58f1f2c3e57acffe5acc34b8ab9bc32629778f63d6b5
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/pxgraphviz.rb CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  require 'polyrex'
7
7
  require 'graphvizml'
8
+ require 'rxfreader'
8
9
 
9
10
 
10
11
  module RegGem
@@ -17,7 +18,7 @@ hkey_gems
17
18
  require pxgraphviz
18
19
  class PxGraphViz
19
20
  media_type svg
20
- '
21
+ '
21
22
  end
22
23
  end
23
24
 
@@ -27,65 +28,65 @@ class PxGraphViz < GraphVizML
27
28
 
28
29
  attr_reader :doc, :px
29
30
 
30
- def initialize(obj=nil, style: nil, debug: false, fill: '#778833',
31
+ def initialize(obj=nil, style: nil, debug: false, fill: '#778833',
31
32
  stroke: '#999999', text_color: '#ffeecc')
32
33
 
33
34
  if obj then
34
35
 
35
- s = RXFHelper.read(obj).first
36
+ s = RXFReader.read(obj).first
36
37
  @doc = import_string(s)
37
38
 
38
39
  puts 'pxgraphviz: before super'.info if debug
39
40
 
40
- super(@doc, debug: debug, fill: fill,
41
+ super(@doc, debug: debug, fill: fill,
41
42
  stroke: stroke, text_color: text_color)
42
-
43
+
43
44
  end
44
-
45
+
45
46
  @css = "
46
47
  .node polygon {stroke: #{stroke}; fill: #{fill}}
47
48
  .node text {fill: #{text_color}}
48
49
  .edge path {stroke: #{stroke}}
49
50
  .edge polygon {stroke: #{stroke}; fill: #{stroke}}
50
51
  "
51
-
52
+
52
53
  end
53
54
 
54
55
  def import(s)
55
- s2 = RXFHelper.read(s).first
56
+ s2 = RXFReader.read(s).first
56
57
  @doc = import_string s2
57
58
  @g = build_from_nodes Domle.new(@doc.root.xml)
58
59
  self
59
- end
60
-
61
-
60
+ end
61
+
62
+
62
63
  protected
63
-
64
+
64
65
  def default_stylesheet()
65
66
 
66
67
  <<STYLE
67
- node {
68
- color: #ddaa66;
68
+ node {
69
+ color: #ddaa66;
69
70
  fillcolor: #{@fill};
70
- fontcolor: #{@text_color};
71
+ fontcolor: #{@text_color};
71
72
  fontname: 'Trebuchet MS';
72
- fontsize: 8;
73
+ fontsize: 8;
73
74
  margin: 0.0;
74
- penwidth: 1;
75
+ penwidth: 1;
75
76
  style: filled;
76
- shape: #{@shape};
77
+ shape: #{@shape};
77
78
  }
78
-
79
+
79
80
  a node {
80
- color: #0011ee;
81
+ color: #0011ee;
81
82
  }
82
83
 
83
84
  edge {
84
85
  arrowsize: 0.5;
85
- color: #{@stroke};
86
- fontcolor: #444444;
87
- fontname: Verdana;
88
- fontsize: 8;
86
+ color: #{@stroke};
87
+ fontcolor: #444444;
88
+ fontname: Verdana;
89
+ fontsize: 8;
89
90
  #{@type}
90
91
  weight: 1;
91
92
  }
@@ -93,65 +94,65 @@ STYLE
93
94
 
94
95
  end
95
96
 
96
-
97
+
97
98
  private
98
-
99
+
99
100
  def import_string(s)
100
101
 
101
102
  @px = if s =~ /<\?pxgraphviz\b/ then
102
-
103
+
103
104
  header = "<?polyrex schema='items[type, shape]/item[label, connection]' delimiter =' # '?>
104
105
  type: digraph
105
- shape: box
106
+ shape: box
106
107
  "
107
108
  s2 = s.slice!(/<\?pxgraphviz\b[^>]*\?>/)
108
109
 
109
110
  if s2 then
110
-
111
+
111
112
  attributes = %w(id fill stroke text_color).inject({}) do |r, keyword|
112
113
  found = s2[/(?<=#{keyword}=['"])[^'"]+/]
113
114
  found ? r.merge(keyword.to_sym => found) : r
114
115
  end
115
-
116
+
116
117
  fill, stroke, text_color = %i(fill stroke text_color).map do |x|
117
118
  attributes[x] ? attributes[x] : method(x).call
118
119
  end
119
-
120
+
120
121
  @css = "
121
122
  .node ellipse {stroke: #{stroke}; fill: #{fill}}
122
123
  .node text {fill: #{text_color}}
123
124
  .edge path {stroke: #{stroke}}
124
125
  .edge polygon {stroke: #{stroke}; fill: #{stroke}}
125
- "
126
-
127
- end
126
+ "
127
+
128
+ end
128
129
  s3 = header + s
129
130
  puts 's3: ' + s3.inspect if @debug
130
131
  Polyrex.new.import(s3)
131
-
132
+
132
133
  else
133
-
134
+
134
135
  Polyrex.new(s)
135
-
136
- end
136
+
137
+ end
137
138
 
138
139
  @type = @px.summary[:type] == 'digraph' ? 'dir: forward;' : 'dir: none;'
139
140
  @shape = @px.summary[:shape] || 'ellipse;'
140
-
141
+
141
142
  @style ||= default_stylesheet()
142
143
  doc = Rexslt.new(xslt_stylesheet(), @px.to_xml)\
143
144
  .to_doc.root.element('nodes')
144
-
145
+
145
146
  doc.root.elements.first.insert_before Rexle::Element.new('style')\
146
147
  .add_text @style
147
-
148
+
148
149
  doc
149
-
150
+
150
151
  end
151
-
152
+
152
153
  def xslt_stylesheet()
153
-
154
- <<XSLT
154
+
155
+ <<XSLT
155
156
  <?xml version="1.0" encoding="UTF-8"?>
156
157
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
157
158
  <xsl:output method="xml" indent="yes" />
@@ -185,12 +186,12 @@ shape: box
185
186
  <xsl:element name="a">
186
187
  <xsl:attribute name="href">
187
188
  <xsl:value-of select="summary/url"/>
188
- </xsl:attribute>
189
+ </xsl:attribute>
189
190
  <xsl:call-template name='node'/>
190
191
  </xsl:element>
191
192
 
192
193
  </xsl:when>
193
- <xsl:otherwise>
194
+ <xsl:otherwise>
194
195
 
195
196
  <xsl:call-template name='node'/>
196
197
 
@@ -207,33 +208,33 @@ shape: box
207
208
 
208
209
  <xsl:template name='node'>
209
210
  <xsl:element name="node">
210
-
211
+
211
212
  <xsl:attribute name="shape">
212
213
  <xsl:value-of select="summary/shape"/>
213
214
  </xsl:attribute>
214
-
215
+
215
216
  <xsl:if test="summary/id">
216
217
  <xsl:attribute name="id">
217
218
  <xsl:value-of select="summary/id"/>
218
219
  </xsl:attribute>
219
220
  </xsl:if>
220
-
221
+
221
222
  <xsl:if test="summary/class">
222
223
  <xsl:attribute name="class">
223
224
  <xsl:value-of select="summary/class"/>
224
225
  </xsl:attribute>
225
226
  </xsl:if>
226
-
227
+
227
228
  <xsl:if test="summary/connection">
228
229
  <xsl:attribute name="connection">
229
230
  <xsl:value-of select="summary/connection"/>
230
231
  </xsl:attribute>
231
- </xsl:if>
232
-
232
+ </xsl:if>
233
+
233
234
  <xsl:apply-templates select='summary'/>
234
235
  <xsl:apply-templates select='records'/>
235
236
 
236
- </xsl:element>
237
+ </xsl:element>
237
238
  </xsl:template>
238
239
 
239
240
  </xsl:stylesheet>
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pxgraphviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -11,31 +11,31 @@ cert_chain:
11
11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yTAf1z9VnNZ+OffVQce3/usuXEN8WWwSu+qiJkz1/tYjuH
31
- VHnWd2ev/sdQK+S2x/icqXIPubabC9f1V9yLcZXkAC7TOaxc3/nAiGhDGDoY+PVH
32
- KShAlMz8gPqci5EwWK6yy+tOSv2e8xpipTPEZ1JyR4FiAz5AOrJzn7Z2idELpcY5
33
- OifmF8AO85wYwTUAW0O04ihDElZHR9uao79oiUNUY1Tdl/tXbrMI1l0dteQZdyNR
34
- aQIB0TXpdRb2V63OwA7958Xd2I5M/9SwsHLV6vInmmSRrtf05mxmKSZqF9gkSUNh
35
- UsYtvIztjMa8JTBJoeeVZQth+cfIFVp37noogboz8XiH8Q7j6kei39fxssRfOn8Z
36
- LQb4grw+PYKG3ZWURYEkALEW
28
+ BgkqhkiG9w0BAQsFAAOCAYEAg9lEWHF3avcbK4ktmHyDJl71m7SvG6QqPGbC5aYT
29
+ pI3+A9AIIUI9BlF0P4V/mSt9c9YccOjs1oT5qLIvhCpMJtDDy2w+tbzVG9ia1S0t
30
+ /1EZqbiAKGuMwaLI9P94ku3SjqecHQlMsA+dSqiJpHOBjhPB3fePATtCHIgzwhjT
31
+ a1SV51/pDyiNhwsUBLhqEMqUBOKBcDnZDXFQ612khj8GLW0TlLd1DnhYjS5HBi57
32
+ A3HlI1ftQU4ywVtJVyY5++npvwg7N9CxRN02Q3It/OE9UcHVELYsjH8T1IO23U5g
33
+ LcE3a44K374xnOB2a5Rjvr3n9dmbPIJSUWXAGKtVAxJQaQkXJ/JgORkG3UyOwyxx
34
+ 4+Iryd9KLXqoOlZie53pHP3baUn+NFWsOQTVWyhLDSvj4aG2fFZ4sYMOD8zJHrxl
35
+ Kw5MEmLLND9M4uj/YjCJaxgvkZ9u4iTBMNldKFS8X5Go7qOpzee47emfjxes++nS
36
+ 6hgbEtPQ0Tr9VNd2zW1qmLkG
37
37
  -----END CERTIFICATE-----
38
- date: 2019-06-11 00:00:00.000000000 Z
38
+ date: 2022-02-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: polyrex
@@ -43,42 +43,42 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.2'
46
+ version: '1.4'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.2.1
49
+ version: 1.4.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.2'
56
+ version: '1.4'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.2.1
59
+ version: 1.4.0
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: graphvizml
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '0.6'
66
+ version: '0.7'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.6.3
69
+ version: 0.7.1
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.6'
76
+ version: '0.7'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.6.3
79
+ version: 0.7.1
80
80
  description:
81
- email: james@jamesrobertson.eu
81
+ email: digital.robertson@gmail.com
82
82
  executables: []
83
83
  extensions: []
84
84
  extra_rdoc_files: []
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.1
106
+ rubygems_version: 3.2.22
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Generates a GraphViz Markup Language file from a Polyrex document
metadata.gz.sig CHANGED
Binary file