1;(function() 2{ 3 // CommonJS 4 SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 5 6 function Brush() 7 { 8 function hereDocProcess(match, regexInfo) 9 { 10 var constructor = SyntaxHighlighter.Match, 11 result = [] 12 ; 13 if (match.here_doc != null) 14 result.push(new constructor(match.here_doc, match.index + match[0].indexOf(match.here_doc), 'string')); 15 16 if (match.full_tag != null) 17 result.push(new constructor(match.full_tag, match.index, 'preprocessor')); 18 19 if (match.end_tag != null) 20 result.push(new constructor(match.end_tag, match.index + match[0].lastIndexOf(match.end_tag), 'preprocessor')); 21 return result; 22 } 23 var keywords = 'if fi then elif else for do done until while break continue case esac function return in eq ne ge le'; 24 var commands = 'alias apropos awk basename base64 bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + 25 'cksum clear cmp comm command cp cron crontab crypt csplit cut date dc dd ddrescue declare df ' + 26 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + 27 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + 28 'free fsck ftp gawk gcc gdb getconf getopts grep groups gzip hash head history hostname id ifconfig ' + 29 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + 30 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + 31 'mv nasm nc ndisasm netstat nice nl nohup nslookup objdump od open op passwd paste pathchk ping popd pr printcap ' + 32 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + 33 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + 34 'sleep sort source split ssh strace strings su sudo sum symlink sync tail tar tee test time ' + 35 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + 36 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + 37 'vi watch wc whereis which who whoami Wget xargs xxd yes chsh' 38 ; 39 40 this.regexList = [ 41 { regex: /^#!.*$/gm, css: 'preprocessor bold' }, 42 { regex: /\/[\w-\/]+/gm, css: 'plain' }, 43 { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 44 { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 45 { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 46 { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 47 { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' }, // commands 48 { regex: new XRegExp("(?<full_tag>(<|<){2}(?<tag>\\w+)) .*$(?<here_doc>[\\s\\S]*)(?<end_tag>^\\k<tag>$)",'gm'), func: hereDocProcess } 49 ]; 50 } 51 52 Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 Brush.aliases = ['bash', 'shell', 'sh']; 54 55 SyntaxHighlighter.brushes.Bash = Brush; 56 57 // CommonJS 58 typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59})(); 60