Ugh... _pages need more work

This commit is contained in:
Stig-Ørjan Smelror 2024-01-30 14:12:44 +01:00
parent 1aaa29702b
commit bc779dede9

15
qsgen2
View File

@ -302,6 +302,11 @@ function _pages() {
if (( ${#pages_array[@]} > 0 )); then if (( ${#pages_array[@]} > 0 )); then
# If pages_array is not empty, we do work
if (${debug}) echo "_pages: pages_array is not empty"
for pages_in_array in ${pages_array[@]}
do
if (${debug}) echo "_pages: Setting Pages template" if (${debug}) echo "_pages: Setting Pages template"
local pages=${project_dir}/templates/${theme}/pages.tpl local pages=${project_dir}/templates/${theme}/pages.tpl
@ -316,10 +321,6 @@ function _pages() {
pages_tpl="$(<${pages})" pages_tpl="$(<${pages})"
fi fi
# If pages_array is not empty, we do work
if (${debug}) echo "_pages: pages_array is not empty"
for pages_in_array in ${pages_array[@]}
do
echo "${green}Generating Page: ${pages_in_array}${end}" echo "${green}Generating Page: ${pages_in_array}${end}"
# Read the file once # Read the file once
if (${debug}) echo "_pages: Loading page_content once - ${pages_in_array}" if (${debug}) echo "_pages: Loading page_content once - ${pages_in_array}"
@ -341,15 +342,15 @@ function _pages() {
# Look for links, images and videos and convert them if present. # Look for links, images and videos and convert them if present.
if (${debug}) echo "_pages: Checking for #link, #showimg and #ytvideo in page_content" if (${debug}) echo "_pages: Checking for #link, #showimg and #ytvideo in page_content"
if [[ $( echo ${page_content} | grep \#link ) ]]; then if [[ $( echo ${page_content} | grep \#link ) ]]; then
if (${debug}) echo "_pages: If #link is present, run _link: page_content" if (${debug}) echo "_pages: #link is present, run _link: page_content"
page_content=$( _link "${page_content}" ) page_content=$( _link "${page_content}" )
fi fi
if [[ $( echo ${page_content} | grep \#showimg ) ]]; then if [[ $( echo ${page_content} | grep \#showimg ) ]]; then
if (${debug}) echo "_pages: If #showimg is present, run _image: page_content" if (${debug}) echo "_pages: #showimg is present, run _image: page_content"
page_content=$( _image "${page_content}" ) page_content=$( _image "${page_content}" )
fi fi
if [[ $( echo ${page_content} | grep \#ytvideo ) ]]; then if [[ $( echo ${page_content} | grep \#ytvideo ) ]]; then
if (${debug}) echo "_pages: If #ytvideo is present, run _youtube: page_content" if (${debug}) echo "_pages: #ytvideo is present, run _youtube: page_content"
page_content=$( _youtube "${page_content}" ) page_content=$( _youtube "${page_content}" )
fi fi