| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 | 
							- #!/bin/bash
 
- # 06-07-2016
 
- # Licence : GPLv3
 
- echo "generating complete file"
 
- echo "creating folders"
 
- 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
 
- # 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/readme.textile" ]; then
 
-       # user name
 
-       # record readme content on variable
 
-       cont=$(cat "$i/readme.textile")
 
-       echo "$i"
 
-       # echo "$cont"
 
-       # user=$(grep "h1\.\s*.+" "$i/readme.textile")
 
-       # user="${cont% h1}"
 
-       # user=$(expr "$cont" : "h1. \(.*\)$")
 
-       # echo "user : $user"
 
-       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
 
-       # add content to main tmp/content.textile
 
-       cat "$i/readme.textile" >> tmp/content.textile
 
-       echo $'\n'"</section>" >> tmp/content.textile
 
-       # get folder name
 
-       folder=$(basename "$i")
 
-       #   _
 
-       #  (_)
 
-       #   _ _ __ ___   __ _  __ _  ___  ___
 
-       #  | | '_ ` _ \ / _` |/ _` |/ _ \/ __|
 
-       #  | | | | | | | (_| | (_| |  __/\__ \
 
-       #  |_|_| |_| |_|\__,_|\__, |\___||___/
 
-       #                      __/ |
 
-       #                     |___/
 
-       echo "    images"
 
-       images=""
 
-       l=0
 
-       echo "<section class='images'>"$'\n' >> tmp/content.textile
 
