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) -

  • Hi, hope you don't mind me commenting in English, but I added your brush to my list of "all" custom SyntaxHighlighter brushes, hope you don't mind. Of course I added credit, but perhaps you can help me with the name of the author, I'm not sure what to put there.

    See: www.undermyhat.org/.../

新增評論

Loading