From 8a1d42e043bef9ddbb8fa6eb0efc1886383a40fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Fri, 2 Feb 2024 11:06:21 +0100 Subject: [PATCH] _pages: Let's try awk to replace BODY --- qsgen2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qsgen2 b/qsgen2 index 193b8a9..9808201 100755 --- a/qsgen2 +++ b/qsgen2 @@ -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"