Enable debug mode in _blogs function and remove commented out lines and unused variable
This commit is contained in:
parent
166157fc77
commit
4e3d7ba1e9
19
qsgen2
19
qsgen2
@ -620,7 +620,7 @@ function _blogs() {
|
|||||||
local debug=true
|
local debug=true
|
||||||
else
|
else
|
||||||
# If you want to debug this function only, set this to true
|
# If you want to debug this function only, set this to true
|
||||||
local debug=false
|
local debug=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Running function _list_blogs
|
# Running function _list_blogs
|
||||||
@ -668,10 +668,12 @@ function _blogs() {
|
|||||||
do
|
do
|
||||||
# Check for the DATE line
|
# Check for the DATE line
|
||||||
if [[ "${line}" == "DATE "* ]]; then
|
if [[ "${line}" == "DATE "* ]]; then
|
||||||
|
if (${debug}) _msg debug "_blogs: Looking for DATE: Found"
|
||||||
date_found=true
|
date_found=true
|
||||||
fi
|
fi
|
||||||
# Check for the BLOG_TITLE line
|
# Check for the BLOG_TITLE line
|
||||||
if [[ "${line}" == "BLOG_TITLE "* ]]; then
|
if [[ "${line}" == "BLOG_TITLE "* ]]; then
|
||||||
|
if (${debug}) _msg debug "_blogs: Looking for BLOG_TITLE: Found"
|
||||||
title_found=true
|
title_found=true
|
||||||
fi
|
fi
|
||||||
# If both DATE and BLOG_TITLE are found, no need to continue checking
|
# If both DATE and BLOG_TITLE are found, no need to continue checking
|
||||||
@ -682,17 +684,16 @@ function _blogs() {
|
|||||||
|
|
||||||
# Check if DATE or BLOG_TITLE metadata is missing and log message
|
# Check if DATE or BLOG_TITLE metadata is missing and log message
|
||||||
if [[ "${date_found}" == false ]]; then
|
if [[ "${date_found}" == false ]]; then
|
||||||
_msg debug "_blogs: DATE metadata missing in ${blog}."
|
_msg debug "* _blogs: DATE metadata missing in ${blog}."
|
||||||
continue # Skip this file and move to the next
|
continue # Skip this file and move to the next
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${title_found}" == false ]]; then
|
if [[ "${title_found}" == false ]]; then
|
||||||
_msg debug "_blogs: BLOG_TITLE metadata missing in ${blog}."
|
_msg debug "* _blogs: BLOG_TITLE metadata missing in ${blog}."
|
||||||
continue # Skip this file and move to the next
|
continue # Skip this file and move to the next
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract blog information
|
# Extract blog information
|
||||||
sed -i "s/GETDATE/${blogdate}/" ${blog}
|
# sed -i "s/GETDATE/${blogdate}/" ${blog}
|
||||||
# Array sdate = Name day=1, Year=2, Month=3, Number day=4
|
# Array sdate = Name day=1, Year=2, Month=3, Number day=4
|
||||||
sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) )
|
sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) )
|
||||||
if [[ ${generator} == "native" ]]; then
|
if [[ ${generator} == "native" ]]; then
|
||||||
@ -703,16 +704,14 @@ function _blogs() {
|
|||||||
fi
|
fi
|
||||||
done <<< "$content"
|
done <<< "$content"
|
||||||
elif [[ ${generator} == "markdown" ]]; then
|
elif [[ ${generator} == "markdown" ]]; then
|
||||||
local b_title=""
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" == \#* ]]; then
|
if [[ "$line" == \#* ]]; then
|
||||||
b_title="${line#\#}" # Remove the first '#' character
|
btitle="${line#\#}" # Remove the first '#' character
|
||||||
b_title="${b_title#\#}" # Remove the second '#' character if present
|
btitle="${btitle#\#}" # Remove the second '#' character if present
|
||||||
b_title="${b_title#"${b_title%%[![:space:]]*}"}" # Trim leading whitespace
|
btitle="${btitle#"${btitle%%[![:space:]]*}"}" # Trim leading whitespace
|
||||||
break # Exit the loop after finding the first heading
|
break # Exit the loop after finding the first heading
|
||||||
fi
|
fi
|
||||||
done <<< "$content"
|
done <<< "$content"
|
||||||
btitle=${b_title}
|
|
||||||
fi
|
fi
|
||||||
ingress=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#INGRESS_START\K(.*?)#INGRESS_STOP" | sed "s|\ \#INGRESS_STOP||" | sed "s|^\ ||" )
|
ingress=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#INGRESS_START\K(.*?)#INGRESS_STOP" | sed "s|\ \#INGRESS_STOP||" | sed "s|^\ ||" )
|
||||||
body=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#BODY_START\K(.*?)#BODY_STOP" | sed "s|\ \#BODY_STOP||" | sed "s|^\ ||" )
|
body=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#BODY_START\K(.*?)#BODY_STOP" | sed "s|\ \#BODY_STOP||" | sed "s|^\ ||" )
|
||||||
|
Loading…
Reference in New Issue
Block a user