From 1b0836da7305ac26b38ed941a957f4310ec96965 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 7 Dec 2020 23:08:54 +0100 Subject: Added walks --- generate | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'generate') diff --git a/generate b/generate index d27992f..9ce0ded 100755 --- a/generate +++ b/generate @@ -74,6 +74,7 @@ do echo "Generated post at $post_dst_path" done + # Generate utilities for util_path in utils/* do @@ -88,3 +89,33 @@ do echo "Generated utility at $util_path/index.html" done + + +base_template < walks/index.template.html | + base_template_link 'static/img/favicon.png' | + base_template_link '../static/css/style.css' | + base_template_link 'https://unpkg.com/leaflet@1.7.1/dist/leaflet.css' | + base_template_link 'style.css' > walks/index.html + +[ ! -d walks/maps ] && mkdir walks/maps + +for gpx_path in walks/gpx/* +do + [ ! -f "$gpx_path" ] && continue + map_dst=$(basename "$gpx_path" | cut -d . -f 1 | tr ' ' '-') + map_dst_path="walks/maps/$map_dst.html" + + base_template < walks/map.template.html | + base_template_link '/static/img/favicon.png' | + base_template_link '/static/css/style.css' | + base_template_link '/walks/style.css' | + base_template_link 'https://unpkg.com/leaflet@1.7.1/dist/leaflet.css' | + sed "// a $(basename "$gpx_path")" > $map_dst_path + + sed -i'' "// a\ +
  • \ + view on map \ + $(basename "$gpx_path") \ +
  • " walks/index.html + echo "Generated walk at $gpx_path" +done -- cgit