lib/jekyll-maps/location_finder.rb in jekyll-maps-2.0.2 vs lib/jekyll-maps/location_finder.rb in jekyll-maps-2.0.3
- old
+ new
@@ -1,11 +1,11 @@
module Jekyll
module Maps
class LocationFinder
def initialize(options)
@documents = []
- @options = options
+ @options = options
end
def find(site, page)
if @options[:filters].empty?
@documents << page if location?(page)
@@ -23,10 +23,14 @@
path = @options[:filters]["src"].scan(%r!_data\/([^\/]+)!).join(".")
return site.data if path.empty?
data = OpenStruct.new(site.data)
- data[path]
+ if @options[:filters]["src"] =~ %r!\.ya?ml!
+ { :path => data[path.gsub(%r!\.ya?ml!, "")] }
+ else
+ data[path]
+ end
end
private
def data_source?
filters = @options[:filters]