21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/jekyll-leaflet-mze/leaflet-map.rb', line 21
def render(context)
text = super
if !(text.is_a? String)
raise "leaflet-map content between the tag blocks must a String"
end
leaflet_providers_js_content = File.read(
File.expand_path("./leaflet-providers.js", File.dirname(__FILE__)))
map_js = File.read(
File.expand_path("./leaflet-map.js", File.dirname(__FILE__)))
map_html = File.read(
File.expand_path("./leaflet-map.html", File.dirname(__FILE__)))
@input = parse_liquid_output_in(@input, context)
id = SecureRandom.hex
map_js = map_js % {id: id,
leaflet_providers_js_content: leaflet_providers_js_content,
tag_input_arg_json: @input,
inside_block_leaflet_items: text}
map_html = map_html % {id: id,
leaflet_map_js_content: map_js}
map_html
end
|