publi.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/bash
  2. # 06-07-2016
  3. # Licence : GPLv3
  4. echo "generating publication"
  5. # echo "creating folders"
  6. # if [ ! -d ../output ]; then
  7. # mkdir ../content
  8. # fi
  9. # if [ ! -d ../content/images ]; then
  10. # mkdir ../content/images
  11. # fi
  12. #
  13. # if [ ! -d ../content/thumbs ]; then
  14. # mkdir ../content/thumbs
  15. # fi
  16. #
  17. # if [ ! -d ../content/sources ]; then
  18. # mkdir ../content/sources
  19. # fi
  20. # if [ -f content.textile ]; then
  21. # rm content.textile
  22. # fi
  23. if [ ! -d temp ]; then
  24. rm -rf tmp
  25. fi
  26. mkdir tmp
  27. touch tmp/content.textile
  28. touch tmp/summary
  29. # echo "" > tmp/summary
  30. echo "reading content"
  31. # _ _
  32. # | | | |
  33. # ___ ___ _ __ | |_ ___ _ __ | |_
  34. # / __/ _ \| '_ \| __/ _ \ '_ \| __|
  35. # | (_| (_) | | | | || __/ | | | |_
  36. # \___\___/|_| |_|\__\___|_| |_|\__|
  37. echo "<section id='main'>" >> tmp/content.textile
  38. for i in ../content/*; do
  39. # if folder if not sys if not modele
  40. if [ -d "$i" ] && [[ ! "$i" =~ "model" ]]; then
  41. # if readme exists
  42. if [ -f "$i/publi.textile" ]; then
  43. # user name
  44. # record readme content on variable
  45. # cont=$(cat "$i/publi.textile")
  46. echo "$i"
  47. u=${i/..\//}
  48. # record link for menu
  49. # echo "<li><a href='#$u'>$u</a></li>" >> tmp/summary
  50. u=${u/content//}
  51. id=${u:2}
  52. echo "* \"$id\":#$id" >> tmp/summary
  53. # right html and contents on main tmp/content.textile
  54. echo "<div id='$id' class='user'>" >> tmp/content.textile
  55. # add user content to main content
  56. echo "<section class='content'>"$'\n' >> tmp/content.textile
  57. # get meta data
  58. # add content to main tmp/content.textile
  59. cat "$i/publi.textile" >> tmp/content.textile
  60. echo $'\n'"</section>" >> tmp/content.textile
  61. # get folder name
  62. folder=$(basename "$i")
  63. echo "</div>" >> tmp/content.textile
  64. echo '<div class="pagebreak"></div>' >> tmp/content.textile
  65. fi
  66. fi
  67. done
  68. # end main section
  69. echo "</section>" >> tmp/content.textile
  70. # _ _
  71. # | | | |
  72. # | |__ ___ __ _ __| | ___ _ __
  73. # | '_ \ / _ \/ _` |/ _` |/ _ \ '__|
  74. # | | | | __/ (_| | (_| | __/ |
  75. # |_| |_|\___|\__,_|\__,_|\___|_|
  76. echo "header"
  77. touch tmp/header
  78. echo "<header id='header'>"$'\n' > tmp/header
  79. echo "h1. Algolittéraire"$'\n' >> tmp/header
  80. echo "h2. OLA#5 : An Mertens, Programation Python Algolittéraire"$'\n' >> tmp/header
  81. # echo "<nav id='menu'>"$'\n' >> tmp/header
  82. # cat tmp/summary >> tmp/header
  83. # echo $'\n'"</nav>" >> tmp/header
  84. echo "</header>" >> tmp/header
  85. cat tmp/header|cat - tmp/content.textile > tmp/out && mv tmp/out tmp/content.textile
  86. echo "Pandoc"
  87. pandoc -s \
  88. -f textile \
  89. -t html5 -o ./index.html \
  90. -H style.tpl.html \
  91. -A script.tpl.html \
  92. tmp/content.textile
  93. # -H css/main.css \