Skip to content

Instantly share code, notes, and snippets.

@bdunnette
Last active February 14, 2018 19:33
Show Gist options
  • Save bdunnette/f8c8125b0ceebf0d44c602907af934fe to your computer and use it in GitHub Desktop.
Save bdunnette/f8c8125b0ceebf0d44c602907af934fe to your computer and use it in GitHub Desktop.
#!/bin/bash
#Read case/slide titles from titles.txt (one case/title per line)
titles=()
while read line
do
# echo $line
titles+=("$line")
done < titles.txt
# echo ${titles[@]}
index=0
#for z in *.zip
for z in `find . -type d -mindepth 1 -maxdepth 1 2> /dev/null|sort -n|sed 's/\.\///g'`
do
echo $z
i="${z%.*}"
# echo $i
title="${titles[$index]}"
#If there's no matching title in titles.txt, use the slide ID as the slide's title
if [ "$title" = "" ]
then
title="$i"
fi
# echo $title
pagefile="$i.html"
echo "Generating $pagefile..."
cat template.html | sed -e "s/ImageID/"$i"/g" template.html > $pagefile
echo "Updating title to $title"
sed -i 's,SlideTitle,'"$title"',' $pagefile
((index++))
done
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SlideTitle</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.4/Control.FullScreen.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.4/Control.FullScreen.min.js"></script>
<style>
.leaflet-container {
background: white;
}
</style>
</head>
<body style="margin:0;">
<div id="map"></div>
<script>
$(document).ready(function () {
$('#map').css({
height: $(window).height() + 'px'
});
var map = new L.map('map', {
fullscreenControl: true,
fullscreenControlOptions: {
position: 'topleft'
}
});
var slideUrl = 'ImageID/{z}/{y}/{x}.jpg'
slide = L.tileLayer(slideUrl, {
minZoom: 0,
maxZoom: 10,
noWrap: true,
errorTileUrl: '/blank.png',
attribution: 'Images &copy; 2018 Regents of the University of Minnesota'
});
map.addLayer(slide);
map.setView(new L.LatLng(0, 0), 3);
map.attributionControl.setPrefix('');
function onMapMove(e) {
console.log('Center:' + map.getCenter() + ' Zoom:' + map.getZoom() + ' Bounds:' + JSON.stringify(map.getBounds()));
console.log('PixelBounds:' + JSON.stringify(map.getPixelBounds()) + ' PixelOrigin:' + JSON.stringify(map.getPixelOrigin()));
}
$(window).resize(function () {
$('#map').css({
height: $(window).height() + 'px'
});
});
});
</script>
<script>
(function (e, t, n, r, i, s, o) {
e["GoogleAnalyticsObject"] = i;
e[i] = e[i] || function () {
(e[i].q = e[i].q || []).push(arguments)
}, e[i].l = 1 * new Date;
s = t.createElement(n), o = t.getElementsByTagName(n)[0];
s.async = 1;
s.src = r;
o.parentNode.insertBefore(s, o)
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-39453866-3", "umn.edu");
ga("send", "pageview")
</script>
</body>
</html>
Case 01 - Diff-Quik
Case 01 - Papanicolaou
Case 02 - Papanicolaou
Case 02 - Diff-Quik
Case 03 - Diff-Quik
Case 03 - Papanicolaou
Case 04 - Diff-Quik
Case 05 - Diff-Quik
Case 06 - Diff-Quik
Case 06 - Papanicolaou
Case 07 - Papanicolaou
Case 07 - Papanicolaou
Case 08 - Diff-Quik
Case 08 - Papanicolaou
Case 09 - Papanicolaou
Case 10 - Diff-Quik
Case 10 - Papanicolaou
Case 11 - Diff-Quik
Case 11 - Papanicolaou
Case 12 - Papanicolaou
Case 13 - Diff-Quik
Case 14 - Diff-Quik
Case 01 - H+E
Case 02 - H+E
Case 03 - H+E
Case 03 - H+E
Case 05 - H+E
Case 08 - H+E
Case 09 - H+E
Case 09 - H+E
Case 10 - H+E
Case 11 - H+E
Case 12 - H+E
Case 13 - H+E
Case 14 - H+E
Case 15 - H+E
Case 06 - H+E
Case 15 - Diff-Quik
Case 15 - Papanicolaou
Case 06 - Diff-Quik
Case 06 - Papanicolaou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment