Trying more debugging

This commit is contained in:
Stig-Ørjan Smelror 2024-01-29 22:21:58 +01:00
parent 0d79b4bfc8
commit a3c1571ee1

8
qsgen2
View File

@ -281,8 +281,9 @@ function _file_to_lower() {
function _pages() { function _pages() {
# This function generates all the new and updated Pages # This function generates all the new and updated Pages
local debug=false local debug=true
if (${debug}) echo "_pages: Setting 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.
@ -296,18 +297,21 @@ function _pages() {
fi fi
# Load the cache for Pages # Load the cache for Pages
if (${debug}) echo "_pages: Running function _pages_cache"
_pages_cache _pages_cache
if (( ${#pages_array[@]} > 0 )); then if (( ${#pages_array[@]} > 0 )); then
# If pages_array is not empty, we do work # 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[@]} for pages_in_array in ${pages_array[@]}
do 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"
local page_content="$(<${pages_in_array})" local page_content="$(<${pages_in_array})"
# Grab the title from the Page # Grab the title from the Page
if (${debug}) echo "_pages: Grepping for page_title"
page_title=$( grep '#title' ${page_content} | head -2 | cut -d= -f2 > /dev/null ) page_title=$( grep '#title' ${page_content} | head -2 | cut -d= -f2 > /dev/null )
echo "Page Title: ${page_title}" echo "Page Title: ${page_title}"