svgle 0.4.2 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/lib/svgle.rb +73 -61
- metadata +31 -28
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4e75a2b4aa745a539a340cc99365feb7f225068856f1ae47326e5da19a4d3176
|
4
|
+
data.tar.gz: 1dc30b3366df5b9bf7d6f0fca5bddaf37a6b683245e8366b051eeaa7f45993a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a08e9a791925659dce44744b13226b28c4c709dba7eebd0c4acfcd9b5d011725ee3e356e168b653951393ad511e6618aeae17b8503fc52a73cfb819d7ebbac5
|
7
|
+
data.tar.gz: deea6aaa44eb88b97047de85e1d3c8c709850c6ff6deec9965daed0dc299584b4d45abbbb8f5d1136833c1648df17bf626490b2ead3bb7f0797ef9ebc64fdc15
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
��
|
1
|
+
C=mu� iN�E^���y܇��r�G/�a��qw^IJ�n�:� s��Z���/������2!\]A~ӵ3{��5zr(�2{�j^�:y�Ȅ?���o2��S�:<�n�
|
2
|
+
��W$���a$���UC��'��S���<�ǒ��T���pR������!~xu:�Q�g�UG��f�?���.�
|
data/lib/svgle.rb
CHANGED
@@ -16,8 +16,9 @@ require 'domle'
|
|
16
16
|
# http://stackoverflow.com/questions/7946187/point-and-ellipse-rotated-position-test-algorithm
|
17
17
|
# computational geometry - ruby http://sourceforge.net/projects/ruby-comp-geom/
|
18
18
|
|
19
|
-
|
19
|
+
DEFAULT_SVGLE_CSS = <<CSS
|
20
20
|
|
21
|
+
g {background-color: orange}
|
21
22
|
svg {background-color: white}
|
22
23
|
rect {fill: yellow}
|
23
24
|
line, polyline {stroke: green; stroke-width: 3}
|
@@ -28,36 +29,50 @@ CSS
|
|
28
29
|
|
29
30
|
|
30
31
|
class Svgle < Domle
|
32
|
+
|
33
|
+
|
34
|
+
class SvgElement < Element
|
35
|
+
|
36
|
+
@attr_map = {}
|
37
|
+
attr_reader :attr_map
|
38
|
+
|
39
|
+
attr2_accessor *%i(stroke stroke-width)
|
40
|
+
|
41
|
+
|
42
|
+
end
|
31
43
|
|
44
|
+
class Shape < SvgElement
|
45
|
+
attr2_accessor *%i(fill)
|
46
|
+
end
|
32
47
|
|
33
|
-
class A <
|
48
|
+
class A < SvgElement
|
34
49
|
# undecided how to implement this
|
35
50
|
# see http://stackoverflow.com/questions/12422668/getting-xlinkhref-attribute-of-the-svg-image-element-dynamically-using-js-i
|
36
51
|
#attr2_accessor *%i(href)
|
37
52
|
end
|
38
53
|
|
39
|
-
class Circle <
|
40
|
-
attr2_accessor *%i(cx cy r
|
54
|
+
class Circle < Shape
|
55
|
+
attr2_accessor *%i(cx cy r)
|
41
56
|
def boundary()
|
42
57
|
[0,0,0,0]
|
43
58
|
end
|
44
59
|
end
|
45
60
|
|
46
|
-
class Ellipse <
|
61
|
+
class Ellipse < Shape
|
47
62
|
attr2_accessor *%i(cx cy rx ry)
|
48
63
|
def boundary()
|
49
64
|
[0,0,0,0]
|
50
65
|
end
|
51
66
|
end
|
52
67
|
|
53
|
-
class G <
|
68
|
+
class G < SvgElement
|
54
69
|
attr2_accessor *%i(fill opacity)
|
55
70
|
def boundary()
|
56
71
|
[0,0,0,0]
|
57
72
|
end
|
58
73
|
end
|
59
74
|
|
60
|
-
class Line <
|
75
|
+
class Line < SvgElement
|
61
76
|
attr2_accessor *%i(x1 y1 x2 y2)
|
62
77
|
|
63
78
|
def boundary()
|
@@ -65,7 +80,7 @@ class Svgle < Domle
|
|
65
80
|
end
|
66
81
|
end
|
67
82
|
|
68
|
-
class Image <
|
83
|
+
class Image < SvgElement
|
69
84
|
|
70
85
|
attr2_accessor *%i(x y width height xlink:href src)
|
71
86
|
|
@@ -79,10 +94,9 @@ class Svgle < Domle
|
|
79
94
|
@src = s
|
80
95
|
|
81
96
|
self.attributes[:'xlink:href'] = if s =~ /^http/ then
|
82
|
-
|
83
|
-
|
84
|
-
filepath
|
85
|
-
File.write filepath, r
|
97
|
+
|
98
|
+
filepath = Tempfile.new('svgle').path + File.basename(s)
|
99
|
+
File.write filepath, RXFHelper.read(s).first
|
86
100
|
|
87
101
|
filepath
|
88
102
|
|
@@ -94,30 +108,30 @@ class Svgle < Domle
|
|
94
108
|
|
95
109
|
end
|
96
110
|
|
97
|
-
class Path <
|
98
|
-
attr2_accessor *%i(d
|
111
|
+
class Path < Shape
|
112
|
+
attr2_accessor *%i(d)
|
99
113
|
def boundary()
|
100
114
|
[0,0,0,0]
|
101
115
|
end
|
102
116
|
end
|
103
117
|
|
104
|
-
class Polygon <
|
118
|
+
class Polygon < Shape
|
105
119
|
attr2_accessor *%i(points)
|
106
120
|
def boundary()
|
107
121
|
[0,0,0,0]
|
108
122
|
end
|
109
123
|
end
|
110
124
|
|
111
|
-
class Polyline <
|
125
|
+
class Polyline < Shape
|
112
126
|
attr2_accessor *%i(points)
|
113
127
|
def boundary()
|
114
128
|
[0,0,0,0]
|
115
129
|
end
|
116
130
|
end
|
117
131
|
|
118
|
-
class Rect <
|
132
|
+
class Rect < Shape
|
119
133
|
|
120
|
-
attr2_accessor *%i(x y
|
134
|
+
attr2_accessor *%i(x y rx ry)
|
121
135
|
|
122
136
|
def boundary()
|
123
137
|
x1, y1, w, h = [x, y, width, height].map(&:to_i)
|
@@ -126,71 +140,69 @@ class Svgle < Domle
|
|
126
140
|
|
127
141
|
end
|
128
142
|
|
129
|
-
class Svg <
|
143
|
+
class Svg < SvgElement
|
130
144
|
attr2_accessor *%i(width height background-color)
|
131
145
|
def boundary()
|
132
146
|
[0,0,0,0]
|
133
147
|
end
|
134
148
|
end
|
149
|
+
|
135
150
|
|
136
|
-
class Text <
|
151
|
+
class Text < SvgElement
|
152
|
+
|
137
153
|
attr2_accessor *%i(x y fill)
|
154
|
+
|
138
155
|
def boundary()
|
139
156
|
[0,0,0,0]
|
140
157
|
end
|
158
|
+
|
159
|
+
def text=(raw_s)
|
160
|
+
|
161
|
+
oldval = @child_elements.first
|
162
|
+
|
163
|
+
r = super(raw_s)
|
164
|
+
@obj.text = raw_s if oldval != raw_s
|
165
|
+
|
166
|
+
return r
|
167
|
+
|
168
|
+
end
|
141
169
|
end
|
142
170
|
|
171
|
+
def initialize(src='<svg/>', callback: nil, rexle: self, debug: false)
|
172
|
+
super(src, callback: callback, rexle: rexle, debug: debug)
|
173
|
+
end
|
174
|
+
|
143
175
|
def inspect()
|
144
176
|
"#<Svgle:%s>" % [self.object_id]
|
145
177
|
end
|
146
178
|
|
147
179
|
|
148
|
-
|
149
|
-
|
150
|
-
def
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
@doc.root.xpath('//style').each {|e| add_css e.text }
|
158
|
-
|
159
|
-
# check for an external CSS file
|
160
|
-
if @instructions and @instructions.any? then
|
161
|
-
|
162
|
-
hrefs = @instructions.inject([]) do |r,x|
|
163
|
-
|
164
|
-
if x[0] =~ /xml-stylesheet/i and x[1] =~ /text\/css/i then
|
165
|
-
|
166
|
-
r << x[1][/href\s*=\s*["']([^'"]+)/,1]
|
167
|
-
else
|
168
|
-
r
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
add_css hrefs.map{|x| RXFHelper.read(x).first}.join
|
173
|
-
|
174
|
-
end
|
180
|
+
protected
|
181
|
+
|
182
|
+
def add_default_css()
|
183
|
+
add_css Object.const_get self.class.to_s + '::' + 'DEFAULT_' +
|
184
|
+
self.class.to_s.upcase + '_CSS'
|
185
|
+
add_inline_css()
|
186
|
+
end
|
175
187
|
|
176
|
-
|
188
|
+
private
|
177
189
|
|
178
190
|
def defined_elements()
|
179
191
|
{
|
180
|
-
circle:
|
181
|
-
ellipse:
|
182
|
-
line:
|
183
|
-
g:
|
184
|
-
image:
|
185
|
-
svg:
|
186
|
-
script:
|
187
|
-
style:
|
192
|
+
circle: Circle,
|
193
|
+
ellipse: Ellipse,
|
194
|
+
line: Line,
|
195
|
+
g: G,
|
196
|
+
image: Image,
|
197
|
+
svg: Svg,
|
198
|
+
script: Script,
|
199
|
+
style: Style,
|
188
200
|
doc: Rexle::Element,
|
189
|
-
polygon:
|
190
|
-
polyline:
|
191
|
-
path:
|
192
|
-
rect:
|
193
|
-
text:
|
201
|
+
polygon: Polygon,
|
202
|
+
polyline: Polyline,
|
203
|
+
path: Path,
|
204
|
+
rect: Rect,
|
205
|
+
text: Text
|
194
206
|
}
|
195
207
|
end
|
196
208
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svgle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
/
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwNTEyMDczMTQ5WhcN
|
15
|
+
MjEwNTEyMDczMTQ5WjAsMSowKAYDVQQDDCFnZW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30
|
+
o9m0W1WpwuXCVYVw06GoLU8/6AqBd0NYk1BX3VHFs+JDrVjCcYYNHsTbXSuBwfUA
|
31
|
+
rq5xQqBd9aJXuBJ6yGxtNZ/x+vhU/9EDCe21kMITmMu0QbFj2QicSwfEBHDO2gy0
|
32
|
+
mRj4WgPd7nCIjy81BtItELhQzoAtxoBgahAlX8V0yPo5eHCzJP/oXucrkP7i6IC7
|
33
|
+
4D9+g3UMzF8+t+yKNgkJuE76azBKyfEKJnhYGnEOI9nIVfmxc65CBjzi13D1pLr1
|
34
|
+
gmp68bAqiT60sJfRlJtEtTKkdcQtPVKj4NPYAt+QItdUKNx9xuBmIZpYmpQnbdrN
|
35
|
+
NIUWaOW01S4o47sU3I51CSMWxo0LvDUyjQ5BahXzrnkaUCAZxlAAIqXum9zvCr5K
|
36
|
+
qG+QACUIuvQdA+C3SKv19pE2
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: domle
|
@@ -39,20 +43,20 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
46
|
+
version: '0.2'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.1
|
49
|
+
version: 0.2.1
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
54
|
- - "~>"
|
51
55
|
- !ruby/object:Gem::Version
|
52
|
-
version: '0.
|
56
|
+
version: '0.2'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.1
|
59
|
+
version: 0.2.1
|
56
60
|
description:
|
57
61
|
email: james@jamesrobertson.eu
|
58
62
|
executables: []
|
@@ -79,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
83
|
- !ruby/object:Gem::Version
|
80
84
|
version: '0'
|
81
85
|
requirements: []
|
82
|
-
|
83
|
-
rubygems_version: 2.6.8
|
86
|
+
rubygems_version: 3.0.3
|
84
87
|
signing_key:
|
85
88
|
specification_version: 4
|
86
89
|
summary: Svgle (SVG + Domle) generates an SVG Document Object Model from the given
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
��
|
2
|
-
�
|
1
|
+
�}z��X���hcg�j{|ӯ"��j&[�٘�]�">�)��?��I�+:���Y"��d�qf�[-D:���%A��kߧ"�����RI�%��YuޟT��Qr�8�9�{�-�rU�Űau�q�H��?[y�����?��0��G�/t�5�әL���}8�Ƹ�~����h�θ�)�b&S"���e���.']\�߇�k�f^�ãw�� 5�N#���I/R�~�q��M,@�W���u�H������e���v`�0��1
|
2
|
+
�߰�$�v�&�]�3y��-����.d"�t���p�z�)�12@X�W\��XS�o�d������ZZ�@�0Ƹ�&J}�K3�ju$�=��!s ̛�OE�G�y� � l#�9?�cn���5!+n�
|