From 8c4862cd05a8bb3e8704f9497bbedca314fb2b7e Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 31 Jan 2024 22:48:17 -0500 Subject: [PATCH] Renamed 'notitle' to 'noappend', and added 'date = auto' variable to automatically add the date --- build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index cc79324..e3cd399 100755 --- a/build.sh +++ b/build.sh @@ -58,7 +58,7 @@ convert_to_array() { } add_date_to_array() { - if test -z "${meta_array[date]}"; then # If there is no existing date in the metadata + if [[ "${meta_array[date]}" == "auto" ]]; then # If the date is set to 'auto' meta_array["date"]="$(date -r $1 +'%b %d, %Y')" fi } @@ -68,12 +68,12 @@ add_header_and_footer() { cp $BASE_PATH/header.html $BASE_PATH/temp/temp_header.html # Check for relevant metadata, and perform corresponding action - if [[ "${meta_array[nodate]}" == "true" ]]; then - sed -i '$ d' $BASE_PATH/temp/temp_header.html # 'nodate' removes the 'date published' section of the header + if test -z "${meta_array[date]}"; then #If there is no date + sed -i '$ d' $BASE_PATH/temp/temp_header.html # remove the 'date published' section of the header fi - if [[ "${meta_array[notitle]}" == "true" ]]; then - sed -i 's/ - Two More Cents//g' $BASE_PATH/temp/temp_header.html # 'notitle' removes the suffix from the title + if [[ "${meta_array[noappend]}" == "true" ]]; then + sed -i 's/ - Two More Cents//g' $BASE_PATH/temp/temp_header.html # 'noappend' removes the suffix from the title fi # Add header