Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduces the new variable PLASTER_TemplateSource #316

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/InvokePlaster.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,8 @@ function Invoke-Plaster {

# Eval script expression delimiters
if ($content -and ($content.Count -gt 0)) {
# Sets the Variable to the currently used template
Set-Variable -Name PLASTER_TemplateFileSource -Value $srcPath -Scope Script
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this doesn't work "as-is" because setting a variable in this runspace doesn't help since the template file is processed in a constrained runspace. The variable needs to be set there. I'll noodle on this some as I really like the idea of providing this info inside a template file.

$newContent = [regex]::Replace($content, '(<%=)(.*?)(%>)', {
param($match)
$expr = $match.groups[2].value
Expand Down