Working on _blog_idx_for_index
This commit is contained in:
parent
070bab8b3f
commit
e9f08ece00
39
qsgen2
39
qsgen2
@ -503,12 +503,6 @@ function _blogs() {
|
|||||||
blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}"
|
blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}"
|
||||||
blog_url="${blog_dir}/${blog_index}.html"
|
blog_url="${blog_dir}/${blog_index}.html"
|
||||||
|
|
||||||
#echo "_blogs: get_index: Date = ${sdate[@]}"
|
|
||||||
#echo "_blogs: get_index: URL = ${blog_url}"
|
|
||||||
#echo "_blogs: get_index: Title = ${btitle}"
|
|
||||||
#echo "_blogs: get_index: Ingress = ${ingress}"
|
|
||||||
#exit
|
|
||||||
|
|
||||||
if ${debug}; then echo "_blogs: Adding data for ${blog} to array"; fi
|
if ${debug}; then echo "_blogs: Adding data for ${blog} to array"; fi
|
||||||
|
|
||||||
# Concatenate all metadata into a single string for the current blog
|
# Concatenate all metadata into a single string for the current blog
|
||||||
@ -537,15 +531,36 @@ function _blog_idx_for_index() {
|
|||||||
local debug=false
|
local debug=false
|
||||||
local blog_list=$(<${project_dir}/templates/${theme}/blog_list.tpl)
|
local blog_list=$(<${project_dir}/templates/${theme}/blog_list.tpl)
|
||||||
|
|
||||||
|
# Truncate file before writing new one
|
||||||
|
: >| ${project_dir}/blog/index.tmp.html
|
||||||
|
|
||||||
for blogs in ${BLOG_META_STR_ARRAY[@]}
|
for blogs in ${BLOG_META_STR_ARRAY[@]}
|
||||||
do
|
do
|
||||||
echo "0. ${blogs}"
|
# Split meta_str into individual metadata components
|
||||||
local index_array=("${(@s/||/)blogs}")
|
local -a meta_array=("${(@s/||/)meta_str}")
|
||||||
for item in ${index_array[@]}
|
|
||||||
do
|
# Initialize variables to store each component
|
||||||
local -a split_item=$( echo ${item[@]} | cut -f: )
|
local sdate=""
|
||||||
echo "${split_item[1]} = ${split_item[2]}"
|
local btitle=""
|
||||||
|
local ingress=""
|
||||||
|
local url=""
|
||||||
|
|
||||||
|
# Iterate over each component and extract information
|
||||||
|
for component in "${meta_array[@]}"; do
|
||||||
|
case "${component}" in
|
||||||
|
SDATE:*) sdate=(${component#SDATE: }) ;;
|
||||||
|
BTITLE:*) btitle=${component#BTITLE: } ;;
|
||||||
|
INGRESS:*) ingress=${component#INGRESS: } ;;
|
||||||
|
URL:*) url=${component#URL: } ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
bdate="${sdate[1]} - ${sdate[4]}/${sdate[3]}/${sdate[2]}"
|
||||||
|
blog_list_content=$(echo "${blog_list}" | perl -pe "s|BLOGURL|${url}|g")
|
||||||
|
blog_list_content=$(echo "${blog_list}" | perl -pe "s|BLOGTITLE|${btitle}|g")
|
||||||
|
blog_list_content=$(echo "${blog_list}" | perl -pe "s|INGRESS|${ingress}|g")
|
||||||
|
blog_list_content=$(echo "${blog_list}" | perl -pe "s|BLOGDATE|${bdate}|g")
|
||||||
|
|
||||||
|
echo ${blog_list_content} >> ${project_dir}/blog/index.tmp.html
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user