Skip to content

Commit 156238d

Browse files
author
James Brundage
committed
Adding Transpilers README.ps1.md
1 parent 0e9e383 commit 156238d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Transpilers/README.ps1.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
This directory and it's subdirectories contain the Transpilers that ship with PipeScript.
2+
3+
Transpilers should have the extension ```.psx.ps1```
4+
5+
Any other module can define it's own Transpilers.
6+
7+
All the module needs to do for the transpilers to be recognized by PipeScript is add PipeScript to the ```.PrivateData.PSData.Tags``` section of the module's manifest file.
8+
9+
This directory includes uncategorized or 'common' transpilers.
10+
11+
~~~PipeScript{
12+
13+
[PSCustomObject]@{
14+
Table = Get-Transpiler -TranspilerPath $pwd |
15+
Where-Object Path -Match ([regex]::escape($pwd) + "[\\/][^\\/]+$") |
16+
Select-Object DisplayName, Synopsis, @{
17+
Name='Link'
18+
Expression = { $_.Name }
19+
}
20+
}}
21+
~~~
22+
23+
### Examples
24+
25+
~~~PipeScript{
26+
@(foreach ($transpiler in Get-Transpiler -TranspilerPath $pwd |
27+
Where-Object Path -Match ([regex]::escape($pwd) + "[\\/][^\\/]+$")) {
28+
$examples = @($transpiler.Examples)
29+
if (-not $examples) { continue }
30+
for ($exampleNumber = 1; $exampleNumber -le $examples.Length; $exampleNumber++) {
31+
@("#### $($transpiler.DisplayName) Example $($exampleNumber)",
32+
[Environment]::Newline,
33+
"~~~PowerShell",
34+
$examples[$exampleNumber - 1],
35+
"~~~") -join [Environment]::Newline
36+
}
37+
}) -join ([Environment]::Newline * 2)
38+
}
39+
~~~
40+
41+
42+

0 commit comments

Comments
 (0)