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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb5b16e86312c55df97316b4ae0b691a2a27bbce0760613cbd469709da42c8d5
4
- data.tar.gz: 5325a1f86b312f5a70ffb71e0cc28679672163d765816c3fa5144160dc6d9ed6
3
+ metadata.gz: 0f192fe5bf9facae693314e9460043a0b2c0ba169953dee6256a0b8956ac7032
4
+ data.tar.gz: 24716be55f60bc02c8bc118fb6ca0f2b248a64b9ad724c2a56733870cb8f0cc1
5
5
  SHA512:
6
- metadata.gz: 5b92adf4a76dbd64c11228a2f3bddedab083db079565fa2d782d978bc4dc42b0a7478965ff06849e6218263fbf4f171e42fafdfc360bb8f5f2f53003838af16a
7
- data.tar.gz: 8dc41c6e84b54abb11c628c2f91087116b9ce9a0be51b40ea4369f4919dd187d1795416bbb1caec10e76a3eee36d6094e31792d2e9006f30bc397c0458297ecb
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 Vehicle drop
18
- nodes.each { |n| vehicles << Vehicle.new(n) }
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 Vehicle < Liquid::Drop
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
- found = @node.locate(name)
40
- return nil if found.empty?
41
- found.first.text
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
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Autoscout24
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  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.2
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-21 00:00:00.000000000 Z
12
+ date: 2018-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ox