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.

30 lines
1.0KB

  1. #!/usr/bin/fish
  2. if [ -z (find -name schema.png -newer source/schema.dia) ]
  3. echo 'Generating schema PNG...'
  4. dia -e schema.png source/schema.dia
  5. convert schema.png -bordercolor white -border 20 schema.png
  6. end
  7. echo 'Generating HTML...'
  8. for md_path in source/*.md
  9. set output_path (echo $md_path | sed 's_source/__;s/md/html/')
  10. rm -f $output_path
  11. set page_html (markdown -f +idanchor -squash -html5 -toc $md_path)
  12. echo '<!doctype html>' >> $output_path
  13. echo '<html lang="en">' >> $output_path
  14. echo '<head>' >> $output_path
  15. echo '<meta charset="utf-8">' >> $output_path
  16. echo '<title>' (echo $page_html | xmllint --html -xpath "//h1/text()" - ^ /dev/null) '</title>' >> $output_path
  17. echo '<style>' (curl -s 'https://raw.githubusercontent.com/oxalorg/sakura/master/css/sakura.css') '</style>' >> $output_path
  18. echo '</head>' >> $output_path
  19. echo '<body>' >> $output_path
  20. echo $page_html >> $output_path
  21. echo '</body>' >> $output_path
  22. echo '</html>' >> $output_path
  23. tidy -mi $output_path ^ /dev/null
  24. end