jekyll-inline-svg 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: 5f7ec02900a1781590f77c085955e691f67c2413
4
- data.tar.gz: c85d53a5af01ba620036633997fbf3573143650d
3
+ metadata.gz: d9bf9be464ebca5b3baa4e81c3b7d1a13d5d7742
4
+ data.tar.gz: 78f54ea9f7fb75ea242b4e2a564215047e1c0ca8
5
5
  SHA512:
6
- metadata.gz: e07e67d5aaf9eb24629a31dbaaa9b76e4224c8b6ef517967944fe1b784aff9180deb4d09d0542b9852d4a6f69104dda173d722e8b76628b051c0fac846a80f1d
7
- data.tar.gz: 7c82653e38eaafd4f2dba396e8bc09fd06154318d14cc7609125d9cb9c077d564a051fb0ecbd5f8b6f6d89add676f942810b9bdd1c5e3dacf06d9a9043d5f984
6
+ metadata.gz: 72c858a2f7341528df0df482d0397c2ee7f03cf2e7494bbda9ff5d0197ae282bea8d22f1de486b7322f4258f06be08fb1a571331f4d251e39afc869522c020d0
7
+ data.tar.gz: 5201dab3105efaf21387ce87c78f38aa133cb6bcc4e81225185218140814ab6c1f63e80e51e29314d7e16036d4230cb9cc06cbcbe62bec0ac5f8dd3d62735da6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-inline-svg (0.0.2)
4
+ jekyll-inline-svg (1.0.0)
5
5
  jekyll (~> 3.3)
6
6
  svg_optimizer (= 0.1.0)
7
7
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  A Liquid tag to inline and optimize SVG images in your HTML
8
8
  Supports custom DOM Attributes parameters and variables interpretation.
9
9
  EOF
10
- spec.version = "1.0.0"
10
+ spec.version = "1.0.1"
11
11
  spec.authors = ["Sebastien DUMETZ"]
12
12
  spec.email = "s.dumetz@holusion.com"
13
13
  spec.homepage = "https://github.com/sdumetz/jekyll-inline-svg"
@@ -26,9 +26,19 @@ module Jekyll
26
26
  ^(?<path>[^\s"']+|"[^"]*"|'[^']*')
27
27
  (?<params>.*)
28
28
  !x
29
+
30
+ # parse the first parameter in a string, giving :
31
+ # [full_match, param_name, double_quoted_val, single_quoted_val, unquoted_val]
32
+ # The Regex works like :
33
+ # - first group
34
+ # - match a group of characters that is alphanumeric, _ or -.
35
+ # - second group (non-capturing OR)
36
+ # - match a double-quoted string
37
+ # - match a single-quoted string
38
+ # - match an unquoted string matching the set : [\w\.\-#]
29
39
  PARAM_SYNTAX= %r!
30
40
  ([\w-]+)\s*=\s*
31
- (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))
41
+ (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.\-#]+))
32
42
  !x
33
43
 
34
44
  def initialize(tag_name, input, tokens)
@@ -12,7 +12,9 @@ Hello world
12
12
  {% svg files/square.svg width=24 height=48 %}
13
13
  {% svg files/square.svg width=24 height="" %}
14
14
  </div>
15
-
15
+ <div id="attributes">
16
+ {% svg files/square.svg role="navigation" data-foo="bar" fill="#ffffff" stroke=#000000 %}
17
+ </div>
16
18
  <div id="path">
17
19
  <label>Resolve relative and absolute paths to site's source</label>
18
20
  {% svg files/square.svg %}
@@ -89,6 +89,14 @@ describe(Jekyll::Tags::JekyllInlineSvg) do
89
89
 
90
90
  expect(data[2].get_attribute("width")).to eql("24")
91
91
  end
92
+ it "keep attributes" do
93
+ data = @data.css("#attributes").css("svg")
94
+ expect(data).to be_truthy
95
+ expect(data[0].get_attribute("role")).to eql("navigation")
96
+ expect(data[0].get_attribute("data-foo")).to eql("bar")
97
+ expect(data[0].get_attribute("fill")).to eql("#ffffff")
98
+ expect(data[0].get_attribute("stroke")).to eql("#000000")
99
+ end
92
100
  it "parse relative paths" do
93
101
  data = @data.css("#path").css("svg")
94
102
  expect(data.size).to eq(2)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-inline-svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien DUMETZ