入力したプログラムコードを色付けするスーパーpre記法 シンタックス・ハイライトの実装
http://d.hatena.ne.jp/hatenadiary/20061215
色付けキタ━━━━(゚∀゚)━━━━!!!!
C#(cs)
/// <summary> /// 入力コンテキストハンドルを取得するためのクラス /// </summary> class IMC : IDisposable { private IntPtr hWnd; private int hIMC; #region IDisposable メンバ public void Dispose() { if (hWnd != IntPtr.Zero && hIMC != 0) { Win32.ImmReleaseContext(hWnd, hIMC); } } #endregion public IMC(IntPtr hWnd) { this.hWnd = hWnd; this.hIMC = Win32.ImmGetContext(this.hWnd); } ~IMC() { // これはしない方がいいか……。 // Dispose(); } /// <summary> /// 入力コンテキストハンドルの取得 /// </summary> public int Handle { get { return hIMC; } } }
C++(cpp)
// 文字列を分割する(内部処理用) BrewArray< BrewString > BrewString::Data::_Split( const BrewArray< BrewString >& separator , int count , int arrayCount , bool bEmptyEntries ) const{ BrewArray< BrewString > str( arrayCount ); int n = 0; int index = 0; int index2; while( true ){ if( n == count ){ break; } pair< int , int > p = _IndexOfAny( separator , index ); index2 = p.first; if( index2 == -1 ){ index2 = Length(); } if( bEmptyEntries || index2 != index ){ if( n == count - 1 ){ index2 = Length(); } str[ n++ ] = Substring( index , index2 - index ); } if( index2 == Length() ){ break; } index = index2 + separator[ p.second ].Length(); } return str; }
create function TextRead(@id as integer) returns varchar(4000) begin declare @str0 varchar(4000); set @str0=''; with Temp(TextId, Text, NextId) as ( select A.TextId , A.Text, A.NextId from TextTable as A where A.TextId = @id union all select A.TextId, A.Text, A.NextId from TextTable as A, Temp as Temp2 where A.TextId = Temp2.NextId ) select @str0=@str0+'['+Text+']' from Temp; return @str0; end;
div.comment{ background-color: #f8f8f8; } div.day{ background-color: #fdfdff; } body { background-image:url("http://members3.jcom.home.ne.jp/3446744601/img/body_back.gif"); } pre a.keyword { text-decoration: none; border: none; } pre a.keyword:hover { color: black; } pre span.cpp_java_keyword { color: blue; } pre span.cpp_java_keyword a.keyword { color: blue; } pre span.cpp_java_keyword a.keyword:hover { color: blue; }
BASIC(basic)
10 WIDTH 80,20:CLS 3:RANDOMIZE 20 LET R=INT(RND(1)*2) 30 IF R=0 THEN 40 PRINT "0" 50 ELSE 60 PRINT "1" 70 END IF 80 END
バッチファイル(winbatch)
@echo off rem ---- batch backup ---- rem -- 自身のフォルダ以下のデータを rem -- バックアップします。 rem ---------------------- rem ---- parameter ---- rem -- folder : 圧縮されたファイルを保存する場所 rem -- winrar_exe : WinRar.exeへのパス rem ------------------- setlocal ENABLEDELAYEDEXPANSION set folder=.. set winrar_exe="C:\Program Files\WinRAR\WinRar.exe" set year=%DATE:~2,2% set month=%DATE:~5,2% set day=%DATE:~8,2% for %%n in ( . ) do set name=%%~nn if "%name%"=="" goto END %winrar_exe% a -r "%folder%\%name%%year%%month%%day%.rar" -ap"%name%" :END endlocal DISABLEDELAYEDEXPANSION
これは便利だ……。
KEMURI, HQ9+, Brainf*ckの対応マダー(・∀・ )っ/凵 ⌒☆チン
で、色やフォントの変更ですが、
synComment synIdentifier synStatement synType synPreProc synConstant synSpecial
この辺の CSS の設定を弄れば出来るみたいですね。
span.synComment{ color: #008800 }