New feature: Exclude all files and directories inside the 'exclude' directory in 'source'

master
Aadhavan Srinivasan 2 weeks ago
parent 71a242e1d6
commit 628a03b2da

@ -13,7 +13,9 @@
# #
# To use it, create a directory for your project (e.g. 'website'). Inside 'website', create # 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 # 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': # 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 # 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() { 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' 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() { read_metadata() {
@ -192,7 +199,8 @@ convert_file() {
md_to_html() { md_to_html() {
# Convert .md files from 'source' and place them into the correct locations into 'output' # 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 # Concurrently convert each document
for file in $files; do for file in $files; do

Loading…
Cancel
Save