| 1 | /** |
|---|
| 2 | * SyntaxHighlighter |
|---|
| 3 | * http://alexgorbatchev.com/SyntaxHighlighter |
|---|
| 4 | * |
|---|
| 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. |
|---|
| 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html |
|---|
| 7 | * |
|---|
| 8 | * @version |
|---|
| 9 | * 3.0.83 (July 02 2010) |
|---|
| 10 | * |
|---|
| 11 | * @copyright |
|---|
| 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. |
|---|
| 13 | * |
|---|
| 14 | * @license |
|---|
| 15 | * Dual licensed under the MIT and GPL licenses. |
|---|
| 16 | */ |
|---|
| 17 | ;(function() |
|---|
| 18 | { |
|---|
| 19 | // CommonJS |
|---|
| 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; |
|---|
| 21 | |
|---|
| 22 | function Brush() |
|---|
| 23 | { |
|---|
| 24 | // Contributes by B.v.Zanten, Getronics |
|---|
| 25 | // http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro |
|---|
| 26 | |
|---|
| 27 | var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' + |
|---|
| 28 | 'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' + |
|---|
| 29 | 'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' + |
|---|
| 30 | 'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' + |
|---|
| 31 | 'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' + |
|---|
| 32 | 'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' + |
|---|
| 33 | 'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' + |
|---|
| 34 | 'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' + |
|---|
| 35 | 'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' + |
|---|
| 36 | 'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' + |
|---|
| 37 | 'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' + |
|---|
| 38 | 'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' + |
|---|
| 39 | 'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' + |
|---|
| 40 | 'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' + |
|---|
| 41 | 'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' + |
|---|
| 42 | 'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' + |
|---|
| 43 | 'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' + |
|---|
| 44 | 'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' + |
|---|
| 45 | 'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' + |
|---|
| 46 | 'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' + |
|---|
| 47 | 'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning'; |
|---|
| 48 | var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' + |
|---|
| 49 | 'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' + |
|---|
| 50 | 'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' + |
|---|
| 51 | 'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' + |
|---|
| 52 | 'spps spsv sv tee cat cd cp h history kill lp ls ' + |
|---|
| 53 | 'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' + |
|---|
| 54 | 'erase rd ren type % \\?'; |
|---|
| 55 | |
|---|
| 56 | this.regexList = [ |
|---|
| 57 | { regex: /#.*$/gm, css: 'comments' }, // one line comments |
|---|
| 58 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1 |
|---|
| 59 | { regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq |
|---|
| 60 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings |
|---|
| 61 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings |
|---|
| 62 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' }, |
|---|
| 63 | { regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' } |
|---|
| 64 | ]; |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | Brush.prototype = new SyntaxHighlighter.Highlighter(); |
|---|
| 68 | Brush.aliases = ['powershell', 'ps']; |
|---|
| 69 | |
|---|
| 70 | SyntaxHighlighter.brushes.PowerShell = Brush; |
|---|
| 71 | |
|---|
| 72 | // CommonJS |
|---|
| 73 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; |
|---|
| 74 | })(); |
|---|