让 SyntaxHighlighter 3.x 支持 Lua 语法着色
1. [代码]shBrushLua.js
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @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()
{
// maker is IkPil, Choi
// http://www.ikpil.com
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' +flash教程
'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
];http://www.huiyi8.com/flashjc/shipin/
}
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['lua'];
SyntaxHighlighter.brushes.Lua = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
2. [代码]使用方法
<html>
<head>
<link type="text/css" rel="stylesheet" href="/styles/shCore.css" />
<link type="text/css" rel="stylesheet" href="/styles/shThemeDefault.css" />
<script type="text/javascript" src="/scripts/shCore.js"></script>
<script type="text/javascript" src="/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="/scripts/shBrushBash.js"></script>
<script type="text/javascript" src="/scripts/shBrushCpp.js"></script>
<script type="text/javascript" src="/scripts/shBrushLua.js"></script>
<script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
...
让 SyntaxHighlighter 3.x 支持 Lua 语法着色的更多相关文章
- 转:OpenResty最佳实践(推荐了解lua语法)
看点: 1. Lua 语法的说明, 排版清晰易懂. 转: https://moonbingbing.gitbooks.io/openresty-best-practices/content/lua/m ...
- 图文解说PhpStorm 7.0版本语法着色
前不久,我们测试了PhpStorm7.0版本对PHP 5.5的支持,今天我们将继续对PhpStorm 7.0版本对代码支持进行测试. 我们知道,在PhpStorm 6.0版本中,提供一个黑色背景的代码 ...
- lua 语法的使用总结
1.字符串连接 local tmp = "abc" local tmp1 = "ddd" tmp..tmp1 2. table 类型 就是关联数组 local ...
- Lua语法基础(2)--基本语法、函数
上一篇编辑编辑着,发现,缩进出了问题.作为一个不是强迫症的人,实在是忍受不了同一级内容不同缩进方式的槽点,于是重开一篇吧.(万幸,这样的文章也只有我自己看.) 第四 基本语法 赋值语句,Lua可以对多 ...
- UltraEdit-14.10.0.1024版本语法着色配置
用了UltraEdit有段时间了,一直没做语法着色,当做普通文本编辑器使用,这也太委屈这个“神器”了. 今天就让它物尽其用吧.体验一把UltraEdit的语法高亮功能. 参考:http://www.1 ...
- nginx编译安装支持lua脚本
一.准备编译环境 1.操作系统:CentOS7.6 2.安装编译所需安装包 yum install gcc pcre pcre-devel zlib zlib-devel openssl openss ...
- sublime 支持php语法错误提示的插件
求一个好用的sublime 支持php语法错误提示的插件.我装过sublimelinter,但是有时候出现错误也不会提示. 可以试试http://cs.sensiolabs.org/ 这个看哦它有对应 ...
- 【Markdown】notepad++ 支持 markdown语法、预览
Notepad++中支持Markdown 最近在学习Markdown语言的使用,很想在XP主机上使用Markdown的离线编辑器,但MarkdownPad.作业部分的离线客户端都不能再XP上运行, ...
- vim 支持 markdown 语法
/************************************************************************* * vim 支持 markdown 语法 * 说明 ...
随机推荐
- EC++学习笔记(四) 设计与声明
条款18:让接口容易被正确使用,不易被误用 必须考虑客户可能做出什么样的错误(防御式编程)std:shared_ptr会自动使用它的"每个指针专属的删除器",消除了"cr ...
- Unity3D 对象池思想 在游戏开发中的运用
分类:U3D 1.在王者荣耀中,每30秒小兵会出现一波,出现之后会被敌方玩家或敌方小兵销毁,一局游戏下来,小兵会被创建多次,同时也会被销毁,在游戏中,这种频繁的创建和销毁游戏对象是很损耗性能的.在游戏 ...
- Access restriction: The method 'CharacterEncoder.encode(byte[])' is not API...
问题描述:Access restriction: The method 'CharacterEncoder.encode(byte[])' is not API... 解决方法:这种错误是eclips ...
- nsmutablestring 属性声明为copy程序崩溃了
obj.mutableStr = (NSMutableString *)[[NSMutableString alloc] initWithString:@"Hello"]; NSL ...
- 1054. 求平均值 (20)-PAT乙级真题
今天刚刚到学校,2017年学习正式开始了,今天看到了浙大的<数据结构>这学期又要开课了,决定一定要跟着学习一遍:在大学生mooc网上学习:http://www.icourse163.org ...
- [转】 nginx rewrite规则
http://www.cnblogs.com/cgli/archive/2011/05/16/2047920.html 最近在VPS上尝试配置安装一个网站,VPS安装了LNMP(Linux+Nginx ...
- ubuntu harddisk uuid already exists
就是virtualbox下先用u盘启动的虚拟机,把U盘的vhdk文件拷贝到本机,然后再启动,就有问题,提示什么uuid already exist 找了半天,网上基本都是说windows下如何用的.. ...
- easyui datagrid client搜索、分页、排序
easyui datagrid的排序默认是server端排序.能够用sorter实现client排序[2].client分页可用filter实现[3].client搜索相同能够用filter实现. 不 ...
- Eclipse中移除native层编译支持
1. .project 文件 删除全部包括 org.eclipse.cdt前缀的xml结点元素.以下是一个包括cdt的完整编译配置文件. <?xml version="1.0" ...
- HDU 5327 Olympiad (多校)
Olympiad Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Su ...