SyntaxHighlighter-Plus for RouterOS Template

RouterOS 看來應該是會一直玩下去了。越玩越順手

先補上在 WordPress 中可以讓 RouterOS 語法高亮的 SyntaxHighlighter-Plus 樣版

使用的方法可以參考之前的文章幫SyntaxHighlighter-Plus加上新的語言樣版

程式碼另存為shBrushRouterOS.js


SyntaxHighlighter.brushes.RouterOS = function()
{

var keywords = ‘global local do else for from to step in foreach ‘ +
‘if put while environment nothing set’;

var commands = ‘add comment disable enable export get move remove unset ‘ +
‘delay edit blink monitor beep find led len ‘ +
‘list log pick resolve time print toid totime tonum’;

this.regexList = [
{ regex: /#.*$/gm, css: ‘comments’ },
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: ‘string’ }, // double quoted strings
{ regex: new RegExp(this.getKeywords(keywords), ‘gm’), css: ‘keyword’ }, // keywords
{ regex: new RegExp(this.getKeywords(commands), ‘gm’), css: ‘functions’ } // commands
];
}

SyntaxHighlighter.brushes.RouterOS.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.RouterOS.aliases = [‘ros’];

記得要在/wp-content/plugins/syntaxhighlighter-plus/syntaxhighlighter.php
大約在在112行的位置加入樣版的名子

‘RouterOS’=> array(‘ros’),

4 thoughts on “SyntaxHighlighter-Plus for RouterOS Template

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *