I have been fiddling a bit with my page content management script. So now except the pages I am also auto-generating the page bars too. As another field test I will just as well share the skeleton of my generator.
We first have the basic stuff:
############## EDIT THIS ########################### OUTPUT="/media/05022eeb-bcac-4484-8eb0-1b41d4eae750/site-tex-res/site-sync/dilemaltd.com/public_html/deyan-levski/test/" FILE="index.htm" DIRECTORIES="\ /media/05022eeb-bcac-4484-8eb0-1b41d4eae750/site-tex-res/site-sync/dilemaltd.com/public_html/deyan-levski/test/post/ \ " FILENAMES='post*.htm' ####################################################I.e. I look through the "post" folder and the html files in it and then build-up the pages by concatinating a base skeleton and the posts e.g.:
DATE=`date` echo $BASE >> $OUTPUT$FILE #declare -i cnt #declare -i p cnt=0 dobase=0 p=0 for f in $FILENAMES; do for i in `find $DIRECTORIES -type f \( -iname "*$f*" ! -iname "*~" ! -iname ".*" \) | sort -V -r `; do #flinedate=$(head -n 1 $i) #Auto file date fetch stuff, that is currently not implemented. #echo $date cnt=`expr $cnt + 1` if [ "$cnt" -lt 5 ] && [ "$p" -eq 0 ] then CATSTR=$OUTPUT$FILE cat $i >> $CATSTR elif [ "$cnt" -lt 5 ] && [ "$p" -ne 0 ] then CATSTR=$OUTPUT$p$FILE cat $i >> $CATSTR else cnt=0 p=`expr $p + 1` CATSTR=$OUTPUT$p$FILE dobase=0 if [ "$dobase" -eq 0 ] then echo $BASE >> $CATSTR dobase=1 fi cat $i >> $CATSTR fi done done
Then generate the pagebar:
z=0 for k in { 0..$p }; do # Generate bottom Page bar CATSTR=$OUTPUT$z$FILE MAININDEX=$OUTPUT$FILE if [ $z -ne 0 ] then olz=0 echo "Page: " >> $CATSTR for r in `seq 0 $p`;do olz=`expr $olz + 1` if [ "$olz" -eq 1 ] then echo "0 " >> $CATSTR else olzt=`expr $olz - 1` echo "$olzt " >> $CATSTR fi done echo " " >> $CATSTR echo "Last edited: $DATE by $USER
" >> $CATSTR echo "\n