new gallery function

plus some fixes and updates
This commit is contained in:
Jaromil 2013-08-05 00:43:56 +02:00
parent 20d220c5c6
commit 9c2bc445d4
4 changed files with 146 additions and 30 deletions

56
init
View File

@ -2,7 +2,7 @@
#
# Jaro Web, your slick and static website publisher
#
# Copyleft (C) 2012 Denis Roio <jaromil@dyne.org>
# Copyleft (C) 2012-2013 Denis Roio <jaromil@dyne.org>
#
# This source code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Public License as published by
@ -72,39 +72,40 @@ mkdir -p tmpl
EOF
}
{ test -r tmpl/footer.html } || {
cat <<EOF > tmpl/footer.html
<hr>
<footer style="padding: 1em;">
<div class="pull-left">
<small>All information found on this page is free to copy</small>
</div>
<small class="pull-right">Website made<br />with <a
href="http://jaroweb.dyne.org" target="_blank">Jaro
Web</a></small>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</footer>
</div><!--/.container-->
<script src="js/bootstrap.js"></script>
</body>
</html>
{ test -r tmpl/footer.html } || { cp -v jaroweb/tmpl/footer.html tmpl/footer.html }
{ test -r tmpl/navbar.html } || {
cat <<EOF > tmpl/navbar.html
<!-- Menu on top, entries shall match pages in views/ -->
<li class="divider-vertical"></li>
<li><a href="artworks">artworks</a></li>
<li><a href="writings">writings</a></li>
<li><a href="media">media</a></li>
<li class="divider-vertical"></li>
<li><a href="contact">contact</a></li>
EOF
}
{ test -r views/css/bootstrap.css } || {
notice "Downloading and installing Bootstrap"
curl http://twitter.github.com/bootstrap/assets/bootstrap.zip -o bootstrap.zip
curl http://twitter.github.io/bootstrap/assets/bootstrap.zip -o bootstrap.zip
unzip -q bootstrap.zip
rsync -r bootstrap/css views/
rsync -r bootstrap/js views/
rsync -r bootstrap/img views/
rm -rf bootstrap bootstrap.zip
act "Bootstrap installed"
}
{ test -r views/css/blueimp-gallery.js } || {
notice "Downloading and installing BlueImp gallery"
git clone https://github.com/blueimp/Gallery.git blueimp
rsync -r blueimp/css views/
rsync -r blueimp/js views/
rsync -r blueimp/img views/
rm -rf blueimp
act "BlueImp installed"
}
{ test -r config.zsh } || {
cat <<EOF > config.zsh
@ -112,10 +113,7 @@ TITLE="A new website made with Jaro Web."
BRAND="Jaro Web"
DESCRIPTION="Jaro Web, your slick and static website publisher, powered by HTML5, Zsh and Bootstrap"
KEYWORDS="web, design, html"
# Sections must be matching existing files in views/
typeset -al sections
sections=(contact)
NAVCLASS="navbar-fixed-top"
EOF
}
@ -130,4 +128,6 @@ clean:
upload:
@scp -r pub/.htaccess pub/* online.server.org:/var/www
EOF
}
}
act "website initialized."

80
render
View File

@ -119,6 +119,80 @@ render_markdown() {
}
render_gallery() {
src=`find views -type f -name "${1}.gal"`
{ test -r "${src}" } || {
print "${1} section not found";
return 1 }
dst="pub/${1%.*}"
act -n "rendering gallery: $dst... "
cat <<EOF > $dst
<!DOCTYPE html>
<html>
<head>
<title>$TITLE</title>
<meta name="description" content="$DESCRIPTION">
<meta name="keywords" content="$KEYWORDS">
<link rel="stylesheet" href="css/blueimp-gallery.min.css">
EOF
cat tmpl/header.html >> $dst
echo "<nav>" >> $dst
render_navbar ${sec} >> $dst
echo "</nav>" >> $dst
cat <<EOF >> $dst
<!-- The Gallery as lightbox dialog, should be a child element of the document body -->
<div id="blueimp-gallery" class="blueimp-gallery">
<div class="slides"></div>
<h3 class="title"></h3>
<a class="prev"></a>
<a class="next"></a>
<!-- <a class="close">×</a> -->
<a class="play-pause"></a>
<ol class="indicator"></ol>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/blueimp-gallery.js"></script>
<script>
var slides= [];
EOF
# parse gallery entries
pics=`grep -v '^#' ${src}`
for p in ${(f)pics}; do
file=${p[(ws: :)1]}
desc=`echo $p | awk '{ for(c=2;c<=NF;c++) printf("%s ",$c) }'`
cat << EOF >> $dst
slides.push({
href: '${file}',
title: '${desc}'
});
EOF
done
cat <<EOF >> $dst
blueimp.Gallery(slides, {
container: '#blueimp-gallery',
carousel: true,
fullscreen: false,
closeOnEscape: false,
closeOnSlideClick: false,
closeOnSwipeUpOrDown: false,
startSlideshow: true
});
</script>
EOF
cat tmpl/footer.html >> $dst
print "done."
}
read_meta() {
tmp=`awk '
@ -257,6 +331,12 @@ for m in $mds; do
render_markdown `basename ${m%.*}`
done
# render all image galleries
gals=(`find views -type f -name '*.gal'`)
for g in $gals; do
render_gallery `basename ${g%.*}`
done
for m in `find views -mindepth 1 -type d `; do
act -n "publishing $m... "
rsync -r $m pub/

36
tmpl/footer.html Normal file
View File

@ -0,0 +1,36 @@
<div class="navbar navbar-fixed-bottom">
<div class="navbar-inner">
<ul class="nav" style="width: 90%">
<li>
<small><span itemprop="copyrightHolder">
All information found on this page is free to copy
</li>
<div class="pull-right">
<li>
<small class="pull-right">
Website made<br />with <a href="http://jaroweb.dyne.org" target="_blank">Jaro Web</a>
</small>
</li>
</div>
<!--
<li>
Center footer link to twitter or so..
</li>
-->
</ul>
</div>
</div>
</div><!--/.container-->
<script src="js/bootstrap.js"></script>
</body>
</html>

4
utils
View File

@ -2,7 +2,7 @@
#
# Jaro Web, your slick and static website publisher
#
# Copyleft (C) 2012 Denis Roio <jaromil@dyne.org>
# Copyleft (C) 2012-2013 Denis Roio <jaromil@dyne.org>
#
# This source code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Public License as published by
@ -18,7 +18,7 @@
# this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
VERSION=0.1
VERSION=0.2
QUIET=0