diff options
| author | gentoo90 <gentoo90@gmail.com> | 2013-04-19 21:50:38 +0300 |
|---|---|---|
| committer | gentoo90 <gentoo90@gmail.com> | 2013-04-19 21:50:38 +0300 |
| commit | d0166615eef115dbea294d9f9442e0f78334167a (patch) | |
| tree | 683713b07423e332b0a4979031e96f09a106cb3c /tests/examplefiles | |
| parent | 7d58dcb21438f9231dd9cbf58cca50141ef59214 (diff) | |
| download | pygments-d0166615eef115dbea294d9f9442e0f78334167a.tar.gz | |
PowerShellLexer: more fixes
* '$(...)' blocks inside double quoted strings and here-strings now highlighted as code
* Here-strings can't be nested directly. Only inside '$(...)' block
* Add new example with here-strings
* Add 'throw' keyword
* Remove redundant code
Diffstat (limited to 'tests/examplefiles')
| -rw-r--r-- | tests/examplefiles/Get-CommandDefinitionHtml.ps1 | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/examplefiles/Get-CommandDefinitionHtml.ps1 b/tests/examplefiles/Get-CommandDefinitionHtml.ps1 new file mode 100644 index 00000000..b181955f --- /dev/null +++ b/tests/examplefiles/Get-CommandDefinitionHtml.ps1 @@ -0,0 +1,66 @@ +
+function Get-CommandDefinitionHtml {
+
+ # this tells powershell to allow advanced features,
+ # like the [validatenotnullorempty()] attribute below.
+ [CmdletBinding()]
+ param(
+ [ValidateNotNullOrEmpty()]
+ [string]$name
+ )
+
+ $command = get-command $name
+
+ # Look mom! I'm a cmdlet!
+ $PSCmdlet.WriteVerbose("Dumping HTML for " + $command)
+
+@"
+ <html>
+ <head>
+ <title>$($command.name)</title>
+ </head>
+ <body>
+ <table border="1">
+$(
+ $command.parametersets | % {
+@"
+
+ <tr>
+ <td>$($_.name)</td>
+ <td>
+ <table border="1">
+ <tr>
+ <th colspan="8">Parameters</th>
+
+$(
+ $count = 0
+ $_.parameters | % {
+ if (0 -eq ($count % 8)) {
+@'
+ </tr>
+ <tr>
+'@
+ }
+@"
+ <td>$($_.name)</td>
+"@
+ $count++
+ }
+)
+ </tr>
+ </table>
+ </td>
+ </tr>
+"@
+ }
+)
+ </table>
+ </body>
+ </html>
+"@
+}
+
+Get-CommandDefinitionHtml get-item > out.html
+
+# show in browser
+invoke-item out.html
|
