diff --git a/build.sh b/build.sh index fa4150d..9f3ea35 100755 --- a/build.sh +++ b/build.sh @@ -13,7 +13,9 @@ # # To use it, create a directory for your project (e.g. 'website'). Inside 'website', create # two directories: 'source' (which holds your Markdown files) and 'output' (which holds the -# converted HTML. +# converted HTML. To exclude files from the conversion process, place them inside a directory +# named 'exclude' inside 'source'. This directory will not be copied over into 'output', and +# any files inside it will not be converted. # # In addition to these directories, three files are needed in 'website': # 1. 'header.html' - A header, which is prepended to every source file. Unfortunately, this must @@ -74,6 +76,11 @@ setup_output_dir() { del_files_in_output() { find "$BASE_PATH/output" -type f -name "*.md" -delete #Delete all .md files (which were copied over from 'source') in 'output' + # Delete the 'exclude' directory from the output folder. + # This folder contains markdown files which shouldn't be converted to HTML. + if [[ -d "${BASE_PATH}/output/exclude" ]]; then + rm -r "${BASE_PATH}/output/exclude" + fi } read_metadata() { @@ -192,7 +199,8 @@ convert_file() { md_to_html() { # Convert .md files from 'source' and place them into the correct locations into 'output' - local files=$(find "$BASE_PATH/source" -name "*.md") +# Exclude all files and folders inside the 'exclude' directory + local files=$(find "${BASE_PATH}/source" -not -path "${BASE_PATH}/source/exclude/*" -name "*.md") # Concurrently convert each document for file in $files; do