Files
ola5doc/publi/publi.sh
T

116 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# 06-07-2016
# Licence : GPLv3
echo "generating publication"
# echo "creating folders"
# if [ ! -d ../output ]; then
# mkdir ../content
# fi
# if [ ! -d ../content/images ]; then
# mkdir ../content/images
# fi
#
# if [ ! -d ../content/thumbs ]; then
# mkdir ../content/thumbs
# fi
#
# if [ ! -d ../content/sources ]; then
# mkdir ../content/sources
# fi
# if [ -f content.textile ]; then
# rm content.textile
# fi
if [ ! -d temp ]; then
rm -rf tmp
fi
mkdir tmp
touch tmp/content.textile
touch tmp/summary
# echo "" > tmp/summary
echo "reading content"
# _ _
# | | | |
# ___ ___ _ __ | |_ ___ _ __ | |_
# / __/ _ \| '_ \| __/ _ \ '_ \| __|
# | (_| (_) | | | | || __/ | | | |_
# \___\___/|_| |_|\__\___|_| |_|\__|
echo "<section id='main'>" >> tmp/content.textile
for i in ../content/*; do
# if folder if not sys if not modele
if [ -d "$i" ] && [[ ! "$i" =~ "model" ]]; then
# if readme exists
if [ -f "$i/publi.textile" ]; then
# user name
# record readme content on variable
# cont=$(cat "$i/publi.textile")
echo "$i"
u=${i/..\//}
# record link for menu
# echo "<li><a href='#$u'>$u</a></li>" >> tmp/summary
u=${u/content//}
id=${u:2}
echo "* \"$id\":#$id" >> tmp/summary
# right html and contents on main tmp/content.textile
echo "<div id='$id' class='user'>" >> tmp/content.textile
# add user content to main content
echo "<section class='content'>"$'\n' >> tmp/content.textile
# get meta data
# add content to main tmp/content.textile
cat "$i/publi.textile" >> tmp/content.textile
echo $'\n'"</section>" >> tmp/content.textile
# get folder name
folder=$(basename "$i")
echo "</div>" >> tmp/content.textile
echo '<div class="pagebreak"></div>' >> tmp/content.textile
fi
fi
done
# end main section
echo "</section>" >> tmp/content.textile
# _ _
# | | | |
# | |__ ___ __ _ __| | ___ _ __
# | '_ \ / _ \/ _` |/ _` |/ _ \ '__|
# | | | | __/ (_| | (_| | __/ |
# |_| |_|\___|\__,_|\__,_|\___|_|
echo "header"
touch tmp/header
echo "<header id='header'>"$'\n' > tmp/header
echo "h1. Algolittéraire"$'\n' >> tmp/header
echo "h2. OLA#5 : An Mertens, Programation Python Algolittéraire"$'\n' >> tmp/header
# echo "<nav id='menu'>"$'\n' >> tmp/header
# cat tmp/summary >> tmp/header
# echo $'\n'"</nav>" >> tmp/header
echo "</header>" >> tmp/header
cat tmp/header|cat - tmp/content.textile > tmp/out && mv tmp/out tmp/content.textile
echo "Pandoc"
pandoc -s \
-f textile \
-t html5 -o ./index.html \
-H style.tpl.html \
-A script.tpl.html \
tmp/content.textile
# -H css/main.css \