三月 20

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 Responses to “SyntaxHighlighter-Plus for RouterOS Template”

  1. Abel Braaksma Says:

    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: http://www.undermyhat.org/blog/2009/09/list-of-brushes-syntaxhighligher/

  2. jason Says:

    I don’t mind

  3. All Syntax Highlighter brushes collected, described and downloadable | Under My Hat Says:

    […] RouterOS scripts are used for scripting MikroTik routers, found here. […]

  4. DynStatic – Wordpress RouterOS Syntax Highlighting Says:

    […] which allow you to extend the highlighting to additional languages. Someone had already made a Brush for RouterOS for the JavaScript package, but in order to use it it with the WordPress plugin it had to be […]

留下評論

限制時效已用盡。請重新載入驗證碼。