閑舎
raku****@rakun*****
2003年 5月 13日 (火) 01:15:12 JST
皆さん、こんにちは。 先日、ML にて Hiki のことを聞き、0.5 をダウンロードして試させてもらっ ています。表が使えるようになったとのことですが、属性値がデフォルトのまま なので、もう少し変えたほうがうれしいと思っているうち、やはり、中央/左/右 揃えもサポートしてもらったほうがうれしいので、いろいろいじっているうち、 まずまず動作するようになりました。何か見当はずれのことをしているかもしれ ませんが、折角なのでポストしておきます。よかったら使ってください。また、 タグはこれ以外にもいろいろ考えられると思うので、多少変更されても構いませ ん。 diff -ur default.org/parser.rb default/parser.rb --- default.org/parser.rb Tue Apr 29 15:15:46 2003 +++ default/parser.rb Tue May 13 01:08:02 2003 @@ -72,6 +72,14 @@ @cur_stack.push( {:e => :heading_close, :lv => $1.size} ) when /^----/ @cur_stack.push( {:e => :horizontal_rule} ) + when /^CENTER</ + @cur_stack.push( {:e => :center_open} ) + when /^RIGHT</ + @cur_stack.push( {:e => :right_open} ) + when /^LEFT</ + @cur_stack.push( {:e => :left_open} ) + when /^(CENTER|RIGHT|LEFT)>/ + @cur_stack.push( {:e => :div_close} ) when /^(\*{1,3})(.+)$/ @cur_stack.push( {:e => :unordered_list, :lv => $1.size} ) @cur_stack.push( {:e => :listitem_open} ) @@ -242,6 +250,19 @@ @last_blocktype.clear when :empty close_blocks( ns, block_level ) + when :center_open, :right_open, :left_open + if type != @last_blocktype.last + close_blocks( ns, block_level ) + ns.push( {:e => "#{type}_open".intern} ) + @last_blocktype.push type + end + ns.push( e ) + when :div_close + if type != @last_blocktype.last + close_blocks( ns, block_level ) + ns.push( {:e => "div_close".intern} ) + end + @last_blocktype.pop when :unordered_list, :ordered_list close_blocks( ns, block_level ) if type != @last_blocktype.last cur_lv = e[:lv] diff -ur default.org/html_formatter.rb default/html_formatter.rb --- default.org/html_formatter.rb Wed Apr 30 09:06:39 2003 +++ default/html_formatter.rb Mon May 12 23:20:46 2003 @@ -37,6 +37,10 @@ MAP[:pre_open] = '<pre>' MAP[:pre_close] = '</pre>' MAP[:p_open] = '<p>' + MAP[:right_open] = '<div align=right>' + MAP[:left_open] = '<div align=left>' + MAP[:center_open] = '<div align=center>' + MAP[:div_close] = '</div>' MAP[:p_close] = '</p>' MAP[:emphasis_open] = '<em>' MAP[:emphasis_close] = '</em>' @@ -44,7 +48,7 @@ MAP[:strong_close] = '</strong>' MAP[:delete_open] = '<del>' MAP[:delete_close] = '</del>' - MAP[:table_open] = '<table border="1">' + MAP[:table_open] = '<table border=1 hspace=2 cellspacing=1 cellpadding="3">' MAP[:table_close] = '</table>' MAP[:table_row_open] = '<tr>' MAP[:table_row_close] = '</tr>' サンプルページ RIGHT< CENTER< ||A||[[モナー|http://www.namaraii.com/hiki/theme/hiki/hiki.png]]|| ||B||{{attach_anchor(http://www.namaraii.com/hiki/theme/hiki/hiki.png)}}|| CENTER> ---- {{attach_form}} *aaa *bbb 書き方は[[TextFormattingRules]]を参照。 2003/05/13 閑舎 RIGHT> 後書き -- 本田博通(閑舎) テキストとスクリプトの http://rakunet.org/TSNET/