SyntaxHighlighter.brushes.Lua = function()
{
var keywords = 'break do end else elseif function if local nil not or repeat return and then until while this';
var funcs = 'math\\.\\w+ string\\.\\w+ os\\.\\w+ debug\\.\\w+ io\\.\\w+ error fopen dofile coroutine\\.\\w+ arg getmetatable ipairs loadfile loadlib loadstring longjmp print rawget rawset seek setmetatable assert tonumber tostring';
this.regexList = [
{ regex: new RegExp('--\\[\\[[\\s\\S]*\\]\\]--', 'gm'), css: 'comments' },
{ regex: new RegExp('--[^\\[]{2}.*$', 'gm'), css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keyword
{ regex: new RegExp(this.getKeywords(funcs), 'gm'), css: 'func' }, // functions
];
}
SyntaxHighlighter.brushes.Lua.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Lua.aliases = ['lua'];
3. 使用FTP工具登陸到WordPress空間,進(jìn)入到wp-content/plugins目錄,新建一個(gè)目錄,取一個(gè)有意義的名字,比如syntaxhighlighter-lua;
4. 將shBrushLua.js上傳到新創(chuàng)建的目錄;
5. 在該目錄創(chuàng)建一個(gè)另一個(gè)shBrushLua.php文件,添加如下內(nèi)容:
6. 文件都準(zhǔn)備完了,OK,進(jìn)入到WordPress后臺(tái)管理的Plugins下,應(yīng)該能看到新添加的一項(xiàng)syntaxhighlighter-lua,激活它。
其實(shí)新添加的js和php文件也可以放到SyntaxHighlighter插件本身的目錄下,但是讓它獨(dú)立成插件的好處是,當(dāng)SyntaxHighlighter升級(jí)時(shí),你的個(gè)人配置不會(huì)因?yàn)楦采w而丟失。