generate thumbs with imagemagick; js lightbox

This commit is contained in:
Bachir Soussi Chiadmi
2016-12-04 16:18:52 +01:00
parent 7f66e3ebe0
commit a81d97708c
33 changed files with 11682 additions and 10 deletions
+18 -4
View File
@@ -8,6 +8,10 @@ if [ ! -d ../output/images ]; then
mkdir ../output/images
fi
if [ ! -d ../output/thumbs ]; then
mkdir ../output/thumbs
fi
if [ ! -d ../output/sources ]; then
mkdir ../output/sources
fi
@@ -70,7 +74,7 @@ for i in ../content/*; do
echo "<section class='images'>"$'\n' >> content.textile
for img in $i/images/*; do
# echo "images : $img"
if [ -f "$img" ]; then
if [ -f "$img" ] && [[ ! "$img" =~ ".db" ]] && [[ ! "$img" =~ ".avi" ]]; then
# record file name
fn=$(basename "$img")
counter=$(printf %02d $l)
@@ -80,14 +84,20 @@ for i in ../content/*; do
fimg="$folder-$counter.$ext"
# copy image file with new name
cp -f "$img" ../output/images/$fimg
# convert thumbs
convert ../output/images/$fimg -resize 400x400\> ../output/thumbs/$fimg
# replace image name in main content.textile file
sed -i "s/images\/$fn/images\/$fimg/g" content.textile
# pandoc can't render textile links
sed -i "s/!images\/$fn!/<a data-lightbox='$folder' href='images\/$fimg'>!thumbs\/$fimg!<\/a>/g" content.textile
# sed -i "s/!images\/$fn!/thumbs\/$fimg/g" content.textile
# find "content.textile" -print0 | xargs -0 sed -i '' -e "s/images\/$fn/images\/$fimg/g"
l=$(($l+1))
# if image is not on content ...
if [[ ! "$cont" =~ "images/$fn" ]]; then
# ... add it at end of content
echo "* !images/$fimg!" >> content.textile
echo "* <a data-lightbox='$folder' href='images/$fimg'>!thumbs/$fimg!</a>" >> content.textile
fi
fi
done
@@ -103,7 +113,7 @@ for i in ../content/*; do
for src in $i/sources/*; do
# echo "patch : $src"
if [ -f "$src" ]; then
# if image is not on content ...
# if ~ is not on file name ...
if [[ ! "$src" =~ "~" ]]; then
# record file name
fn=$(basename "$src")
@@ -145,11 +155,14 @@ cat /tmp/header|cat - content.textile > /tmp/out && mv /tmp/out content.textile
pandoc -s \
-f textile \
-t html5 -o ../output/index.html \
-H css/lightbox.min.css \
-H css/main.css \
-A script.tpl.html \
content.textile
cp -r fonts ../output/
cp -r bower_components ../output/
# echo "export markdown as html"
@@ -157,6 +170,7 @@ cp -r fonts ../output/
# -f markdown+hard_line_breaks+auto_identifiers+ascii_identifiers+tex_math_dollars+pipe_tables+all_symbols_escapable \
# -t html5 -o index.html \
# -c fonts/amiri/amiri.css \
# -H bower_components/lightbox2/dist/css/lightbox.min.css \
# -H css/styles.css \
# -B body-base-top.tpl.html \
# -A body-base-bot.tpl.html \