This commit is contained in:
Stig-Ørjan Smelror 2024-01-30 00:38:25 +01:00
parent 1d22ce8112
commit 281f7632bc

22
qsgen2
View File

@ -283,7 +283,7 @@ function _pages() {
local debug=true local debug=true
if (${debug}) echo "_pages: Setting template" if (${debug}) echo "_pages: Setting Pages template"
local pages=${project_dir}/templates/${theme}/pages.tpl local pages=${project_dir}/templates/${theme}/pages.tpl
# Let's check if we can access the pages.tpl file. # Let's check if we can access the pages.tpl file.
@ -293,6 +293,7 @@ function _pages() {
exit exit
else else
# Read template once # Read template once
if (${debug}) echo "_pages: Reading Pages template into pages_tpl"
pages_tpl="$(<${pages})" pages_tpl="$(<${pages})"
fi fi
@ -331,29 +332,14 @@ function _pages() {
if (${debug}) echo "_pages: Replacing #pagetitle in pages_tpl" if (${debug}) echo "_pages: Replacing #pagetitle in pages_tpl"
pages_tpl=$( echo ${pages_tpl} | sed -e "s|#pagetitle|${page_title}|g" ) pages_tpl=$( echo ${pages_tpl} | sed -e "s|#pagetitle|${page_title}|g" )
#echo "${pages_tpl}"
#exit
# Replace every #tagline in pages_tpl # Replace every #tagline in pages_tpl
if (${debug}) echo "_pages: Replacing tagline" if (${debug}) echo "_pages: Replacing tagline"
pages_tpl=$( echo ${pages_tpl} | sed -e "s|#tagline|${site_tagline}|g" ) pages_tpl=$( echo ${pages_tpl} | sed -e "s|#tagline|${site_tagline}|g" )
#echo "${magenta}AFTER REPLACING TAGLINE${end}"
#echo ${pages_tpl}
#exit
#echo "${magenta}AFTER _last_updated${end}"
#echo ${pages_tpl}
#exit
# Insert page_content into pages_tpl by replacing the BODY tag present there # Insert page_content into pages_tpl by replacing the BODY tag present there
#if (${debug}) echo "_pages: Replacing BODY with page_content in pages_tpl" #if (${debug}) echo "_pages: Replacing BODY with page_content in pages_tpl"
#pages_tpl=$( echo ${pages_tpl} | sed "s|BODY|${page_content}|g" ) #pages_tpl=$( echo ${pages_tpl} | sed "s|BODY|${page_content}|g" )
#echo "${magenta}AFTER BODY HAS BEEN REPLACED${end}"
#echo ${pages_tpl}
#exit
# Always use lowercase for file names # Always use lowercase for file names
pages_title_lower=$( _file_to_lower "${pages_in_array}" ) pages_title_lower=$( _file_to_lower "${pages_in_array}" )
# Write pages_tpl to disk # Write pages_tpl to disk
@ -383,6 +369,10 @@ function _pages() {
# _cleanup ${pages_tpl} # _cleanup ${pages_tpl}
done done
else
echo "${yellow}No new or updated Pages${end}"
fi fi
} }