jekyll-autoscout24 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-autoscout24/backup_reader.rb +9 -6
- data/lib/jekyll-autoscout24/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f192fe5bf9facae693314e9460043a0b2c0ba169953dee6256a0b8956ac7032
|
4
|
+
data.tar.gz: 24716be55f60bc02c8bc118fb6ca0f2b248a64b9ad724c2a56733870cb8f0cc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f96e84b703e09a48f61dc75d26c9d3550617b430759bf1bc2ab0e0491fa71061c48f315340c7c71b66ef6331ffd3c4c2e0ea9516f3dba8674827b063059733c6
|
7
|
+
data.tar.gz: a8c7ff299b6e54babf73d123dc8eaacbe050de4cf9a010c124ddc34857308a80c7b5b100a23a20054c9ee0e4662f31bc6043ce63710ac6b1d28e7ae282bb82ab
|
@@ -14,8 +14,8 @@ module Jekyll
|
|
14
14
|
backup = Ox.load_file("#{dir}/autoscout24.xml")
|
15
15
|
# Locate all vehicle nodes in the backup document
|
16
16
|
vehicles, nodes = [], backup.locate("stx3/vehicle_data/vehicles/vehicle")
|
17
|
-
# Transform each node found into an instance of
|
18
|
-
nodes.each { |n| vehicles <<
|
17
|
+
# Transform each node found into an instance of Entry drop
|
18
|
+
nodes.each { |n| vehicles << Entry.new(n) }
|
19
19
|
# Merge current site data with the list of vehicles from the backup
|
20
20
|
@site.data.merge!("autoscout24" => vehicles) unless vehicles.empty?
|
21
21
|
end
|
@@ -26,7 +26,7 @@ module Jekyll
|
|
26
26
|
# The main use for liquid drops is to implement lazy loaded objects.
|
27
27
|
# If you would like to make data available to the web designers which you don't want loaded unless needed then
|
28
28
|
# a drop is a great way to do that.
|
29
|
-
class
|
29
|
+
class Entry < Liquid::Drop
|
30
30
|
attr_reader :node
|
31
31
|
|
32
32
|
# ctor
|
@@ -36,9 +36,12 @@ module Jekyll
|
|
36
36
|
|
37
37
|
# Catch all method to be flexible and adaptable based on the XML structure provided.
|
38
38
|
def liquid_method_missing(name)
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
# lookup child node by name
|
40
|
+
found = @node.locate(name).first
|
41
|
+
# no match or empty node, therefore nil
|
42
|
+
return nil if found.nil? || found.nodes.empty?
|
43
|
+
# either text or recurse
|
44
|
+
found.text === nil ? Entry.new(found) : found.text
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-autoscout24
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrico Caputo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-03-
|
12
|
+
date: 2018-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ox
|