qsgen2: Simplify local vs global debug
This commit is contained in:
parent
987a80397d
commit
136a9644f5
131
qsgen2
131
qsgen2
@ -113,11 +113,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if (${globaldebug}); then
|
if (${globaldebug}); then
|
||||||
qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' )
|
qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' )
|
||||||
echo "${red}Contents of Config file:${end}"
|
echo "${red}Contents of Config file:${end}"
|
||||||
for qslines in ${qsconfig}
|
for qslines in ${qsconfig}
|
||||||
do
|
do
|
||||||
echo "${yellow}${qslines}${end}"
|
echo "${yellow}${qslines}${end}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -218,12 +218,7 @@ export blogdate=$(strftime "%a-%Y-%b-%d")
|
|||||||
|
|
||||||
function _list_pages() {
|
function _list_pages() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize or clear the array to ensure it's empty before adding files
|
# Initialize or clear the array to ensure it's empty before adding files
|
||||||
pages_file_array=()
|
pages_file_array=()
|
||||||
@ -251,12 +246,7 @@ function _list_pages() {
|
|||||||
|
|
||||||
function _list_blogs() {
|
function _list_blogs() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize or clear the blogs array to ensure it's empty before adding files
|
# Initialize or clear the blogs array to ensure it's empty before adding files
|
||||||
blogs_file_array=()
|
blogs_file_array=()
|
||||||
@ -287,12 +277,7 @@ function _list_blogs() {
|
|||||||
# BLOG CACHE
|
# BLOG CACHE
|
||||||
function _blog_cache() {
|
function _blog_cache() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
_list_blogs
|
_list_blogs
|
||||||
|
|
||||||
@ -343,12 +328,7 @@ function _blog_cache() {
|
|||||||
# Returns the array pages_array()
|
# Returns the array pages_array()
|
||||||
function _pages_cache() {
|
function _pages_cache() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create an associative array for the pages cache
|
# Create an associative array for the pages cache
|
||||||
typeset -A pages_cache
|
typeset -A pages_cache
|
||||||
@ -398,12 +378,7 @@ function _pages_cache() {
|
|||||||
function _last_updated() {
|
function _last_updated() {
|
||||||
# This function updates #updated and #version tags in the provided string for buffers
|
# This function updates #updated and #version tags in the provided string for buffers
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (${debug}); then _msg debug "_last_updated: Setting date and version in footer"; fi
|
if (${debug}); then _msg debug "_last_updated: Setting date and version in footer"; fi
|
||||||
if (${debug}); then _msg debug "_last_updated: ${upd_msg}"; fi
|
if (${debug}); then _msg debug "_last_updated: ${upd_msg}"; fi
|
||||||
@ -424,11 +399,7 @@ function _last_updated() {
|
|||||||
function _f_last_updated() {
|
function _f_last_updated() {
|
||||||
# Updates #updated and #version tags in the provided file using Zsh
|
# Updates #updated and #version tags in the provided file using Zsh
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# local file_path="${1}"
|
# local file_path="${1}"
|
||||||
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>"
|
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>"
|
||||||
@ -470,12 +441,7 @@ 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
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load the cache for Pages
|
# Load the cache for Pages
|
||||||
if (${debug}) _msg debug "_pages: Running function _pages_cache"
|
if (${debug}) _msg debug "_pages: Running function _pages_cache"
|
||||||
@ -626,12 +592,7 @@ function _pages() {
|
|||||||
function _blogs() {
|
function _blogs() {
|
||||||
# This function either generates blog files or exports metadata based on the argument
|
# This function either generates blog files or exports metadata based on the argument
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Running function _list_blogs
|
# Running function _list_blogs
|
||||||
if (${debug}) _msg debug "_blogs: Running function _list_blogs"
|
if (${debug}) _msg debug "_blogs: Running function _list_blogs"
|
||||||
@ -818,12 +779,7 @@ function _blogs() {
|
|||||||
function _blog_idx_for_index() {
|
function _blog_idx_for_index() {
|
||||||
# This function generates the file blog/index.tmp.html
|
# This function generates the file blog/index.tmp.html
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
_msg sub "- Populating ${project_dir}/blog/index.tmp.html"
|
_msg sub "- Populating ${project_dir}/blog/index.tmp.html"
|
||||||
|
|
||||||
@ -895,12 +851,7 @@ function _blog_idx_for_index() {
|
|||||||
|
|
||||||
function _blog_index() {
|
function _blog_index() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This function generates the www_root/blog/index.html file that gets its data from _blog_list_for_index()
|
# This function generates the www_root/blog/index.html file that gets its data from _blog_list_for_index()
|
||||||
# ${new_updated_blogs} comes from the function _blogs if anything new or updated is detected
|
# ${new_updated_blogs} comes from the function _blogs if anything new or updated is detected
|
||||||
@ -936,12 +887,7 @@ function _blog_index() {
|
|||||||
|
|
||||||
function _add_blog_list_to_index() {
|
function _add_blog_list_to_index() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Let's find the file 'index.qst' and add the blog if blog_in_index is true
|
# Let's find the file 'index.qst' and add the blog if blog_in_index is true
|
||||||
if (${debug}) _msg debug "_add_blog_list_to_index: Inserting blog list to index.html"
|
if (${debug}) _msg debug "_add_blog_list_to_index: Inserting blog list to index.html"
|
||||||
@ -953,12 +899,7 @@ function _add_blog_list_to_index() {
|
|||||||
|
|
||||||
function _sitemap() {
|
function _sitemap() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file.
|
# Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file.
|
||||||
if [[ ${sitemap} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] ); then
|
if [[ ${sitemap} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] ); then
|
||||||
@ -1007,12 +948,7 @@ function _sitemap() {
|
|||||||
function _link() {
|
function _link() {
|
||||||
# This converts #link tags to actual clickable links in a provided string
|
# This converts #link tags to actual clickable links in a provided string
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
local content="${1}"
|
local content="${1}"
|
||||||
local modified_content=""
|
local modified_content=""
|
||||||
@ -1050,12 +986,7 @@ function _link() {
|
|||||||
function _image() {
|
function _image() {
|
||||||
# This replaces #showimg tags with actual HTML img tags in a provided string
|
# This replaces #showimg tags with actual HTML img tags in a provided string
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
local content="${1}"
|
local content="${1}"
|
||||||
local modified_content=""
|
local modified_content=""
|
||||||
@ -1095,12 +1026,7 @@ function _image() {
|
|||||||
function _youtube() {
|
function _youtube() {
|
||||||
# This embeds a YouTube video in a provided string
|
# This embeds a YouTube video in a provided string
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
local content="${1}"
|
local content="${1}"
|
||||||
local modified_content=""
|
local modified_content=""
|
||||||
@ -1128,12 +1054,7 @@ function _youtube() {
|
|||||||
function _cleanup() {
|
function _cleanup() {
|
||||||
# This removes tags used in the templates that may be left over for some reason
|
# This removes tags used in the templates that may be left over for some reason
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
local content="${1}"
|
local content="${1}"
|
||||||
|
|
||||||
@ -1155,12 +1076,7 @@ function _cleanup() {
|
|||||||
|
|
||||||
function _html() {
|
function _html() {
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
local content="${1}"
|
local content="${1}"
|
||||||
|
|
||||||
@ -1220,12 +1136,7 @@ function _zhtml() {
|
|||||||
|
|
||||||
# This function uses the regex module from Zsh to parse the QStags
|
# This function uses the regex module from Zsh to parse the QStags
|
||||||
|
|
||||||
if [[ ${globaldebug} == "true" ]]; then
|
local debug=${globaldebug:-false}
|
||||||
local debug=true
|
|
||||||
else
|
|
||||||
# If you want to debug this function only, set this to true
|
|
||||||
local debug=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
local content="${1}"
|
local content="${1}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user