Added comment to explain weird use of associative array syntax

master
Aadhavan Srinivasan 2 months ago
parent f1f5ab51b2
commit 423eba2213

@ -108,7 +108,8 @@ add_header_and_footer() {
cp "$BASE_PATH/header.html" "$BASE_PATH/temp/$parent_dir/temp_header.html"
# Check for relevant metadata, and perform corresponding action
if [[ ! -v "meta_array["date"]" ]]; then # If there is no date
# This syntax is intended (although it doesn't follow typical Bash array syntax). See https://stackoverflow.com/a/45385463 for more info.
if [[ ! -v "meta_array[date]" ]]; then # If there is no date
sed -i '$ d' "$BASE_PATH/temp/$parent_dir/temp_header.html" # remove the 'date published' section of the header
fi

Loading…
Cancel
Save