jekyll-contentful-data-import 1.5.0 → 1.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f3bfe77c63cdbb2428c0e4ad7ec8ce5fcd85d7
|
4
|
+
data.tar.gz: 6b611233877a8275d952ec8ac49a1aecc55ff2fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a51238cb49f031d904ac24b87e2ca9ba102a73d617cba54f756aea1315682ff737c1bfe67f3f47c0475048b6f8a1f134d4ededc3128dfcb19cbe99e80fcf608e
|
7
|
+
data.tar.gz: 1a8f633a2f9b6dfa747137778f46a724f0dbc63435705c70580b1fe0ab4cac5a5207337dc2711b964aaad380686f918c425aba143d9fefe0c57a247079fd0767
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -83,19 +83,19 @@ The default mapper will map fields, assets and linked entries.
|
|
83
83
|
You can create your own mappers if you need to. The only requirement for a class to behave as a
|
84
84
|
mapper is to have a `map` instance method.
|
85
85
|
|
86
|
-
Following is an example of such custom mapper that
|
86
|
+
Following is an example of such custom mapper that reverses all entry field IDs:
|
87
87
|
|
88
88
|
```ruby
|
89
|
-
class
|
89
|
+
class MyReverseMapper < ::Jekyll::Contentful::Mappers::Base
|
90
90
|
def map
|
91
91
|
result = super
|
92
|
+
reversed_result = {}
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
result['sys'][name] = value
|
94
|
+
result.each do |k, v|
|
95
|
+
reversed_result[k.reverse] = v
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
reversed_result
|
99
99
|
end
|
100
100
|
end
|
101
101
|
```
|
@@ -123,7 +123,7 @@ Then proceed to run: `bundle exec rake contentful`
|
|
123
123
|
In most cases you may want to avoid including your credentials in publicly available sites,
|
124
124
|
therefore you can do the following:
|
125
125
|
|
126
|
-
1. `bundle update
|
126
|
+
1. `bundle update` — make sure your gem version supports `ENV_` variables
|
127
127
|
|
128
128
|
2. Set up your `_config` like so:
|
129
129
|
|
@@ -131,11 +131,10 @@ module Jekyll
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def map_location(location)
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
result
|
134
|
+
{
|
135
|
+
'lat' => location.latitude,
|
136
|
+
'lon' => location.longitude
|
137
|
+
}
|
139
138
|
end
|
140
139
|
|
141
140
|
def map_link(link)
|
@@ -61,14 +61,12 @@ describe Jekyll::Contentful::Mappers::Base do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
class LocationDouble < Contentful::Location
|
64
|
+
attr_reader :lat, :lon
|
65
|
+
|
64
66
|
def initialize(lat, lon)
|
65
67
|
@lat = lat
|
66
68
|
@lon = lon
|
67
69
|
end
|
68
|
-
|
69
|
-
def properties
|
70
|
-
{ 'lat' => @lat, 'lon' => @lon }
|
71
|
-
end
|
72
70
|
end
|
73
71
|
|
74
72
|
class LinkDouble < Contentful::Link
|