_pages: Ugh, deleted the BODY replacement
This commit is contained in:
parent
5a2b551ef9
commit
bb08f87ec3
6
qsgen2
6
qsgen2
@ -418,7 +418,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" )
|
||||||
|
|
||||||
# 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"
|
||||||
if [[ $( echo ${page_content} | grep \#link ) ]]; then
|
if [[ $( echo ${page_content} | grep \#link ) ]]; then
|
||||||
@ -437,6 +436,11 @@ function _pages() {
|
|||||||
local page_content=$(echo "$page_content" | ${engine})
|
local page_content=$(echo "$page_content" | ${engine})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
# Use Perl for multi-line and special character handling
|
||||||
|
local pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") )
|
||||||
|
|
||||||
# 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"
|
||||||
local pages_tpl=$( echo ${pages_tpl} | perl -pe "s|#pagetitle|${page_title}|gs" )
|
local pages_tpl=$( echo ${pages_tpl} | perl -pe "s|#pagetitle|${page_title}|gs" )
|
||||||
|
Loading…
Reference in New Issue
Block a user