让SyntaxHighlighter 支持lua脚本高亮(sbBrushlua.js)
来源:互联网 发布:淘宝店铺名片设计 编辑:程序博客网 时间:2024/05/09 06:18
sbBrushLua.js源代码,这是添加到SyntaxHighlighter里面的插件代码,实现支持lua脚本高亮
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* SyntaxHighlighter
* <a href="http://alexgorbatchev.com/SyntaxHighlighter">http://alexgorbatchev.com/SyntaxHighlighter</a>
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* <a href="http://alexgorbatchev.com/SyntaxHighlighter/donate.html">http://alexgorbatchev.com/SyntaxHighlighter/donate.html</a>
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(
function
()
{
// CommonJS
typeof
(require) !=
'undefined'
? SyntaxHighlighter = require(
'shCore'
).SyntaxHighlighter :
null
;
function
Brush()
{
var
keywords =
'and break do else elseif end false for function if in '
+
'local nil not or repeat return then true until while'
;
var
functions =
'_G _VERSION assert collectgarbage dofile error getfenv '
+
'getmetatable ipairs load module next pairs pcall print '
+
' rawequal rawget rawset require select setfenv setmetatable '
+
'tonumber tostring type unpack xpcall '
+
'coroutine.create coroutine.resume coroutine.running '
+
'coroutine.status coroutine.wrap coroutine.yield '
+
'debug.debug debug.getfenv debug.gethook debug.getinfo '
+
'debug.getlocal debug.getmetatable debug.getregistry '
+
'debug.getupvalue debug.setfenv debug.sethook debug.setlocal '
+
'debug.setmetatable debug.setupvalue debug.traceback '
+
'file:close file:flush file:lines file:read file:seek '
+
'file:setvbuf file:write'
+
'io.close io.flush io.input io.lines io.open io.output '
+
'io.popen io.read io.stderr io.stdin io.stdout io.tmpfile '
+
'io.type io.write '
+
'math.abs math.acos math.asin math.atan math.atan2 math.ceil '
+
'math.cos math.cosh math.deg math.exp math.floor math.fmod '
+
'math.frexp math.huge math.ldexp math.log math.log10 math.max '
+
'math.min math.modf math.pi math.pow math.rad math.random '
+
'math.randomseed math.sin math.sinh math.sqrt math.tan math.tanh '
+
'os.clock os.date os.difftime os.execute os.exit os.getenv os.remove '
+
'os.rename os.setlocale os.time os.tmpname '
+
'package.cpath package.loaded package.loaders package.loadlib '
+
'package.path package.preload package.seeall '
+
'string.byte string.char string.dump string.find string.format '
+
'string.gmatch string.gsub string.len string.lower string.match '
+
'string.rep string.reverse string.sub string.upper table.concat '
+
'table.insert table.maxn table.remove table.sort'
;
this
.regexList = [
{ regex: /--.*/gm, css:
'comments'
},
// one line comments
{ regex: /--\[\[[\S\s]*\]\]/gm, css:
'comments'
},
// multi line comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css:
'string'
},
// strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css:
'string'
},
// strings
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css:
'string'
},
// strings
{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css:
'string'
},
// strings
{ regex:
new
RegExp(
this
.getKeywords(keywords),
'gm'
), css:
'keyword'
},
// keywords
{ regex:
new
RegExp(
this
.getKeywords(functions),
'gm'
), css:
'functions'
}
// functions
];
}
Brush.prototype =
new
SyntaxHighlighter.Highlighter();
Brush.aliases = [
'lua'
];
SyntaxHighlighter.brushes.Lua = Brush;
// CommonJS
typeof
(exports) !=
'undefined'
? exports.Brush = Brush :
null
;
})();
如何让sbBrushLua生效
在你的文章页面添加这段代码到head标签当中.
注意路径要正确.
除声明外,跑步客文章均为原创,转载请以链接形式标明本文地址
本文地址: http://www.paobuke.com/develop/lua/pbk1257.html
本文地址: http://www.paobuke.com/develop/lua/pbk1257.html
- 让SyntaxHighlighter 支持lua脚本高亮(sbBrushlua.js)
- 让VS2005编辑器支持着色器语法高亮 (其他高亮如lua脚本同理)
- 让 UltraEdit-32支持lua高亮显示
- 让editplus可以支持lua语法高亮
- 代码高亮syntaxhighlighter
- syntaxhighlighter 使用 配置 参数 详解 代码高亮 纯JS
- 使用SyntaxHighlighter高亮代码
- SyntaxHighlighter代码高亮插件
- SyntaxHighlighter代码高亮插件
- 代码高亮插件SyntaxHighlighter
- 代码高亮插件SyntaxHighlighter
- syntaxhighlighter高亮动态代码
- SyntaxHighlighter代码高亮插件
- SyntaxHighlighter高亮显示代码
- SyntaxHighlighter代码高亮插件
- 如何用syntaxhighlighter显示高亮代码
- kindeditor配合SyntaxHighlighter实现代码高亮
- kindeditor4.x整合SyntaxHighlighter代码高亮
- 关于 A^x = A^(x % Phi(C) + Phi(C)) (mod C) 的若干证明
- android开发SQLite加密问题解决方案(绝对管用)
- DNS原理及其解析过程【精彩剖析】
- 一名开发者从做技工的父亲那里学到的5堂课
- Oracle用户被锁的原因以及解决办法
- 让SyntaxHighlighter 支持lua脚本高亮(sbBrushlua.js)
- 放开眼界
- 获取与设置样式 获取class和设置class都可以使用attr()方法来完成
- 题库20130606
- 高效删除Oracle数据库中重复数据,并保留最新一条的方法
- Oracle 查询并删除重复记录的SQL语句
- 仿JDK动态代理实现
- android使用软引用构建缓存
- oracle数据文件被误删除后的灾难处理方法