|
|
. 文中で\♠\♣\♥\♦などの特殊文字を使う方法。 ALIAS を使ってもいいのだけど、いちいち定義するのも面倒なので・・・。
. 以下のパッチを theme.ph に追加します。 これにより、「\\&」で「&」が「&」に置換されるのを抑制することが出来ます。
. \♥を表示するには ♥ の前に \ を付けます。
################################################################ ### Patch for Diary.pm ################################################################ package HNS::Diary; sub HnfPrint ($){ my $hnf_ = shift; $hnf_ =~ s/\\\&/&/g; # \\& で & そのものを出力 if ($HNS::System::Caching) { print X $hnf_; } else { $HNS::Diary::Hnf .= $hnf_; } }
. 静的生成した日記を、そっくり別サイトに置いても大丈夫なように <base href=".. の出力を制御できるようにしてみました。
package HNS; ....... print qq(<meta http-equiv="content-type" content="text/html; charset=EUC-JP">\n) if !($HNS::System::LessOutput); # print qq(<base href="$HNS::System::MyDiaryURI">\n) # if !($HNS::System::LessOutput); print qq(<base href="$HNS::System::MyDiaryURI">\n) if (!($HNS::System::LessOutput) && ($HNS::System::BaseOutput)) ; print qq(<link rev="made" href="mailto:$HNS::System::UserMail">\n) if !($HNS::System::LessOutput); .......
package HNS::System; ........ $BaseOutput = 0; # 1 -> "<base href=.." output (default), 0 -> don't output
. テーマdir単位での切り替えは、既存環境をいじる必要が少ないのでいいですね。 早速 localの日記環境に採用させていただきました(^^;
. 「head.txtやfoot.txtを使うと少し問題があるので、調整中。」とのことです が、これは head.txt/foot.txt を "$HNS::System::Theme/head.txt" で参照している箇所(HNS.pm)の影響だと思います。 なので、$theme_ph と同時に $HNS::System::Theme も書き換えてしまえば OK かと。
my $theme_ext = param('style') . "/theme.ph";
if (-f "$theme_ext") {
$theme_ph = $theme_ext;
$HNS::System::Theme = param('style');
}
$MyDiaryURI = "http://www.ceres.dti.ne.jp/~m-hase/diary/"; $BaseOutput = 1; # 1 -> <base href=.. ouput (default), 0 -> don't output
################################################################ ### Patch for Diary.pm ################################################################ package HNS::Diary; use vars qw($RawMode); # added $RawMode = 0; ### [0:Normal 1:RAW] # added use vars qw($RTMode @RTBuf); $RTMode = 0; ### [0:Normal 1:RT 2:/RT] @RTBuf = (); sub HnfPrint ($){ my $hnf_ = shift; ### RAW if( $hnf_ =~ /^<\!--RAW START-->/ ) { $RawMode = 1;} if( $hnf_ =~ /^<\!--RAW END-->/ ) { $RawMode = 0;} if( $RawMode == 1 ){ $hnf_ =~ s/&/&/g; $hnf_ =~ s/</</g; $hnf_ =~ s/>/>/g; } ### RT if( $hnf_ =~ /^<\!--RT START-->/ ) { $RTMode = 1; @RTBuf=(); return; } if( $hnf_ =~ /^<\!--RT END-->/ ) { $RTMode = 2; } if( $RTMode == 1 ) { push(@RTBuf, $hnf_); return; } elsif( $RTMode == 2 ){ my $cache = "$HNS::System::CacheDir/RTtool.tmp"; open (PIPE_O, "| ruby rt2html > $cache") || die "Can't Create Cache File.\n"; my $buf = join("",@RTBuf); print PIPE_O $buf; close(PIPE_O); $hnf_ = ""; open (PIPE_I, $cache) || die "Can't Open Cache File.\n"; while (<PIPE_I>) { $hnf_ .= $_; } close(PIPE_I); $RTMode = 0; } if ($HNS::System::Caching) { print X $hnf_; } else { $HNS::Diary::Hnf .= $hnf_; } } ################################################################ package HNS::Hnf::Command::New;; $AllowCommands = [ $HNS::Hnf::Command::New::AllowCommands,'RT']; package HNS::Hnf::Command::Sub; $AllowCommands = [ $HNS::Hnf::Command::Sub::AllowCommands,'RT']; ################################################################ ### RT package HNS::Hnf::Command::RT; use vars qw(@ISA $Template $EndTemplate $NumAttr $IsOneline $AllowCommands $IsBeginSection $CountName $OmittableEnd); @ISA = qw(HNS::Hnf::Command::Cite); $AllowCommands = [$HNS::Hnf::Command::Entities{'Inline'}]; $Template = "<!--RT START-->\n"; $EndTemplate = "<!--RT END-->\n"; $OmittableEnd = 1;
. 生HTMLで書いたら頭がこんがらがりそうな表も楽に記述できる。 RTtoolってすごいですね。
1 | 2 | ||||
5 | 6 | ||||
4 | 9 | 10 | |||
8 | 11 | ||||
7 | |||||
3 |
RT caption = ぐるぐる delimiter = : 1:==:==:==:==: 2 5:==:==:==: 6:|| 4: 9:==:10:||:|| ||: 8:11:||:||:|| ||:||: 7:==:==:|| ||: 3:==:==:==:== /RT
ふ | く | ざ | ||
つ | な | 表 | も | へっ |
ちゃら | で | |||
す | ね | 。 |
RT caption = 複雑な表 , ふ , く , == , ざ つ , な , 表 , も , へっ || ,ちゃら, == , || , で す , || , == , ね , 。 /RT
RT 1, 2, 3, 4 5, 6, 7, 8 9,10,11,12 /RT
1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 |
RT caption = テスト delimiter = : A: B: C: ==: D: E 1: 2: 3: 4: 5: 6 7: ==: ||: 8: ==: 9 10: 11: 12: ||: ==: 13 /RT
A | B | C | D | E | |
---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | |||
10 | 11 | 12 | 13 |
$Mode = 'auto'; # 'dynamic', 'static' or 'auto'.
デリミタ文字と そのまわりの空白だったので、それに併せて修正しました。 これでTABで適当に整形しながら","で区切る事が可能なハズ。
RT caption = RT(勝手に)拡張コマンド delimiter = : table_border = 2 tbody_span = 2 thead_bgcolor = skyblue tbody_bgcolor = lightgreen コマンド : == : 機能 全体 : table_border : 枠線の幅(ピクセル) || : table_width : テーブルの幅(ピクセルまたは%) || : table_height : テーブルの高さ(ピクセルまたは%) || : table_frame : 外枠の表示方法 (void,above,below,hsides,vsides,lhs,rhs,box,border) || : table_rules : 内側罫線の表示方法 (none,groups,rows,cols,all) ヘッダ部 : thead_bgcolor : BGCOLOR 指定 ボディ部 : tbody_span : 見出し扱いしたい列数(左から数えた数) || : tbody_width : セルの幅(ピクセル) || : tbody_align : セル配置(left,center,right) || : tbody_bgcolor : BGCOLOR 指定 /RT
コマンド | 機能 | |
---|---|---|
全体 | table_border | 枠線の幅(ピクセル) |
table_width | テーブルの幅(ピクセルまたは%) | |
table_height | テーブルの高さ(ピクセルまたは%) | |
table_frame | 外枠の表示方法 (void,above,below,hsides,vsides,lhs,rhs,box,border) | |
table_rules | 内側罫線の表示方法 (none,groups,rows,cols,all) | |
ヘッダ部 | thead_bgcolor | BGCOLOR 指定 |
ボディ部 | tbody_span | 見出し扱いしたい列数(左から数えた数) |
tbody_width | セルの幅(ピクセル) | |
tbody_align | セル配置(left,center,right) | |
tbody_bgcolor | BGCOLOR 指定 |
RT caption = RT 拡張コマンド delimiter = : table_border = 2 thead_bgcolor = skyblue tindex_span = 3 tindex_bgcolor= lightgreen tbody_bgcolor = white コマンド : == : == : 機能 TABLE全体: == : caption : 表の題名 || : == : delimiter : デリミタ || : == : table_class : スタイルシート指定 || : == : table_border : 枠線の幅(ピクセル) || : == : table_width : テーブルの幅(ピクセルまたは%) || : == : table_height : テーブルの高さ(ピクセルまたは%) || : == : table_frame : 外枠の表示方法 (void,above,below,hsides,vsides,lhs,rhs,box,border) || : == : table_rules : 内側罫線の表示方法 (none,groups,rows,cols,all) THEAD部 : == : thead_class : スタイルシート指定 || : == : thead_bgcolor : BGCOLOR 指定 TBODY部 :見出し: tindex_class : スタイルシート指定 || : || : tindex_span : グループ化する列数 || : || : tindex_width : セルの幅(ピクセル) || : || : tindex_align : セル配置(left,center,right) || : || : tindex_bgcolor: BGCOLOR 指定 || : 本体 : tbody_class : スタイルシート指定 || : || : tbody_span : グループ化する列数 || : || : tbody_width : セルの幅(ピクセル) || : || : tbody_align : セル配置(left,center,right) || : || : tbody_bgcolor : BGCOLOR 指定 /RT
コマンド | 機能 | ||
---|---|---|---|
TABLE全体 | caption | 表の題名 | |
delimiter | デリミタ | ||
table_class | スタイルシート指定 | ||
table_border | 枠線の幅(ピクセル) | ||
table_width | テーブルの幅(ピクセルまたは%) | ||
table_height | テーブルの高さ(ピクセルまたは%) | ||
table_frame | 外枠の表示方法 (void,above,below,hsides,vsides,lhs,rhs,box,border) | ||
table_rules | 内側罫線の表示方法 (none,groups,rows,cols,all) | ||
THEAD部 | thead_class | スタイルシート指定 | |
thead_bgcolor | BGCOLOR 指定 | ||
TBODY部 | 見出し | tindex_class | スタイルシート指定 |
tindex_span | グループ化する列数 | ||
tindex_width | セルの幅(ピクセル) | ||
tindex_align | セル配置(left,center,right) | ||
tindex_bgcolor | BGCOLOR 指定 | ||
本体 | tbody_class | スタイルシート指定 | |
tbody_span | グループ化する列数 | ||
tbody_width | セルの幅(ピクセル) | ||
tbody_align | セル配置(left,center,right) | ||
tbody_bgcolor | BGCOLOR 指定 |
. NoTable環境で、変換待ちの RTtool 要素を<pre>〜</pre>で出力するよ うにしただけですが。( theme.ph追加パッチ )
. ふと思ったが、キャッシュ有りの環境だとダメじゃん(^^;
. リンク自由ということで、富山いづみさんの きょうは何の日〜毎日が記念日〜 のページを使わせていただくことにしました。 theme.ph の変更点は以下の通り。
package HNS::Diary; $Head{dynamic} = qq( <h2><a class="hide" href="%href" name="%name">%year年%month月%day日(%week)</a> [<a href="$HNS::System::MyDiaryURI?%month%day">n年日記</a>] <a href="http://nnh.to/%month/%day.html">今日は何の日</a></h2> ); $Head{static} = qq( <h2><a class="hide" href="%href" name="%name">%year年%month月%day日(%week)</a> <a href="http://nnh.to/%month/%day.html">今日は何の日</a></h2> );それにしても、いっぱい記念日あるものですねぇ。 今日(6/24)がUFO記念日なんて知りませんでしたよ。
;;;---------------------------------------------------------------- ;;; ハイパー日記システム (hnf-mode.el) [2001/06/28] ;;;---------------------------------------------------------------- (autoload 'hnf "hnf-mode" nil t) (autoload 'hnf-mode "hnf-mode" nil t) (autoload 'yotei "hnf-yotei" nil t) (setq auto-mode-alist (cons '("\\.hnf$" . hnf-mode) auto-mode-alist)) (setq hnf-diary-dir "~/diary") (setq hnf-html-dir "~/public_html/diary") (setq hnf-diary-year-directory-flag t) (setq hnf-hour-not-today 6) (add-hook 'hnf-mode-load-hook '(lambda () (setq hnf-commands-table (append '( ("ISBN" . ((args . (("isbn" . ((face . hnf-link-face))) ("title"))))) ("CD" . ((args . (("code" . ((face . hnf-link-face))) ("title"))))) ("TABLE" . ((need-close) (insert-string-after-newline . "TR \nTD "))) ("TR" . ((insert-string-after-newline . "TD "))) ("TH") ("TD") ("RT" . ((need-close) (insert-string-after-newline . " caption = "))) ("TAG") ("RAW" . ((need-close)))) hnf-commands-table)))) (setq file-coding-system-alist (append '(("\\.hnf$" . euc-japan)) file-coding-system-alist))