victor 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -0
- data/lib/victor/svg_base.rb +4 -3
- data/lib/victor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ab2068f7e282cb882055ad6be0cba8dbc49b220d6116cd5c6806cdfc8b1712
|
4
|
+
data.tar.gz: 12fda11a74dca2ff5a1832bb99de61bce490db80a8af26ce7026daf7ccfa3485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd3680c0acb878cae500167ff68ab978aba427e729bf2ffbc1d556779c513c4243db8b0d9af09516cfb2f85c10ddfcb8a210a6fd115439d6bc65db77e1db569a
|
7
|
+
data.tar.gz: 58a967624007c0171c6e176b46dcd2593ab0c781901de752802581a59253fd161e9ab3c4eb14692cc092b0f47fd327610e978c9b80cf6de0fd56430247d5da30
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ Table of Contents
|
|
27
27
|
* [Saving the Output](#saving-the-output)
|
28
28
|
* [SVG Templates](#svg-templates)
|
29
29
|
* [CSS](#css)
|
30
|
+
* [Tagless Elements](#tagless-elements)
|
30
31
|
* [Using with Rails](#using-with-rails)
|
31
32
|
* [Related Projects](#related-projects)
|
32
33
|
|
@@ -319,6 +320,36 @@ will result in two `@import url(...)` rows.
|
|
319
320
|
See the [custom fonts example](https://github.com/DannyBen/victor/tree/master/examples#12-custom-fonts).
|
320
321
|
|
321
322
|
|
323
|
+
Tagless Elements
|
324
|
+
--------------------------------------------------
|
325
|
+
|
326
|
+
Using underscore (`_`) as the element name will simply add the value to the
|
327
|
+
generated SVG, without any surrounding element. This is designed to allow
|
328
|
+
generating something like this:
|
329
|
+
|
330
|
+
```xml
|
331
|
+
<text>
|
332
|
+
You are
|
333
|
+
<tspan font-weight="bold">not</tspan>
|
334
|
+
a banana
|
335
|
+
</text>
|
336
|
+
```
|
337
|
+
|
338
|
+
using this Ruby code:
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
svg.build do
|
342
|
+
text do
|
343
|
+
_ 'You are'
|
344
|
+
tspan 'not', font_weight: "bold"
|
345
|
+
_ 'a banana'
|
346
|
+
end
|
347
|
+
end
|
348
|
+
```
|
349
|
+
|
350
|
+
See the [targless elements example](https://github.com/DannyBen/victor/tree/master/examples#16-tagless-elements).
|
351
|
+
|
352
|
+
|
322
353
|
Using with Rails
|
323
354
|
--------------------------------------------------
|
324
355
|
|
data/lib/victor/svg_base.rb
CHANGED
@@ -29,12 +29,13 @@ module Victor
|
|
29
29
|
end
|
30
30
|
|
31
31
|
attributes = Attributes.new attributes
|
32
|
+
empty_tag = name.to_s == '_'
|
32
33
|
|
33
34
|
if block_given? || value
|
34
|
-
content.push "<#{name} #{attributes}".strip + ">"
|
35
|
+
content.push "<#{name} #{attributes}".strip + ">" unless empty_tag
|
35
36
|
value ? content.push(value) : yield
|
36
|
-
content.push "</#{name}>"
|
37
|
-
else
|
37
|
+
content.push "</#{name}>" unless empty_tag
|
38
|
+
else
|
38
39
|
content.push "<#{name} #{attributes}/>"
|
39
40
|
end
|
40
41
|
end
|
data/lib/victor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: victor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build SVG images with ease
|
14
14
|
email: db@dannyben.com
|