trainbbcode 0.2.7 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +44 -0
- data/Rakefile +2 -1
- data/init.rb +1 -0
- data/lib/trainbbcode.rb +66 -29
- data/rails_generators/syntaxhighlighter/syntaxhighlighter_generator.rb +30 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/clipboard.swf +0 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushAS3.js +61 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushBash.js +66 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushCSharp.js +67 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushColdFusion.js +102 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushCpp.js +99 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushCss.js +93 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushDelphi.js +57 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushDiff.js +43 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushErlang.js +54 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushGroovy.js +69 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushJScript.js +52 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushJava.js +59 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushJavaFX.js +60 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPerl.js +74 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPhp.js +91 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPlain.js +35 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPowerShell.js +76 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushPython.js +66 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushRuby.js +57 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushScala.js +53 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushSql.js +68 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushVb.js +58 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shBrushXml.js +71 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shCore.js +30 -0
- data/rails_generators/syntaxhighlighter/templates/scripts/shLegacy.js +30 -0
- data/rails_generators/syntaxhighlighter/templates/src/shCore.js +2077 -0
- data/rails_generators/syntaxhighlighter/templates/src/shLegacy.js +172 -0
- data/rails_generators/syntaxhighlighter/templates/styles/help.png +0 -0
- data/rails_generators/syntaxhighlighter/templates/styles/magnifier.png +0 -0
- data/rails_generators/syntaxhighlighter/templates/styles/page_white_code.png +0 -0
- data/rails_generators/syntaxhighlighter/templates/styles/page_white_copy.png +0 -0
- data/rails_generators/syntaxhighlighter/templates/styles/printer.png +0 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shCore.css +330 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeDefault.css +173 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeDjango.css +176 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeEclipse.css +190 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeEmacs.css +175 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeFadeToGrey.css +177 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeMidnight.css +175 -0
- data/rails_generators/syntaxhighlighter/templates/styles/shThemeRDark.css +175 -0
- data/trainbbcode.gemspec +6 -3
- metadata +56 -4
data/Manifest
CHANGED
@@ -1,4 +1,48 @@
|
|
1
1
|
Manifest
|
2
2
|
README.rdoc
|
3
3
|
Rakefile
|
4
|
+
init.rb
|
4
5
|
lib/trainbbcode.rb
|
6
|
+
rails_generators/syntaxhighlighter/syntaxhighlighter_generator.rb
|
7
|
+
rails_generators/syntaxhighlighter/templates/scripts/clipboard.swf
|
8
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushAS3.js
|
9
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushBash.js
|
10
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushCSharp.js
|
11
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushColdFusion.js
|
12
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushCpp.js
|
13
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushCss.js
|
14
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushDelphi.js
|
15
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushDiff.js
|
16
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushErlang.js
|
17
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushGroovy.js
|
18
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushJScript.js
|
19
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushJava.js
|
20
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushJavaFX.js
|
21
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushPerl.js
|
22
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushPhp.js
|
23
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushPlain.js
|
24
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushPowerShell.js
|
25
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushPython.js
|
26
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushRuby.js
|
27
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushScala.js
|
28
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushSql.js
|
29
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushVb.js
|
30
|
+
rails_generators/syntaxhighlighter/templates/scripts/shBrushXml.js
|
31
|
+
rails_generators/syntaxhighlighter/templates/scripts/shCore.js
|
32
|
+
rails_generators/syntaxhighlighter/templates/scripts/shLegacy.js
|
33
|
+
rails_generators/syntaxhighlighter/templates/src/shCore.js
|
34
|
+
rails_generators/syntaxhighlighter/templates/src/shLegacy.js
|
35
|
+
rails_generators/syntaxhighlighter/templates/styles/help.png
|
36
|
+
rails_generators/syntaxhighlighter/templates/styles/magnifier.png
|
37
|
+
rails_generators/syntaxhighlighter/templates/styles/page_white_code.png
|
38
|
+
rails_generators/syntaxhighlighter/templates/styles/page_white_copy.png
|
39
|
+
rails_generators/syntaxhighlighter/templates/styles/printer.png
|
40
|
+
rails_generators/syntaxhighlighter/templates/styles/shCore.css
|
41
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeDefault.css
|
42
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeDjango.css
|
43
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeEclipse.css
|
44
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeEmacs.css
|
45
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeFadeToGrey.css
|
46
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeMidnight.css
|
47
|
+
rails_generators/syntaxhighlighter/templates/styles/shThemeRDark.css
|
48
|
+
trainbbcode.gemspec
|
data/Rakefile
CHANGED
@@ -2,13 +2,14 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('trainbbcode','0.
|
5
|
+
Echoe.new('trainbbcode','0.3.0') do |p|
|
6
6
|
p.description = "Provides BBCode for Ruby."
|
7
7
|
p.url = "http://www.arcath.net/pages/2"
|
8
8
|
p.author = "Adam \"Arcath\" Laycock"
|
9
9
|
p.email = "adam@arcath.net"
|
10
10
|
p.ignore_pattern= ["tmp/*", "scripts/*"]
|
11
11
|
p.development_dependencies = []
|
12
|
+
p.runtime_dependencies = ["coderay"]
|
12
13
|
end
|
13
14
|
|
14
15
|
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'trainbbcode'
|
data/lib/trainbbcode.rb
CHANGED
@@ -4,26 +4,37 @@ class TBBC
|
|
4
4
|
end
|
5
5
|
def conf(config)
|
6
6
|
require 'rubygems'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
config[:
|
17
|
-
config[:
|
18
|
-
config[:
|
19
|
-
config[:
|
20
|
-
config[:
|
7
|
+
require 'coderay'
|
8
|
+
config[:configed_by] ||= "user"
|
9
|
+
config[:image_alt] ||= "Posted Image"
|
10
|
+
config[:url_target] ||= "_BLANK"
|
11
|
+
config[:allow_defaults] ||= true
|
12
|
+
config[:table_width] ||= "100%"
|
13
|
+
config[:syntax_highlighting] ||= true
|
14
|
+
config[:syntax_highlighting_html] ||= "color: #E7BE69"
|
15
|
+
config[:syntax_highlighting_comment] ||= "color:#BC9358; font-style: italic;"
|
16
|
+
config[:syntax_highlighting_escaped] ||= "color:#509E4F"
|
17
|
+
config[:syntax_highlighting_class] ||= "color:#FFF"
|
18
|
+
config[:syntax_highlighting_constant] ||= "color:#FFF"
|
19
|
+
config[:syntax_highlighting_float] ||= "color:#A4C260"
|
20
|
+
config[:syntax_highlighting_function] ||= "color:#FFC56D"
|
21
|
+
config[:syntax_highlighting_global] ||= "color:#D0CFFE"
|
22
|
+
config[:syntax_highlighting_integer] ||= "color:#A4C260"
|
23
|
+
config[:syntax_highlighting_inline] ||= "background:#151515"
|
24
|
+
config[:syntax_highlighting_instance] ||= "color:#D0CFFE"
|
25
|
+
config[:syntax_highlighting_doctype] ||= "color:#E7BE69"
|
26
|
+
config[:syntax_highlighting_keyword] ||= "color:#CB7832"
|
27
|
+
config[:syntax_highlighting_regex] ||= "color:#A4C260"
|
28
|
+
config[:syntax_highlighting_string] ||= "color:#A4C260"
|
29
|
+
config[:syntax_highlighting_symbol] ||= "color:#6C9CBD"
|
30
|
+
config[:syntax_highlighting_html] ||= "color:#E7BE69"
|
31
|
+
config[:syntax_highlighting_boolean] ||= "color:#6C9CBD"
|
21
32
|
#Instanize the config variable
|
22
33
|
@config=config
|
23
34
|
end
|
24
35
|
def parse(s)
|
25
|
-
#
|
26
|
-
s=
|
36
|
+
#CodeRay
|
37
|
+
s=coderay(s)
|
27
38
|
#Remove the < and > which will disable all HTML
|
28
39
|
s=s.gsub("<","<").gsub(">",">") unless @config[:disable_html] == false
|
29
40
|
#Convert new lines to <br />'s
|
@@ -101,25 +112,51 @@ class TBBC
|
|
101
112
|
end
|
102
113
|
def css
|
103
114
|
output="<style type=\"text/css\">
|
104
|
-
|
105
|
-
|
115
|
+
.CodeRay {
|
116
|
+
background-color: #232323;
|
117
|
+
border: 1px solid black;
|
118
|
+
font-family: 'Courier New', 'Terminal', monospace;
|
119
|
+
color: #E6E0DB;
|
120
|
+
padding: 3px 5px;
|
121
|
+
overflow: auto;
|
122
|
+
font-size: 12px;
|
123
|
+
margin: 12px 0;
|
124
|
+
}
|
125
|
+
.CodeRay pre {
|
126
|
+
margin: 0px;
|
127
|
+
padding: 0px;
|
106
128
|
}
|
107
|
-
|
108
|
-
|
129
|
+
|
130
|
+
.CodeRay .an { #{@config[:syntax_highlighting_html]} } /* html attribute */
|
131
|
+
.CodeRay .c { #{@config[:syntax_highlighting_comment]} } /* comment */
|
132
|
+
.CodeRay .ch { #{@config[:syntax_highlighting_escaped]} } /* escaped character */
|
133
|
+
.CodeRay .cl { #{@config[:syntax_highlighting_class]} } /* class */
|
134
|
+
.CodeRay .co { #{@config[:syntax_highlighting_constant]} } /* constant */
|
135
|
+
.CodeRay .fl { #{@config[:syntax_highlighting_float]} } /* float */
|
136
|
+
.CodeRay .fu { #{@config[:syntax_highlighting_function]} } /* function */
|
137
|
+
.CodeRay .gv { #{@config[:syntax_highlighting_global]} } /* global variable */
|
138
|
+
.CodeRay .i { #{@config[:syntax_highlighting_integer]} } /* integer */
|
139
|
+
.CodeRay .il { #{@config[:syntax_highlighting_inline]} } /* inline code */
|
140
|
+
.CodeRay .iv { #{@config[:syntax_highlighting_instance]} } /* instance variable */
|
141
|
+
.CodeRay .pp { #{@config[:syntax_highlighting_doctype]} } /* doctype */
|
142
|
+
.CodeRay .r { #{@config[:syntax_highlighting_keyword]} } /* keyword */
|
143
|
+
.CodeRay .rx { #{@config[:syntax_highlighting_regex]} } /* regex */
|
144
|
+
.CodeRay .s { #{@config[:syntax_highlighting_string]} } /* string */
|
145
|
+
.CodeRay .sy { #{@config[:syntax_highlighting_symbol]} } /* symbol */
|
146
|
+
.CodeRay .ta { #{@config[:syntax_highlighting_html]} } /* html tag */
|
147
|
+
.CodeRay .pc { #{@config[:syntax_highlighting_boolean]} } /* boolean */
|
148
|
+
</style>"
|
109
149
|
return output
|
110
150
|
end
|
111
|
-
def uv(s)
|
112
|
-
find=s.scan(/\[code lang=(.*?)\](.*?)\[\/code\]/)
|
113
|
-
find.each do |f|
|
114
|
-
#parse=nobbc "[nobbc]" + f[1] + "[/nobbc]"
|
115
|
-
r=Uv.parse(f[1], @config[:syntax_output], f[0], @config[:syntax_line_numbers], @config[:syntax_theme])
|
116
|
-
end
|
117
|
-
s=s.gsub(/\[code lang=(.*?)\]/,'').gsub("[/code]",'')
|
118
|
-
return s
|
119
|
-
end
|
120
151
|
def correctbrs(s)
|
121
152
|
#Corrects the extra brs
|
122
153
|
s=s.gsub(/<br \/><(ul|li|table|tr|td|th)/,'<\1')
|
154
|
+
s=s.gsub(/<br \/><\/(ul|li|table|tr|td|th)/,'</\1')
|
155
|
+
end
|
156
|
+
def coderay(s)
|
157
|
+
s.gsub(/\[code( lang="(.+?)")?\](.+?)\[\/code\]/m) do
|
158
|
+
"[nobbc]" + CodeRay.scan($3, $2).div(:css => :class) + "[/nobbc]"
|
159
|
+
end
|
123
160
|
end
|
124
161
|
end
|
125
162
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class SyntaxhighlighterGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
#Style Files
|
5
|
+
m.directory "public/styles"
|
6
|
+
m.file "styles/help.png", "public/styles/help.png"
|
7
|
+
m.file "styles/magnifier.png", "public/styles/magnifier.png"
|
8
|
+
m.file "styles/page_white_code.png", "public/styles/page_white_code.png"
|
9
|
+
m.file "styles/page_white_copy.png", "public/styles/page_white_copy.png"
|
10
|
+
m.file "styles/printer.png", "public/styles/printer.png"
|
11
|
+
m.directory "public/stylesheets/syntax"
|
12
|
+
m.file "styles/shCore.css", "public/stylesheets/syntax/shCore.css"
|
13
|
+
m.file "styles/shThemeDefault.css", "public/stylesheets/syntax/shThemeDefault.css"
|
14
|
+
m.file "styles/shThemeDjango.css", "public/stylesheets/syntax/shThemeDjango.css"
|
15
|
+
m.file "styles/shThemeEclipse.css", "public/stylesheets/syntax/shThemeEclipse.css"
|
16
|
+
m.file "styles/shThemeEmacs.css", "public/stylesheets/syntax/shThemeEmacs.css"
|
17
|
+
m.file "styles/shThemeFadeToGrey.css", "public/stylesheets/syntax/shThemeFadeToGrey.css"
|
18
|
+
m.file "styles/shThemeMidnight.css", "public/stylesheets/syntax/shThemeMidnight.css"
|
19
|
+
m.file "styles/shThemeRDark.css", "public/stylesheets/syntax/shThemeRDark.css"
|
20
|
+
#Src Files
|
21
|
+
m.directory "public/javascripts/syntax"
|
22
|
+
m.file "src/shCore.js", "public/javascripts/syntax/shCore.js"
|
23
|
+
m.file "src/shLegacy.js", "public/javascripts/syntax/shLegacy.js"
|
24
|
+
#Script Files
|
25
|
+
Dir.foreach("vendor/plugins/TrainBBCode/rails_generators/syntaxhighlighter/templates/scripts") do |f|
|
26
|
+
m.file "scripts/#{f}", "public/javascripts/syntax/#{f}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/**
|
2
|
+
* SyntaxHighlighter
|
3
|
+
* http://alexgorbatchev.com/
|
4
|
+
*
|
5
|
+
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
6
|
+
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
|
7
|
+
*
|
8
|
+
* @version
|
9
|
+
* 2.1.364 (October 15 2009)
|
10
|
+
*
|
11
|
+
* @copyright
|
12
|
+
* Copyright (C) 2004-2009 Alex Gorbatchev.
|
13
|
+
*
|
14
|
+
* @license
|
15
|
+
* This file is part of SyntaxHighlighter.
|
16
|
+
*
|
17
|
+
* SyntaxHighlighter is free software: you can redistribute it and/or modify
|
18
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
19
|
+
* the Free Software Foundation, either version 3 of the License, or
|
20
|
+
* (at your option) any later version.
|
21
|
+
*
|
22
|
+
* SyntaxHighlighter is distributed in the hope that it will be useful,
|
23
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25
|
+
* GNU General Public License for more details.
|
26
|
+
*
|
27
|
+
* You should have received a copy of the GNU General Public License
|
28
|
+
* along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
|
29
|
+
*/
|
30
|
+
SyntaxHighlighter.brushes.AS3 = function()
|
31
|
+
{
|
32
|
+
// Created by Peter Atoria @ http://iAtoria.com
|
33
|
+
|
34
|
+
var inits = 'class interface function package';
|
35
|
+
|
36
|
+
var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
|
37
|
+
'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
|
38
|
+
'extends false final finally flash_proxy for get if implements import in include Infinity ' +
|
39
|
+
'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
|
40
|
+
'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
|
41
|
+
'return set static String super switch this throw true try typeof uint undefined unescape ' +
|
42
|
+
'use void while with'
|
43
|
+
;
|
44
|
+
|
45
|
+
this.regexList = [
|
46
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
47
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
48
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
49
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
50
|
+
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
51
|
+
{ regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
|
52
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
53
|
+
{ regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
|
54
|
+
{ regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
|
55
|
+
];
|
56
|
+
|
57
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
|
58
|
+
};
|
59
|
+
|
60
|
+
SyntaxHighlighter.brushes.AS3.prototype = new SyntaxHighlighter.Highlighter();
|
61
|
+
SyntaxHighlighter.brushes.AS3.aliases = ['actionscript3', 'as3'];
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/**
|
2
|
+
* SyntaxHighlighter
|
3
|
+
* http://alexgorbatchev.com/
|
4
|
+
*
|
5
|
+
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
6
|
+
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
|
7
|
+
*
|
8
|
+
* @version
|
9
|
+
* 2.1.364 (October 15 2009)
|
10
|
+
*
|
11
|
+
* @copyright
|
12
|
+
* Copyright (C) 2004-2009 Alex Gorbatchev.
|
13
|
+
*
|
14
|
+
* @license
|
15
|
+
* This file is part of SyntaxHighlighter.
|
16
|
+
*
|
17
|
+
* SyntaxHighlighter is free software: you can redistribute it and/or modify
|
18
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
19
|
+
* the Free Software Foundation, either version 3 of the License, or
|
20
|
+
* (at your option) any later version.
|
21
|
+
*
|
22
|
+
* SyntaxHighlighter is distributed in the hope that it will be useful,
|
23
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25
|
+
* GNU General Public License for more details.
|
26
|
+
*
|
27
|
+
* You should have received a copy of the GNU General Public License
|
28
|
+
* along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
|
29
|
+
*/
|
30
|
+
SyntaxHighlighter.brushes.Bash = function()
|
31
|
+
{
|
32
|
+
var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne gt lt ge le';
|
33
|
+
var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
|
34
|
+
'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
|
35
|
+
'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
|
36
|
+
'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
|
37
|
+
'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
|
38
|
+
'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
|
39
|
+
'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
|
40
|
+
'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
|
41
|
+
'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
|
42
|
+
'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
|
43
|
+
'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
|
44
|
+
'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
|
45
|
+
'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
|
46
|
+
'vi watch wc whereis which who whoami Wget xargs yes'
|
47
|
+
;
|
48
|
+
|
49
|
+
this.findMatches = function(regexList, code)
|
50
|
+
{
|
51
|
+
code = code.replace(/>/g, '>').replace(/</g, '<');
|
52
|
+
this.code = code;
|
53
|
+
return SyntaxHighlighter.Highlighter.prototype.findMatches.apply(this, [regexList, code]);
|
54
|
+
};
|
55
|
+
|
56
|
+
this.regexList = [
|
57
|
+
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
|
58
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
59
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
60
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
61
|
+
{ regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
|
62
|
+
];
|
63
|
+
}
|
64
|
+
|
65
|
+
SyntaxHighlighter.brushes.Bash.prototype = new SyntaxHighlighter.Highlighter();
|
66
|
+
SyntaxHighlighter.brushes.Bash.aliases = ['bash', 'shell'];
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/**
|
2
|
+
* SyntaxHighlighter
|
3
|
+
* http://alexgorbatchev.com/
|
4
|
+
*
|
5
|
+
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
6
|
+
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
|
7
|
+
*
|
8
|
+
* @version
|
9
|
+
* 2.1.364 (October 15 2009)
|
10
|
+
*
|
11
|
+
* @copyright
|
12
|
+
* Copyright (C) 2004-2009 Alex Gorbatchev.
|
13
|
+
*
|
14
|
+
* @license
|
15
|
+
* This file is part of SyntaxHighlighter.
|
16
|
+
*
|
17
|
+
* SyntaxHighlighter is free software: you can redistribute it and/or modify
|
18
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
19
|
+
* the Free Software Foundation, either version 3 of the License, or
|
20
|
+
* (at your option) any later version.
|
21
|
+
*
|
22
|
+
* SyntaxHighlighter is distributed in the hope that it will be useful,
|
23
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25
|
+
* GNU General Public License for more details.
|
26
|
+
*
|
27
|
+
* You should have received a copy of the GNU General Public License
|
28
|
+
* along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
|
29
|
+
*/
|
30
|
+
SyntaxHighlighter.brushes.CSharp = function()
|
31
|
+
{
|
32
|
+
var keywords = 'abstract as base bool break byte case catch char checked class const ' +
|
33
|
+
'continue decimal default delegate do double else enum event explicit ' +
|
34
|
+
'extern false finally fixed float for foreach get goto if implicit in int ' +
|
35
|
+
'interface internal is lock long namespace new null object operator out ' +
|
36
|
+
'override params private protected public readonly ref return sbyte sealed set ' +
|
37
|
+
'short sizeof stackalloc static string struct switch this throw true try ' +
|
38
|
+
'typeof uint ulong unchecked unsafe ushort using virtual void while';
|
39
|
+
|
40
|
+
function fixComments(match, regexInfo)
|
41
|
+
{
|
42
|
+
var css = (match[0].indexOf("///") == 0)
|
43
|
+
? 'color1'
|
44
|
+
: 'comments'
|
45
|
+
;
|
46
|
+
|
47
|
+
return [new SyntaxHighlighter.Match(match[0], match.index, css)];
|
48
|
+
}
|
49
|
+
|
50
|
+
this.regexList = [
|
51
|
+
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments
|
52
|
+
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
53
|
+
{ regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings
|
54
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
55
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
56
|
+
{ regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
57
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword
|
58
|
+
{ regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial'
|
59
|
+
{ regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield'
|
60
|
+
];
|
61
|
+
|
62
|
+
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
63
|
+
};
|
64
|
+
|
65
|
+
SyntaxHighlighter.brushes.CSharp.prototype = new SyntaxHighlighter.Highlighter();
|
66
|
+
SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp'];
|
67
|
+
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/**
|
2
|
+
* SyntaxHighlighter
|
3
|
+
* http://alexgorbatchev.com/
|
4
|
+
*
|
5
|
+
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
6
|
+
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
|
7
|
+
*
|
8
|
+
* @version
|
9
|
+
* 2.1.364 (October 15 2009)
|
10
|
+
*
|
11
|
+
* @copyright
|
12
|
+
* Copyright (C) 2004-2009 Alex Gorbatchev.
|
13
|
+
*
|
14
|
+
* @license
|
15
|
+
* This file is part of SyntaxHighlighter.
|
16
|
+
*
|
17
|
+
* SyntaxHighlighter is free software: you can redistribute it and/or modify
|
18
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
19
|
+
* the Free Software Foundation, either version 3 of the License, or
|
20
|
+
* (at your option) any later version.
|
21
|
+
*
|
22
|
+
* SyntaxHighlighter is distributed in the hope that it will be useful,
|
23
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25
|
+
* GNU General Public License for more details.
|
26
|
+
*
|
27
|
+
* You should have received a copy of the GNU General Public License
|
28
|
+
* along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
|
29
|
+
*/
|
30
|
+
SyntaxHighlighter.brushes.ColdFusion = function()
|
31
|
+
{
|
32
|
+
// Contributed by Jen
|
33
|
+
// http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus
|
34
|
+
|
35
|
+
var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' +
|
36
|
+
'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' +
|
37
|
+
'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' +
|
38
|
+
'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' +
|
39
|
+
'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' +
|
40
|
+
'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' +
|
41
|
+
'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' +
|
42
|
+
'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' +
|
43
|
+
'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' +
|
44
|
+
'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' +
|
45
|
+
'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' +
|
46
|
+
'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' +
|
47
|
+
'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' +
|
48
|
+
'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' +
|
49
|
+
'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' +
|
50
|
+
'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' +
|
51
|
+
'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' +
|
52
|
+
'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' +
|
53
|
+
'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' +
|
54
|
+
'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' +
|
55
|
+
'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' +
|
56
|
+
'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' +
|
57
|
+
'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' +
|
58
|
+
'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' +
|
59
|
+
'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' +
|
60
|
+
'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' +
|
61
|
+
'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' +
|
62
|
+
'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' +
|
63
|
+
'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' +
|
64
|
+
'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' +
|
65
|
+
'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' +
|
66
|
+
'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' +
|
67
|
+
'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' +
|
68
|
+
'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' +
|
69
|
+
'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' +
|
70
|
+
'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' +
|
71
|
+
'XmlValidate Year YesNoFormat';
|
72
|
+
|
73
|
+
var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' +
|
74
|
+
'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' +
|
75
|
+
'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' +
|
76
|
+
'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' +
|
77
|
+
'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' +
|
78
|
+
'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' +
|
79
|
+
'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' +
|
80
|
+
'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' +
|
81
|
+
'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' +
|
82
|
+
'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' +
|
83
|
+
'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' +
|
84
|
+
'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' +
|
85
|
+
'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' +
|
86
|
+
'cfwindow cfxml cfzip cfzipparam';
|
87
|
+
|
88
|
+
var operators = 'all and any between cross in join like not null or outer some';
|
89
|
+
|
90
|
+
this.regexList = [
|
91
|
+
{ regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments
|
92
|
+
{ regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings
|
93
|
+
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
94
|
+
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
95
|
+
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions
|
96
|
+
{ regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
|
97
|
+
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
98
|
+
];
|
99
|
+
}
|
100
|
+
|
101
|
+
SyntaxHighlighter.brushes.ColdFusion.prototype = new SyntaxHighlighter.Highlighter();
|
102
|
+
SyntaxHighlighter.brushes.ColdFusion.aliases = ['coldfusion','cf'];
|