syntax-highlighter-rails 3.0.83
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +49 -0
- data/Rakefile +1 -0
- data/lib/syntax/highlighter/rails.rb +10 -0
- data/lib/syntax/highlighter/rails/version.rb +7 -0
- data/syntax-highlighter-rails.gemspec +22 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shAutoloader.js +122 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushAS3.js +43 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushAppleScript.js +84 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushBash.js +59 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushCSharp.js +49 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushColdFusion.js +84 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushCpp.js +97 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushCss.js +75 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushDelphi.js +39 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushDiff.js +25 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushErlang.js +36 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushGroovy.js +51 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushHaxe.js +64 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushJScript.js +36 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushJava.js +41 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushJavaFX.js +42 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushPerl.js +80 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushPhp.js +72 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushPlain.js +17 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushPowerShell.js +59 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushPython.js +48 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushRuby.js +39 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushSass.js +83 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushScala.js +35 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushSql.js +51 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushTAP.js +46 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushTypeScript.js +39 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushVb.js +40 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shBrushXml.js +55 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shCore.js +17 -0
- data/vendor/assets/javascripts/syntax-highlighter-rails/shLegacy.js +141 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/_theme_template.scss +129 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCore.scss +216 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreDefault.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreDjango.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreEclipse.css +230 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreEclipse.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreEmacs.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreFadeToGrey.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreMDUltra.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreMidnight.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shCoreRDark.scss +2 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeDefault.scss +7 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeDjango.scss +36 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeEclipse.scss +48 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeEmacs.scss +32 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeFadeToGrey.scss +36 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeMDUltra.scss +32 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeMidnight.scss +32 -0
- data/vendor/assets/stylesheets/syntax-highlighter-rails/shThemeRDark.scss +32 -0
- metadata +126 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 ophilbert
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Syntax-Highlighter-Rails
|
2
|
+
|
3
|
+
A rails gem to display your code properly on webpages using [SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/ "SyntaxHighlighter")
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'syntax-highlighter-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install syntax-highlighter-rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
To highlight a code snippet (cpp for example) symply use the tag :
|
22
|
+
```html
|
23
|
+
<pre class="brush: cpp">
|
24
|
+
// Your code here
|
25
|
+
</pre>
|
26
|
+
```
|
27
|
+
|
28
|
+
Add the following to a javascript file :
|
29
|
+
|
30
|
+
```javascript
|
31
|
+
//= require syntax-highlighter-rails/shCore
|
32
|
+
//= require syntax-highlighter-rails/shBrushCpp
|
33
|
+
```
|
34
|
+
|
35
|
+
Available brushes can be found [here](http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ "Available brushes")
|
36
|
+
|
37
|
+
In your page, don't forget to call :
|
38
|
+
```javascript
|
39
|
+
SyntaxHighlighter.all()
|
40
|
+
```
|
41
|
+
|
42
|
+
Add the following to one of your css files :
|
43
|
+
|
44
|
+
```css
|
45
|
+
*= require syntax-highlighter-rails/shCore
|
46
|
+
*= require syntax-highlighter-rails/shThemeDefault
|
47
|
+
```
|
48
|
+
|
49
|
+
Note : You can modify the theme by replacing shThemeDefault by [one of the following](http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/ "Available themes")
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'syntax/highlighter/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "syntax-highlighter-rails"
|
8
|
+
spec.version = Syntax::Highlighter::Rails::VERSION
|
9
|
+
spec.authors = ["Olivier Philbert"]
|
10
|
+
spec.email = ["olivier@philbert.fr"]
|
11
|
+
spec.description = %q"A rails gem to display your code properly on webpages using syntaxHighlighter"
|
12
|
+
spec.summary = %q"A rails gem to display your code properly on webpages using syntaxHighlighter"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "railties", "~> 3.1"
|
22
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
var sh = SyntaxHighlighter;
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Provides functionality to dynamically load only the brushes that a needed to render the current page.
|
7
|
+
*
|
8
|
+
* There are two syntaxes that autoload understands. For example:
|
9
|
+
*
|
10
|
+
* SyntaxHighlighter.autoloader(
|
11
|
+
* [ 'applescript', 'Scripts/shBrushAppleScript.js' ],
|
12
|
+
* [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ]
|
13
|
+
* );
|
14
|
+
*
|
15
|
+
* or a more easily comprehendable one:
|
16
|
+
*
|
17
|
+
* SyntaxHighlighter.autoloader(
|
18
|
+
* 'applescript Scripts/shBrushAppleScript.js',
|
19
|
+
* 'actionscript3 as3 Scripts/shBrushAS3.js'
|
20
|
+
* );
|
21
|
+
*/
|
22
|
+
sh.autoloader = function()
|
23
|
+
{
|
24
|
+
var list = arguments,
|
25
|
+
elements = sh.findElements(),
|
26
|
+
brushes = {},
|
27
|
+
scripts = {},
|
28
|
+
all = SyntaxHighlighter.all,
|
29
|
+
allCalled = false,
|
30
|
+
allParams = null,
|
31
|
+
i
|
32
|
+
;
|
33
|
+
|
34
|
+
SyntaxHighlighter.all = function(params)
|
35
|
+
{
|
36
|
+
allParams = params;
|
37
|
+
allCalled = true;
|
38
|
+
};
|
39
|
+
|
40
|
+
function addBrush(aliases, url)
|
41
|
+
{
|
42
|
+
for (var i = 0; i < aliases.length; i++)
|
43
|
+
brushes[aliases[i]] = url;
|
44
|
+
};
|
45
|
+
|
46
|
+
function getAliases(item)
|
47
|
+
{
|
48
|
+
return item.pop
|
49
|
+
? item
|
50
|
+
: item.split(/\s+/)
|
51
|
+
;
|
52
|
+
}
|
53
|
+
|
54
|
+
// create table of aliases and script urls
|
55
|
+
for (i = 0; i < list.length; i++)
|
56
|
+
{
|
57
|
+
var aliases = getAliases(list[i]),
|
58
|
+
url = aliases.pop()
|
59
|
+
;
|
60
|
+
|
61
|
+
addBrush(aliases, url);
|
62
|
+
}
|
63
|
+
|
64
|
+
// dynamically add <script /> tags to the document body
|
65
|
+
for (i = 0; i < elements.length; i++)
|
66
|
+
{
|
67
|
+
var url = brushes[elements[i].params.brush];
|
68
|
+
|
69
|
+
if(url && scripts[url] === undefined)
|
70
|
+
{
|
71
|
+
if(elements[i].params['html-script'] === 'true')
|
72
|
+
{
|
73
|
+
if(scripts[brushes['xml']] === undefined) {
|
74
|
+
loadScript(brushes['xml']);
|
75
|
+
scripts[url] = false;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
scripts[url] = false;
|
80
|
+
loadScript(url);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
function loadScript(url)
|
85
|
+
{
|
86
|
+
var script = document.createElement('script'),
|
87
|
+
done = false
|
88
|
+
;
|
89
|
+
|
90
|
+
script.src = url;
|
91
|
+
script.type = 'text/javascript';
|
92
|
+
script.language = 'javascript';
|
93
|
+
script.onload = script.onreadystatechange = function()
|
94
|
+
{
|
95
|
+
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete'))
|
96
|
+
{
|
97
|
+
done = true;
|
98
|
+
scripts[url] = true;
|
99
|
+
checkAll();
|
100
|
+
|
101
|
+
// Handle memory leak in IE
|
102
|
+
script.onload = script.onreadystatechange = null;
|
103
|
+
script.parentNode.removeChild(script);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
// sync way of adding script tags to the page
|
108
|
+
document.body.appendChild(script);
|
109
|
+
};
|
110
|
+
|
111
|
+
function checkAll()
|
112
|
+
{
|
113
|
+
for(var url in scripts)
|
114
|
+
if (scripts[url] == false)
|
115
|
+
return;
|
116
|
+
|
117
|
+
if (allCalled)
|
118
|
+
SyntaxHighlighter.highlight(allParams);
|
119
|
+
};
|
120
|
+
};
|
121
|
+
|
122
|
+
})();
|
@@ -0,0 +1,43 @@
|
|
1
|
+
;(function()
|
2
|
+
{
|
3
|
+
// CommonJS
|
4
|
+
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
|
5
|
+
|
6
|
+
function Brush()
|
7
|
+
{
|
8
|
+
// Created by Peter Atoria @ http://iAtoria.com
|
9
|
+
|
10
|
+
var inits = 'class interface function package';
|
11
|
+
|
12
|
+
var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
|
13
|
+
'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
|
14
|
+
'extends false final finally flash_proxy for get if implements import in include Infinity ' +
|
15
|
+
'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
|
16
|
+
'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
|
17
|
+
'return set static String super switch this throw true try typeof uint undefined unescape ' +
|
18
|
+
'use void while with'
|
19
|
+
;
|
20
|
+
|
21
|
+
this.regexList = [
|
22
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
23
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
24
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
25
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
26
|
+
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
27
|
+
{ regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
|
28
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
29
|
+
{ regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
|
30
|
+
{ regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
|
31
|
+
];
|
32
|
+
|
33
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
|
34
|
+
};
|
35
|
+
|
36
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
37
|
+
Brush.aliases = ['actionscript3', 'as3'];
|
38
|
+
|
39
|
+
SyntaxHighlighter.brushes.AS3 = Brush;
|
40
|
+
|
41
|
+
// CommonJS
|
42
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
43
|
+
})();
|
@@ -0,0 +1,84 @@
|
|
1
|
+
;(function()
|
2
|
+
{
|
3
|
+
// CommonJS
|
4
|
+
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
|
5
|
+
|
6
|
+
function Brush()
|
7
|
+
{
|
8
|
+
// AppleScript brush by David Chambers
|
9
|
+
// http://davidchambersdesign.com/
|
10
|
+
var keywords = 'after before beginning continue copy each end every from return get global in local named of set some that the then times to where whose with without';
|
11
|
+
var ordinals = 'first second third fourth fifth sixth seventh eighth ninth tenth last front back middle';
|
12
|
+
var specials = 'activate add alias ask attachment boolean class constant delete duplicate empty exists id integer list make message modal modified new no pi properties quit real record remove rest result reveal reverse run running save string word yes';
|
13
|
+
|
14
|
+
this.regexList = [
|
15
|
+
|
16
|
+
{ regex: /(--|#).*$/gm,
|
17
|
+
css: 'comments' },
|
18
|
+
|
19
|
+
{ regex: /\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/gm, // support nested comments
|
20
|
+
css: 'comments' },
|
21
|
+
|
22
|
+
{ regex: /"[\s\S]*?"/gm,
|
23
|
+
css: 'string' },
|
24
|
+
|
25
|
+
{ regex: /(?:,|:|¬|'s\b|\(|\)|\{|\}|«|\b\w*»)/g, // operators
|
26
|
+
css: 'color1' },
|
27
|
+
|
28
|
+
{ regex: /(-)?(\d)+(\.(\d)?)?(E\+(\d)+)?/g, // numbers
|
29
|
+
css: 'color1' },
|
30
|
+
|
31
|
+
{ regex: /(?:&(amp;|gt;|lt;)?|=|� |>|<|≥|>=|≤|<=|\*|\+|-|\/|÷|\^)/g,
|
32
|
+
css: 'color2' },
|
33
|
+
|
34
|
+
{ regex: /\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/g,
|
35
|
+
css: 'keyword' },
|
36
|
+
|
37
|
+
{ regex: /\b\d+(st|nd|rd|th)\b/g, // ordinals
|
38
|
+
css: 'keyword' },
|
39
|
+
|
40
|
+
{ regex: /\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/g,
|
41
|
+
css: 'color3' },
|
42
|
+
|
43
|
+
{ regex: /\b(?:adding folder items to|after receiving|clipboard info|set the clipboard to|(the )?clipboard|entire contents|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|return(ed)?|second(?! item)(s)?|list (disks|folder)|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|starting at|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/g,
|
44
|
+
css: 'color4' },
|
45
|
+
|
46
|
+
{ regex: /\b(?:tracks|paragraph|text item(s)?)\b/g,
|
47
|
+
css: 'classes' },
|
48
|
+
|
49
|
+
{ regex: /\b(?:AppleScript|album|video kind|grouping|length|text item delimiters|quoted form|POSIX path(?= of))\b/g,
|
50
|
+
css: 'properties' },
|
51
|
+
|
52
|
+
{ regex: /\b(?:run|exists|count)\b/g,
|
53
|
+
css: 'commandNames' },
|
54
|
+
|
55
|
+
{ regex: /\b(?:POSIX (file|path))\b/g,
|
56
|
+
css: 'additionClasses' },
|
57
|
+
|
58
|
+
{ regex: /\b(?:message|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|regexp|string result|using( delimiters)?|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor))\b/g,
|
59
|
+
css: 'additionParameterNames' },
|
60
|
+
|
61
|
+
{ regex: /\b(?:display(ing| (alert|dialog|mode))?|choose( ((remote )?application|color|folder|from list|URL))?|(do( shell)?|load|run|store) script|re_compile|find text)\b/g,
|
62
|
+
css: 'additionCommandNames' },
|
63
|
+
|
64
|
+
{ regex: /\b(?:xxx)\b/g,
|
65
|
+
css: 'parameterNames' },
|
66
|
+
|
67
|
+
{ regex: /\b(?:true|false|none)\b/g,
|
68
|
+
css: 'enumeratedValues' },
|
69
|
+
|
70
|
+
|
71
|
+
{ regex: new RegExp(this.getKeywords(specials), 'gm'), css: 'color3' },
|
72
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
|
73
|
+
{ regex: new RegExp(this.getKeywords(ordinals), 'gm'), css: 'keyword' }
|
74
|
+
];
|
75
|
+
};
|
76
|
+
|
77
|
+
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
78
|
+
Brush.aliases = ['applescript'];
|
79
|
+
|
80
|
+
SyntaxHighlighter.brushes.AppleScript = Brush;
|
81
|
+
|
82
|
+
// CommonJS
|
83
|
+
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
84
|
+
})();
|
@@ -0,0 +1,59 @@
|
|
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'
|
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
|
+
})();
|