_pages: Rearrange some stuff

This commit is contained in:
Stig-Ørjan Smelror 2024-02-02 10:55:39 +01:00
parent 042d5b217b
commit ececfbcb59

14
qsgen2
View File

@ -417,11 +417,6 @@ function _pages() {
if (${debug}) _msg debug "_pages: Running engine on ${pages_in_array}" if (${debug}) _msg debug "_pages: Running engine on ${pages_in_array}"
if [[ ${file_ext} == "tpl" ]]; then if [[ ${file_ext} == "tpl" ]]; then
local page_content=$( ${engine} "$page_content" ) local page_content=$( ${engine} "$page_content" )
elif [[ ${file_ext} == "md" ]]; then
local page_content=$(echo "$page_content" | ${engine})
#echo "$page_content"
#exit
fi
# Look for links, images and videos and convert them if present. # Look for links, images and videos and convert them if present.
if (${debug}) _msg debug "_pages: Checking for #link, #showimg and #ytvideo in page_content" if (${debug}) _msg debug "_pages: Checking for #link, #showimg and #ytvideo in page_content"
@ -437,9 +432,14 @@ function _pages() {
if (${debug}) _msg debug "_pages: #ytvideo is present, run _youtube: page_content" if (${debug}) _msg debug "_pages: #ytvideo is present, run _youtube: page_content"
local page_content=$( _youtube "${page_content}" ) local page_content=$( _youtube "${page_content}" )
fi fi
elif [[ ${file_ext} == "md" ]]; then
local page_content=$(echo "$page_content" | ${engine})
#echo "$page_content"
#exit
fi
# Let's find the file 'index.tpl' and add the blog if blog_in_index is true # Let's find the file 'index.tpl' and add the blog if blog_in_index is true
if [[ ${pages_in_array} == "index.tpl" ]] && [[ ${blog_in_index} == "true" ]]; then if [[ ${pages_in_array} == "index.${file_ext}" ]] && [[ ${blog_in_index} == "true" ]]; then
if (${debug}) _msg debug "_pages: Inserting blog list to index.html" if (${debug}) _msg debug "_pages: Inserting blog list to index.html"
local blog_index_list=$(<${project_dir}/blog/index.tmp.html) local blog_index_list=$(<${project_dir}/blog/index.tmp.html)
echo ${blog_index_list} >> ${page_content} echo ${blog_index_list} >> ${page_content}
@ -448,7 +448,7 @@ function _pages() {
# 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}) _msg debug "_pages: Replacing BODY with page_content in pages_tpl using Perl" if (${debug}) _msg debug "_pages: Replacing BODY with page_content in pages_tpl using Perl"
# Use Perl for multi-line and special character handling # Use Perl for multi-line and special character handling
local pages_tpl=$( echo "${pages_tpl}" | sed -e "s|BODY|\"${page_content}\"|" ) local pages_tpl=$( echo "${pages_tpl}" | sed -e "s|BODY|${page_content}|" )
# Replace every #pagetitle in pages_tpl # Replace every #pagetitle in pages_tpl
if (${debug}) _msg debug "_pages: Replacing #pagetitle in pages_tpl" if (${debug}) _msg debug "_pages: Replacing #pagetitle in pages_tpl"