jekyll-geo-pattern 0.1.0 → 0.2.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 +18 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a70b8b1fdf70a51eb239da2a4ccd6e4c9f8e9824
|
4
|
+
data.tar.gz: 6e851c7a53a09abe62ed81a2e2cdf4b67e9e8b29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5866a38c05a4d5c9981079a7a208eb44260046c9b4f17a204cd4a6d18bad873a131750c7d925d7a324784f3b59505d418ac0490c3d9d5c17d2c76455d2ae9d39
|
7
|
+
data.tar.gz: 66c7c92bd0639fca3d17fd627d882a5278e482554b7182b50928eea848b938ca9ebed3f13668595bc1863509d648123a5d5718dadb4c1edee78215548937c9fd
|
data/lib/jekyll-geo-pattern.rb
CHANGED
@@ -2,18 +2,26 @@ require 'geo_pattern'
|
|
2
2
|
|
3
3
|
module Jekyll
|
4
4
|
module GeoPatterns
|
5
|
-
HASH_REGEXP = /\{(.+?)\}/
|
6
5
|
VALID_KEYS = %w(:base_color :generator :text)
|
6
|
+
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
|
7
7
|
|
8
8
|
# from a string of options, construct a hash, without using `eval`
|
9
9
|
def self.extract_options( input )
|
10
|
-
opts =
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
opts = {}
|
11
|
+
markup = input
|
12
|
+
|
13
|
+
while match = VALID_SYNTAX.match(markup) do
|
14
|
+
markup = markup[match.end(0)..-1]
|
15
|
+
|
16
|
+
value = if match[2]
|
17
|
+
match[2].gsub(/\\"/, '"')
|
18
|
+
elsif match[3]
|
19
|
+
match[3].gsub(/\\'/, "'")
|
20
|
+
elsif match[4]
|
21
|
+
context[match[4]]
|
22
|
+
end
|
23
|
+
|
24
|
+
opts[match[1].to_sym] = value
|
17
25
|
end
|
18
26
|
opts
|
19
27
|
end
|
@@ -48,8 +56,7 @@ module Jekyll
|
|
48
56
|
end
|
49
57
|
|
50
58
|
def render(context)
|
51
|
-
|
52
|
-
opts = GeoPatterns.extract_options(m[1])
|
59
|
+
opts = GeoPatterns.extract_options(@text)
|
53
60
|
|
54
61
|
raise ArgumentError, "You must have the :text property passed in" if opts[:text].nil?
|
55
62
|
|
@@ -65,8 +72,7 @@ module Jekyll
|
|
65
72
|
end
|
66
73
|
|
67
74
|
def render(context)
|
68
|
-
|
69
|
-
opts = GeoPatterns.extract_options(m[1])
|
75
|
+
opts = GeoPatterns.extract_options(@text)
|
70
76
|
|
71
77
|
raise ArgumentError, "You must have the :text property passed in" if opts[:text].nil?
|
72
78
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|