This is bash-driven static website generator. It is simpl! It is mnmlistic! It is smol!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
1015 B

  1. #!/bin/bash
  2. echo "/// Now write your post here " > /tmp/psto
  3. echo "/// use Markdown syntax" >> /tmp/psto
  4. echo "/// as soon you've done - save the file and quit editor." >> /tmp/psto
  5. echo "/// Lines started with /// will be ignored." >> /tmp/psto
  6. $EDITOR /tmp/psto
  7. grep -v "///" /tmp/psto > ./md/$1.md
  8. md2html ./md/$1.md > /tmp/html.txt
  9. cat .smolsh/header.txt | cat - /tmp/html.txt > html/$1.html
  10. echo " </body>" >> html/$1.html
  11. echo "</html>" >> html/$1.html
  12. short=$(head -c 128 md/$1.md)
  13. curdate=$(date +%Y-%m-%d_%H:%M)
  14. echo "### [$1 ($curdate)]($1.html)" > /tmp/insert.txt
  15. echo "$short [...]($1.html)" >> /tmp/insert.txt
  16. echo "" >> /tmp/insert.txt
  17. echo "---" >> /tmp/insert.txt
  18. echo "" >> /tmp/insert.txt
  19. cp md/index.md /tmp/
  20. i=$(cat /tmp/insert.txt)
  21. awk -v ins="$i" '{print} /## Publications/{print ins}' /tmp/index.md > md/index.md
  22. md2html md/index.md > /tmp/index.html
  23. cat .smolsh/header.txt | cat - /tmp/index.html > html/index.html
  24. echo " </body>" >> html/index.html
  25. echo "</html>" >> html/index.html