jekyll-geo-pattern 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-geo-pattern.rb +28 -14
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a81560a371e5edc796b5d1a33c8fc0f1a24f2546
|
4
|
+
data.tar.gz: 2494301ac20406563d9aeadb7f58707e7f860a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bddc4b5bd802d1f0f8b5af0998fcfbf3dabfcbcae2403621d8bcd778d622f1da3eb75514b5ef6ff0276f454153e587aabd031fee43342094b46c0c569a8f586
|
7
|
+
data.tar.gz: 9ab8691e9bb1b0568adeeb6fe7c28dff2c7e3941633ea924325719866dbdd7d1d95e14acef5b77d48d282f196054f8625031898ed7695a2336efeb148ab857c0
|
data/lib/jekyll-geo-pattern.rb
CHANGED
@@ -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.
|
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:
|
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:
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|