diff -ur hiki/html_formatter.rb hiki/html_formatter.rb --- hiki/html_formatter.rb 2003-02-23 11:20:08.000000000 +0900 +++ hiki/html_formatter.rb 2003-04-03 09:24:49.000000000 +0900 @@ -24,7 +24,7 @@ MAP[:ordered_list_open] = '
    ' MAP[:ordered_list_close] = '
' MAP[:listitem_open] = '
  • ' - MAP[:listitem_close] = '' + MAP[:listitem_close] = '
  • ' MAP[:blockquote_open] = '
    ' MAP[:blockquote_close] = '
    ' MAP[:definition_list_open] = '
    ' @@ -43,7 +43,13 @@ MAP[:strong_close] = '' MAP[:delete_open] = '' MAP[:delete_close] = '' - + MAP[:table_open] = '' + MAP[:table_close] = '
    ' + MAP[:table_row_open] = '' + MAP[:table_row_close] = '' + MAP[:table_data_open] = '' + MAP[:table_data_close] = '' + def initialize( s, db, plugin, suffix = 'l') @tokens = s @db = db diff -ur hiki/parser.rb hiki/parser.rb --- hiki/parser.rb 2003-03-24 17:10:48.000000000 +0900 +++ hiki/parser.rb 2003-04-04 00:11:23.000000000 +0900 @@ -34,6 +34,7 @@ IMAGE = '\.(?:jpg|jpeg|png|gif)' PLUGIN = '\{\{(.+?)(?:\((.*?)\))?\s*\}\}' SPECIAL = '^\[\]\'=\{\}' + TABLE = '\|\|(.*)' EMPHASIS_RE = /^#{EMPHASIS}/ STRONG_RE = /^#{STRONG}(?!:')/ @@ -46,6 +47,7 @@ INTERWIKI_RE = /^#{INTERWIKI}/ IMAGE_RE = /#{IMAGE}$/i PLUGIN_RE = /^#{PLUGIN}/ + TABLE_RE = /^#{TABLE}/ def parse( s ) @stack = HikiStack::new @@ -84,6 +86,9 @@ @cur_stack.push( {:e => :empty} ) when /^\s(.*)/ @cur_stack.push( {:e => :pre, :s => $1} ) + when /^#{TABLE}/ + @cur_stack.push( {:e => :table} ) + inline( line ) when /^#{PLUGIN}\s*$/ if $use_plugin @cur_stack.push( {:e => :plugin, :method => $1, :param => $2} ) @@ -169,6 +174,15 @@ when WIKINAME_RE str = ($2 || '') + $' @cur_stack.push ( {:e => :wikiname, :s => $1} ) + when TABLE_RE + @cur_stack.push( {:e => :table_row_open} ) + $1.split( /\|\|/ ).each do |s| + @cur_stack.push( {:e => :table_data_open} ) + inline (s) + @cur_stack.push( {:e => :table_data_close} ) + end + @cur_stack.push( {:e => :table_row_close} ) + str = '' when NORMAL_TEXT_RE m = $& after = $' @@ -264,6 +278,12 @@ end e[:e] = :normal_text ns.push( e ) + when :table + if type != @last_blocktype.last + close_blocks( ns, block_level ) + ns.push( {:e => "#{type}_open".intern} ) + @last_blocktype.push type + end when :emphasis_close, :strong_close, :delete_close ns.push ( e ) else diff -ur data/text/TextFormattingRules data/text/TextFormattingRules --- data/text/TextFormattingRules 2003-03-24 17:10:48.000000000 +0900 +++ data/text/TextFormattingRules 2003-04-04 00:28:31.000000000 +0900 @@ -234,6 +234,19 @@ :ゴリラ:gorilla :ラクダ:camel +!表 +表(テーブル)は「||」で始め、以下のように書きます。 + +*記述例 + + ||項目1-1||項目1-2||項目1-3 + ||項目2-1||項目2-2||項目2-3 + +*出力例 + +||項目1-1||項目1-2||項目1-3 +||項目2-1||項目2-2||項目2-3 + !プラグイン 「{」2つと「}」2つで囲むとプラグインを呼び出すことができます。