jekyll-geo-pattern 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-geo-pattern.rb +28 -14
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8b10b520ecdbdee05e8e9385f540425626f67ea
4
- data.tar.gz: 7a3995940d1bcd1acca163b14c8956ca69e1d7ad
3
+ metadata.gz: a81560a371e5edc796b5d1a33c8fc0f1a24f2546
4
+ data.tar.gz: 2494301ac20406563d9aeadb7f58707e7f860a5a
5
5
  SHA512:
6
- metadata.gz: db00f87a3b540e0800a39b988535f4685ede974de3f6eedfc6039bb7cb5e6b0df986268d6b1e684a9d9f218ecdf9043d9176320268264e93488fcdb62691c1f0
7
- data.tar.gz: 76694ba27efc67853804d6a03b0c376fbd559e3d373305bdb7b83993f4a2ffe5c41f5865e49036d67d1509b84f7d71f4bdc233d30f1fa4db085ab34a8ff5de3a
6
+ metadata.gz: 8bddc4b5bd802d1f0f8b5af0998fcfbf3dabfcbcae2403621d8bcd778d622f1da3eb75514b5ef6ff0276f454153e587aabd031fee43342094b46c0c569a8f586
7
+ data.tar.gz: 9ab8691e9bb1b0568adeeb6fe7c28dff2c7e3941633ea924325719866dbdd7d1d95e14acef5b77d48d282f196054f8625031898ed7695a2336efeb148ab857c0
@@ -23,6 +23,18 @@ module Jekyll
23
23
 
24
24
  opts[match[1].to_sym] = value
25
25
  end
26
+ GeoPatterns.scrub_options(opts, context)
27
+ end
28
+
29
+ def self.scrub_options(opts, context)
30
+ opts.each do |opt, value|
31
+ value.gsub! /"|'/, ""
32
+
33
+ if value =~ /^(\w+?(\.[\w]+)*)/i
34
+ context_val = GeoPatterns.look_up(context, $1)
35
+ opts[opt] = context_val unless context_val.nil?
36
+ end
37
+ end
26
38
  opts
27
39
  end
28
40
 
@@ -37,18 +49,6 @@ module Jekyll
37
49
  lookup
38
50
  end
39
51
 
40
- def self.scrub_options(opts, context)
41
- opts.each do |opt, value|
42
- value.gsub! /"|'/, ""
43
-
44
- if value =~ /([\w]+(\.[\w]+)*)/i
45
- context_val = GeoPatterns.look_up(context, $1)
46
- opts[opt] = context_val unless context_val.nil?
47
- end
48
- end
49
- opts
50
- end
51
-
52
52
  class Base64GeoPattern < Liquid::Tag
53
53
  def initialize(tag_name, text, tokens)
54
54
  super
@@ -60,7 +60,6 @@ module Jekyll
60
60
 
61
61
  raise ArgumentError, "You must have the :text property passed in" if opts[:text].nil?
62
62
 
63
- opts = GeoPatterns.scrub_options(opts, context)
64
63
  GeoPattern.generate(opts[:text], opts).base64_string
65
64
  end
66
65
  end
@@ -76,12 +75,27 @@ module Jekyll
76
75
 
77
76
  raise ArgumentError, "You must have the :text property passed in" if opts[:text].nil?
78
77
 
79
- opts = GeoPatterns.scrub_options(opts, context)
80
78
  GeoPattern.generate(opts[:text], opts).svg_string
81
79
  end
82
80
  end
81
+
82
+ class UriImageGeoPattern < Liquid::Tag
83
+ def initialize(tag_name, text, tokens)
84
+ super
85
+ @text = text
86
+ end
87
+
88
+ def render(context)
89
+ opts = GeoPatterns.extract_options(@text, context)
90
+
91
+ raise ArgumentError, "You must have the :text property passed in" if opts[:text].nil?
92
+
93
+ GeoPattern.generate(opts[:text], opts).uri_image
94
+ end
95
+ end
83
96
  end
84
97
  end
85
98
 
86
99
  Liquid::Template.register_tag('base64_geo_pattern', Jekyll::GeoPatterns::Base64GeoPattern)
87
100
  Liquid::Template.register_tag('svg_geo_pattern', Jekyll::GeoPatterns::SVGGeoPattern)
101
+ Liquid::Template.register_tag('uri_geo_pattern', Jekyll::GeoPatterns::SVGGeoPattern)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-geo-pattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: geo_pattern
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement