Skip to content

Commit 86039ae

Browse files
StartAutomatingStartAutomating
authored andcommitted
Adding PS1XML Transpiler (Fixes #414)
Also, renaming .SaveTemplate to .Save and restricting XML template
1 parent 7c53edf commit 86039ae

1 file changed

Lines changed: 0 additions & 54 deletions

File tree

docs/XML.Template.md

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,60 +20,6 @@ Multiline comments blocks like this ```<!--{}-->``` will be treated as blocks of
2020

2121

2222

23-
---
24-
25-
26-
### Examples
27-
#### EXAMPLE 1
28-
```PowerShell
29-
$typesFile, $typeDefinition, $scriptMethod = Invoke-PipeScript {
30-
```
31-
types.ps1xml template '
32-
<Types>
33-
<!--{param([Alias("TypeDefinition")]$TypeDefinitions) $TypeDefinitions }-->
34-
</Types>
35-
'
36-
37-
typeDefinition.ps1xml template '
38-
<Type>
39-
<!--{param([Alias("PSTypeName")]$TypeName) "<Name>$($typename)</Name>" }-->
40-
<!--{param([Alias("PSMembers","Member")]$Members) "<Members>$($members)</Members>" }-->
41-
</Type>
42-
'
43-
44-
scriptMethod.ps1xml template '
45-
<ScriptMethod>
46-
<!--{param([Alias("Name")]$MethodName) "<Name>$($MethodName)</Name>" }-->
47-
<!--{param([ScriptBlock]$MethodDefinition) "<Script>$([Security.SecurityElement]::Escape("$MethodDefinition"))</Script>" }-->
48-
</ScriptMethod>
49-
'
50-
}
51-
52-
53-
$typesFile.Save("Test.types.ps1xml",
54-
$typeDefinition.Evaluate(@{
55-
TypeName='foobar'
56-
Members =
57-
@($scriptMethod.Evaluate(
58-
@{
59-
MethodName = 'foo'
60-
MethodDefinition = {"foo"}
61-
}
62-
),$scriptMethod.Evaluate(
63-
@{
64-
MethodName = 'bar'
65-
MethodDefinition = {"bar"}
66-
}
67-
),$scriptMethod.Evaluate(
68-
@{
69-
MethodName = 'baz'
70-
MethodDefinition = {"baz"}
71-
}
72-
))
73-
})
74-
)
75-
76-
7723
---
7824

7925

0 commit comments

Comments
 (0)