-       for img in $i/images/*; do
 
-         # echo "images : $img"
 
-         if [ -f "$img" ] && [[ ! "$img" =~ ".db" ]] && [[ ! "$img" =~ ".avi" ]]; then
 
-           # record file name
 
-           fn=$(basename "$img")
 
-           counter=$(printf %02d $l)
 
-           # record extension
 
-           ext="${fn##*.}"
 
-           # record new image name
 
-           fimg="$folder-$counter.$ext"
 
-           # copy image file with new name
 
-           cp -f "$img" ../output/images/$fimg
 
-           # convert thumbs
 
-           convert ../output/images/$fimg -resize 800x800\>  ../output/thumbs/$fimg
 
-           # replace image name in main tmp/content.textile file
 
-           # pandoc can't render textile links
 
-           sed -i \
 
-           "s/!images\/$fn!/<a data-lightbox='$folder' href='images\/$fimg'>!thumbs\/$fimg!<\/a>/g" tmp/content.textile
 
-           # sed -i "s/!images\/$fn!/thumbs\/$fimg/g" tmp/content.textile
 
-           # find "tmp/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  "* <a data-lightbox='$folder' href='images/$fimg'>!thumbs/$fimg!</a>" >> tmp/content.textile
 
-           fi
 
-         fi
 
-       done
 
-       echo $'\n'"</section>" >> tmp/content.textile
 
-       #    _________  __  _______________  _____
 
-       #   / ___/ __ \/ / / / ___/ ___/ _ \/ ___/
 
-       #  (__  ) /_/ / /_/ / /  / /__/  __(__  )
 
-       # /____/\____/\__,_/_/   \___/\___/____/
 
-       #
 
-       echo "    sources"
 
-       echo "<section class='sources'>"$'\n' >> tmp/content.textile
 
-       for src in $i/sources/*; do
 
-         # echo "patch : $src"
 
-         if [ -f "$src" ]; then
 
-           # if ~ is not on file name ...
 
-           if [[ ! "$src" =~ "~" ]]; then
 
-             # record file name
 
-             fn=$(basename "$src")
 
-             cp -f "$src" ../output/sources/$i/$fn
 
-             # echo $'\r'"<li>" >> tmp/content.textile
 
-             echo  "* \"$fn\":sources/$i/$fn" >> tmp/content.textile
 
-             # echo $'\r'"</li>" >> tmp/content.textile
 
-           fi
 
-         fi
 
-       done
 
-       echo $'\n'"</section>" >> tmp/content.textile
 
-       echo "</div>" >> tmp/content.textile
 
-       echo '<div class="pagebreak"></div>' >> tmp/content.textile
 
-     fi
 
-   fi
 
- done
 
- #     ____            __
 
- #    / __ \____ _____/ /
 
- #   / /_/ / __ `/ __  /
 
- #  / ____/ /_/ / /_/ /
 
- # /_/    \__,_/\__,_/
 
- # curl http://pads.osp.kitchen/p/ola-workshop/export/txt -o tmp/pad.md
 
- curl https://mypads.framapad.org/p/ola-5doc-6117z7kl/export/txt -o tmp/pad.md
 
- echo "* \"Pad\":#pad" >> tmp/summary
 
- # right html and contents on main tmp/content.textile
 
- echo "<div id='pad' class='user'>" >> tmp/content.textile
 
- echo "<h1>Pad</h1>" >> tmp/content.textile
 
- # add user content to main content
 
- echo "<section class='content'>"$'\n' >> tmp/content.textile
 
- # add content to main tmp/content.textile
 
- pandoc -f markdown -t textile -o tmp/pad.textile tmp/pad.md
 
- cat tmp/pad.textile >> tmp/content.textile
 
- echo $'\n'"</section>" >> tmp/content.textile
 
- echo "</div>" >> tmp/content.textile
 
- echo '<div class="pagebreak"></div>' >> tmp/content.textile
 
- #    ______            __   ____              __
 
- #   / ____/___  ____  / /__/ __ )____  ____  / /__
 
- #  / /   / __ \/ __ \/ //_/ __  / __ \/ __ \/ //_/
 
- # / /___/ /_/ / /_/ / ,< / /_/ / /_/ / /_/ / ,<
 
- # \____/\____/\____/_/|_/_____/\____/\____/_/|_|
 
- # curl http://pads.osp.kitchen/p/ola-cookbook/export/txt -o tmp/cookbook.md
 
- #
 
- # echo "* \"CookBook\":#cookbook" >> tmp/summary
 
- #
 
- # # right html and contents on main tmp/content.textile
 
- # echo "<div id='cookbook' class='user'>" >> tmp/content.textile
 
- # echo "<h1>CookBook</h1>" >> tmp/content.textile
 
- # # add user content to main content
 
- # echo "<section class='content'>"$'\n' >> tmp/content.textile
 
- # # add content to main tmp/content.textile
 
- # pandoc -f markdown -t textile -o tmp/cookbook.textile tmp/cookbook.md
 
- # cat tmp/cookbook.textile >> tmp/content.textile
 
- # echo $'\n'"</section>" >> tmp/content.textile
 
- # echo "</div>" >> tmp/content.textile
 
- #
 
- # echo '<div class="pagebreak"></div>' >> tmp/content.textile
 
- # end main section
 
- echo "</section>" >> tmp/content.textile
 
-  #  _                    _
 
-  # | |                  | |
 
-  # | |__   ___  __ _  __| | ___ _ __
 
-  # | '_ \ / _ \/ _` |/ _` |/ _ \ '__|
 
-  # | | | |  __/ (_| | (_| |  __/ |
 
-  # |_| |_|\___|\__,_|\__,_|\___|_|
 
- echo "header"
 
- touch tmp/header
 
- echo "<header id='header'>"$'\n' > tmp/header
 
- echo "h1. OLA#5 Documentation : 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 ../output/index.html \
 
-   -H style.tpl.html \
 
-   -A script.tpl.html \
 
-   tmp/content.textile
 
-   # -H css/main.css \
 
- cp -r css ../output/
 
- cp -r fonts ../output/
 
- cp -r bower_components ../output/
 
- # echo "export markdown as html"
 
- # pandoc -s \
 
- #   -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 \
 
- #   -A js/jquery.min.js \
 
- #   -A js/script.js \
 
- #   # -A js/css-regions-polyfill.min.js \
 
- #   -A body-base-end.tpl.html \
 
- #   pad.md
 
 
  |