convert_nb 739 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. # Converts all found jupyter notebooks to html and places them in the specified
  3. # output directory. This is so they can be incorportated into the doxygen docs
  4. # of the project.
  5. set -e
  6. if [ $# -lt 2 ]
  7. then
  8. echo "Usage: $0 [nbconvert-exe] [output_directory] (--update)"
  9. exit 0
  10. fi
  11. if [ "$#" -eq 3 ] && [ "$3" == "--update" ]
  12. then
  13. exec_opt="--ExecutePreprocessor.enabled=True"
  14. else
  15. exec_opt=""
  16. fi
  17. nb_files=$(find . -type f -name "*.ipynb" ! -path "*/.ipynb_checkpoints/*")
  18. while read -r nb_file; do
  19. echo "Converting file: $nb_file"
  20. # echo $1 --to html --template full $exec_opt --output-dir "$2" $nb_file
  21. $1 --to html --template full $exec_opt --output-dir "$2" "$nb_file"
  22. done <<< "$nb_files"