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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fa0d0c7d1fc0d5ddbe1ee2c4a4e121e4bd8d0dc3b2fc1f464fd0fa4434cb4be
4
- data.tar.gz: 022fdb964984b46f65f632e0043763a7bbd803f21438ef58c5ae8032d9aca783
3
+ metadata.gz: e0ab2068f7e282cb882055ad6be0cba8dbc49b220d6116cd5c6806cdfc8b1712
4
+ data.tar.gz: 12fda11a74dca2ff5a1832bb99de61bce490db80a8af26ce7026daf7ccfa3485
5
5
  SHA512:
6
- metadata.gz: 285bb875277c25d24f06f10f44e632ff4ee03897c16b25e5af4c793a6b5a93632d976f1017cdada5cef61f3d68b3008955694868e0c22bc57e0da56ef6a64adb
7
- data.tar.gz: 2f3371599bd094418c0e6f0ea656723f1a335983abfe1af0cdce032032fa4e05b1263f9ef3b2062f6a8195a6543a25f4e08d7fb7a72e5178812d2f7295710417
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Victor
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
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.5
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-05-27 00:00:00.000000000 Z
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