_pages: Let's try awk to replace BODY

This commit is contained in:
Stig-Ørjan Smelror 2024-02-02 11:06:21 +01:00
parent ac8dfd81f9
commit 8a1d42e043

2
qsgen2
View File

@ -448,7 +448,7 @@ function _pages() {
# 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=$( echo "${pages_tpl}" | sed --debug -e "s^BODY^${page_content}^" )
local pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") )
# Replace every #pagetitle in pages_tpl
if (${debug}) _msg debug "_pages: Replacing #pagetitle in pages_tpl"