yowa
yowak****@cool*****
2003年 4月 3日 (木) 17:15:47 JST
ょゎです。 「:[Goole|http://www.google.com]: 検索エンジン」のように、 用語解説中に ':' があると誤動作する問題の(かなりアドホックな)パッチです。 --- parser.rb.orig 2003-03-24 17:10:48.000000000 +0900 +++ parser.rb 2003-03-27 06:42:21.000000000 +0900 @@ -71,13 +71,28 @@ @cur_stack.push( {:e => :ordered_listitem_close} ) when /^""(.*)$/ @cur_stack.push( {:e => :blockquote, :s => $1} ) - when /^:(.+?):(.+)$/ + when /^:(.+)$/ @cur_stack.push( {:e => :definition_list_open} ) @cur_stack.push( {:e => :definition_term_open} ) + # スタックを一時退避 + cur_stack_backup = @cur_stack + @cur_stack = HikiStack::new + # ベタなテキストだと思って parse inline( $1 ) - @cur_stack.push( {:e => :definition_term_close} ) - @cur_stack.push( {:e => :definition_desc_open} ) - inline( $2 ) + # スタックをもどす + tmp_stack = @cur_stack + @cur_stack = cur_stack_backup + tmp_stack.each do |elem| + # normal_text 中の ':' → 用語解説の区切り + if elem[:e] == :normal_text && /^(.*):(.*)$/ =~ elem[:s] + @cur_stack.push( {:e => :normal_text, :s => $1 } ) + @cur_stack.push( {:e => :definition_term_close} ) + @cur_stack.push( {:e => :definition_desc_open} ) + @cur_stack.push( {:e => :normal_text, :s => $2 } ) + else + @cur_stack.push( elem ) + end + end @cur_stack.push( {:e => :definition_desc_close} ) @cur_stack.push( {:e => :definition_list_close} ) when /^$/ ------------------------------ ょゎ <mailto:yowak****@cool*****> # http://yowaken.dip.jp/ はお休み中