Git repo for my website
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.
 
 
 

19 lines
718 B

  1. #!/bin/bash
  2. set -euo pipefail
  3. BASE_DIR="$(echo ${0} | sed -e 's|/webgen2.sh||')"
  4. WEB_ROOT="${BASE_DIR}/website"
  5. TEMPLATE_DIR="${BASE_DIR}/templates"
  6. TEMPLATE_HTML="${TEMPLATE_DIR}/html/nextgen.html"
  7. for MARKDOWN_FILE in $(find -P ${TEMPLATE_DIR}/markdown/ | grep '.md'); do
  8. PAGE_DIR="$(cat ${MARKDOWN_FILE} | grep 'page_dir' | sed -e 's|page_dir: ||')"
  9. if [[ ! -d "${WEB_ROOT}${PAGE_DIR}" ]]; then
  10. mkdir -p "${WEB_ROOT}${PAGE_DIR}" # Makes the folder the current page being (re)generated goes in if it does not already exist.
  11. fi
  12. pandoc --from markdown --to html --template "${TEMPLATE_HTML}" --output "${WEB_ROOT}${PAGE_DIR}index.html" "${MARKDOWN_FILE}" # pandoc does its magic here
  13. done