Within Write-TemplateItem you are using -Replace parameter to perform string replacement of the
placeholders and subsequent string values.
When ingesting large scripts with regex within them (using a scriptblock from a manifest), PowerShell malforms the replacement string, causing the template to be applied twitch within it. If this statement is only performing a string replacement and not requiring regex, can you please adjust to code to use the .Replace method instead?
PS I have encountered this issue with plaster as well.
foreach ($param in $Item.ContentParameterScript)
{
$text = $text -replace "$($identifier)!$([regex]::Escape($param))!$($identifier)", $ParameterScript[$param]
}
Proposed Replacement:
foreach ($param in $Item.ContentParameterScript)
{
$text = $text.Replace("$($identifier)!$([regex]::Escape($param))!$($identifier)", $ParameterScript[$param])
}
I can confirm that it is working correctly. (I may have made the adjustment to your psm1 locally. :-D :-D)
Within Write-TemplateItem you are using -Replace parameter to perform string replacement of the
placeholders and subsequent string values.
When ingesting large scripts with regex within them (using a scriptblock from a manifest), PowerShell malforms the replacement string, causing the template to be applied twitch within it. If this statement is only performing a string replacement and not requiring regex, can you please adjust to code to use the .Replace method instead?
PS I have encountered this issue with plaster as well.
Proposed Replacement:
I can confirm that it is working correctly. (I may have made the adjustment to your psm1 locally. :-D :-D)