PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/Scripts/syntaxhighlighter/shBrushPowerShell.js

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