2013年1月31日木曜日

textWranglerで正規表現。

Macで無料のテキストエディタ、TextWranglerを使っていて、正規表現が使いたかったので、方法を調べた。

以下の動画が分かりやすく、ありがたかったので、メモです。

「Grep」のチェックを入れれば良かったのか、と納得。


ついでのメモとして、wordなどでルビが振られている場合、半角括弧内にかなが振られているものをすべて削除したい場合の正規表現が以下。

\(.*?\)

便利。

2013年1月20日日曜日

syntax highlightを導入したいメモ

bloggerにsyntax highlightを導入したいと思い、ググり。

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
での生成コードをつっこんで、上記ファイルへのリンクを貼る、と。

2013年1月18日金曜日

TinyMCEにCSSを適用。

TinyMCEで、ポストに適用しているCSSの通りに表示させるようにしたい、と思いググる。

以下のリンクが参考になった。
http://takahashifumiki.com/web/programing/1667/

functions.phpに
以下の行を追加。(もちろん、CSSファイル名は、自分の環境の通りに変更)
add_editor_style("editor-style.css");
 無事、適用されました。

良かった。

Euclidesというテーマを使い始めてみた。

wordpressでこのテーマを使い始めてみた。

http://www.cssigniter.com/ignite/themes/euclides/

searchから飛ぶと、へんな「download」とか「view demo」という謎の表示が出る。

さて、なんのことやら。調べるべし。

で、調べると、
「Euclides is the perfect theme for those who write tutorials online. While we concentrate on web workers, anyone can use this theme.」と書かれていた。。。

チュートリアル用のテーマだったのね。

あれま。無料で、良い感じだったから使い始めてみたけど、地雷かな。。

:::::::::::::::::::::::::::::::

あぎゃ。ポストごとの編集アイコンが、どこかに行ってしまった。
そもそもあったかな。。
うーん。

以下、追加したOKだった。
http://codex.wordpress.org/Function_Reference/edit_post_link


a-blogCMSから、wordpressへの移行をせねば。

a-blogCMSから、wordpressへのエクスポートの必要が出来たので、メモです。

http://manual.onsen.ne.jp/?p=129
ここに、やり方のメモがありました。

と思ったら、「a-blog CMS」から、ではなくて、「a-blog」でした。
私がやりたいのは、a-blog CMSからの吸い出し。

sql文でエラーが出たので、なんでだろう、と思ったら、そういうオチでした。。