jekyll-maps 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/History.md +5 -0
- data/lib/jekyll-maps/location_finder.rb +41 -15
- data/lib/jekyll-maps/options_parser.rb +5 -0
- data/lib/jekyll-maps/version.rb +1 -1
- 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: 4fd53874b13c6ba9f3170a3f1e0f33111859d9c2
|
4
|
+
data.tar.gz: e8c452dced878ab7ee030ee6b1effe3ebefd935e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df5d97537d323d0359547b23185307110e94169436acc3c201543b4a71893f3cae53e2649d9034a4adab6c9b2c7d53f5d9d79779f7df4489fcf4eecbe0f4c4d
|
7
|
+
data.tar.gz: e487f20b8232ba92b4171723ce2433f90ab5b25b25330b75a99e2ab5e345fd1957ca84dae5e99fbf5fcf47721a8dbcc5b1098427978edc86a13dd5a11df4c257
|
data/.travis.yml
CHANGED
data/History.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 2.0.4 / 2017-07-19
|
2
|
+
|
3
|
+
* allow multiple locations per document (fix #6)
|
4
|
+
* allow inline locations with map attributes, e.g. `{% google_map laititude='42.23323' longitude='3.213232' %}` (fix #23)
|
5
|
+
|
1
6
|
## 2.0.3 / 2017-05-17
|
2
7
|
|
3
8
|
* load locations from specific data file (fix #26)
|
@@ -7,14 +7,27 @@ module Jekyll
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def find(site, page)
|
10
|
-
if @options[:
|
11
|
-
|
10
|
+
if @options[:attributes][:latitude] && @options[:attributes][:longitude]
|
11
|
+
return [location_from_options(page)]
|
12
|
+
elsif @options[:filters].empty?
|
13
|
+
@documents << page if with_location?(page)
|
12
14
|
else
|
13
15
|
site.collections.each { |_, collection| filter(collection.docs) }
|
14
16
|
site_data(site).each { |_, items| traverse(items) }
|
15
17
|
end
|
16
18
|
|
17
|
-
|
19
|
+
documents_to_locations
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def location_from_options(page)
|
24
|
+
{
|
25
|
+
:latitude => @options[:attributes][:latitude],
|
26
|
+
:longitude => @options[:attributes][:longitude],
|
27
|
+
:title => @options[:attributes][:marker_title] || page["title"],
|
28
|
+
:url => @options[:attributes][:marker_url] || fetch_url(page),
|
29
|
+
:image => @options[:attributes][:marker_img] || page["image"] || ""
|
30
|
+
}
|
18
31
|
end
|
19
32
|
|
20
33
|
private
|
@@ -48,12 +61,12 @@ module Jekyll
|
|
48
61
|
private
|
49
62
|
def filter(docs)
|
50
63
|
docs.each do |doc|
|
51
|
-
@documents << doc if
|
64
|
+
@documents << doc if with_location?(doc) && match_filters?(doc)
|
52
65
|
end
|
53
66
|
end
|
54
67
|
|
55
68
|
private
|
56
|
-
def
|
69
|
+
def with_location?(doc)
|
57
70
|
!doc["location"].nil? && !doc["location"].empty?
|
58
71
|
end
|
59
72
|
|
@@ -70,23 +83,36 @@ module Jekyll
|
|
70
83
|
end
|
71
84
|
|
72
85
|
private
|
73
|
-
def
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
86
|
+
def documents_to_locations
|
87
|
+
locations = []
|
88
|
+
@documents.each do |document|
|
89
|
+
if document["location"].is_a?(Array)
|
90
|
+
document["location"].each do |location|
|
91
|
+
locations.push(convert(document, location))
|
92
|
+
end
|
93
|
+
else
|
94
|
+
locations.push(convert(document, document["location"]))
|
95
|
+
end
|
82
96
|
end
|
97
|
+
locations
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
def convert(document, location)
|
102
|
+
{
|
103
|
+
:latitude => location["latitude"],
|
104
|
+
:longitude => location["longitude"],
|
105
|
+
:title => location["title"] || document["title"],
|
106
|
+
:url => location["url"] || fetch_url(document),
|
107
|
+
:image => location["image"] || document["image"] || ""
|
108
|
+
}
|
83
109
|
end
|
84
110
|
|
85
111
|
private
|
86
112
|
def fetch_url(document)
|
87
113
|
return document["url"] if document.is_a?(Hash) && document.key?("url")
|
88
114
|
return document.url if document.respond_to? :url
|
89
|
-
|
115
|
+
""
|
90
116
|
end
|
91
117
|
end
|
92
118
|
end
|
data/lib/jekyll-maps/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-maps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoliy Yastreb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|