http://www.way2blogging.org/2011/03/how-to-add-syntax-highlighterv3-to.html
http://taku1974-digital.blogspot.jp/2011/03/fazibears-blogger-widgets.html
この辺で行けそうですね。
objective-cをハイライトしたいので、
http://dev2next.blog134.fc2.com/blog-entry-6.html
がありがたそう。
以下が、objective-Cのハイライターコード。
/**
* SyntaxHighlighter - Objective-C Brush
* http://codepirate.seaandco.com/
*
* @version
* 1.0.0 (February 22 2009)
*
* @author
* Geoffrey Byers
*
* @copyright
* Copyright (C) 2009 Geoffrey Byers.
*
* Licensed under a GNU Lesser General Public License.
* http://creativecommons.org/licenses/LGPL/2.1/
*
* Updated From:
* Code Syntax Highlighter for Objective-C.
* Version 0.0.2
* Copyright (C) 2006 Shin, YoungJin.
* http://scottdensmore.typepad.com/blog/2008/12/objective-c-cocoa-syntax-highlighter.html
*/
SyntaxHighlighter.brushes.ObjC = function()
{
var datatypes = 'char bool BOOL double float int long short id void';
var keywords = 'IBAction IBOutlet SEL YES NO readwrite readonly nonatomic nil NULL ';
keywords += 'super self copy ';
keywords += 'break case catch class const copy __finally __exception __try ';
keywords += 'const_cast continue private public protected __declspec ';
keywords += 'default delete deprecated dllexport dllimport do dynamic_cast ';
keywords += 'else enum explicit extern if for friend goto inline ';
keywords += 'mutable naked namespace new noinline noreturn nothrow ';
keywords += 'register reinterpret_cast return selectany ';
keywords += 'sizeof static static_cast struct switch template this ';
keywords += 'thread throw true false try typedef typeid typename union ';
keywords += 'using uuid virtual volatile whcar_t while';
// keywords += '@property @selector @interface @end @implementation @synthesize ';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'color3' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'color3' }, // single quoted strings
{ regex: new RegExp('^ *#.*', 'gm'), css: 'variable' }, // preprocessor
{ regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'functions' }, // datatypes
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'functions' }, // keyword
{ regex: new RegExp('\\bNS\\w+\\b', 'g'), css: 'constants' }, // keyword
{ regex: new RegExp('\\bUI\\w+\\b', 'g'), css: 'constants' }, // keyword
{ regex: new RegExp('\\bCG\\w+\\b', 'g'), css: 'constants' }, // keyword
{ regex: new RegExp('@\\w+\\b', 'g'), css: 'functions' }, // keyword
];
}
SyntaxHighlighter.brushes.ObjC.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.ObjC.aliases = ['objc', 'obj-c'];
で、ヘッダに
http://www.way2blogging.org/widget-generators/syntax-highlighter-scripts-generator
での生成コードをつっこんで、上記ファイルへのリンクを貼る、と。
0 件のコメント:
コメントを投稿