Browse Source

Modified to create light-themed versions of pages, allowing for theme continuity across site

old
Jean 6 months ago
parent
commit
48deddac2d
Signed by: easthighNerd <jean@easthighnerd.net> GPG Key ID: F4B3EACD21AEFFF4
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      webgen.sh

+ 8
- 1
webgen.sh View File

@@ -2,6 +2,9 @@
set -euo pipefail


# This is a modified version of WebGen to acomodate specific things I do with my website.


WEB_ROOT="$(echo ${0} | sed -e 's|/webgen.sh||')" # The root folder of your website.
TEMPLATE="${WEB_ROOT}/res/html/main.html" # The template HTML file used by this script.
HEAD="1" # Initial count for 'head'. Don't edit this.
@@ -17,7 +20,11 @@ while [[ ! "${CURRENT_PAGE}" = "${LAST_PAGE}" ]]; do # So long as the current pa
mkdir -p "${WEB_ROOT}${PAGE_DIR}" # Makes the folder the current page being (re)generated goes in if it does not already exist.
fi
pandoc --from markdown --to html --template "${TEMPLATE}" "${CURRENT_PAGE}" | sed -e 's|/">|" target="_blank" class="external_link">|g; s|.png">|.png" target="_blank">|g; s|href="http://|class="http_link" href="http://|g' > "${WEB_ROOT}${PAGE_DIR}index.html" # pandoc does its magic here.
pandoc --from markdown --to html --template "${TEMPLATE}" "${CURRENT_PAGE}" | sed -e 's|/">|" target="_blank" class="external_link">[EXTERNAL] |g; s|.png">|.png" target="_blank">|g; s|href="http://|class="http_link" href="http://|g;' > "${WEB_ROOT}${PAGE_DIR}index.html" # pandoc does its magic here.

pandoc --from markdown --to html --template "${TEMPLATE}" "${CURRENT_PAGE}" | sed -e 's|/">|" target="_blank" class="external_link">[EXTERNAL] |g; s|.png">|.png" target="_blank">|g; s|href="http://|class="http_link" href="http://|g;' > "${WEB_ROOT}${PAGE_DIR}dark.html" # pandoc does its magic here (x2).
pandoc --from markdown --to html --template "${TEMPLATE}" "${CURRENT_PAGE}" | sed -e 's|/">|" target="_blank" class="external_link">[EXTERNAL] |g; s|.png">|.png" target="_blank">|g; s|href="http://|class="http_link" href="http://|g' | sed -e 's|main.css|light.css|; s|dark.html|light.html|g' > "${WEB_ROOT}${PAGE_DIR}light.html" # pandoc does its magic here (x3).

HEAD="$(bc<<<${HEAD}+1)" # Increases the count for 'head' by one.
done

Loading…
Cancel
Save