From: Kazuhiko <kaz...@fd...> - 2003-08-28 02:48:10
|
かずひこです。 At Thu, 28 Aug 2003 10:25:21 +0900, TADA Tadashi wrote: > (1) RDスタイルのプレビューでエラー > >追記するときに、 > > > >=テスト > > > >と記入して、「テスト」の後ろに改行を入れないでプレビューボタンを押すと > >以下のようなエラーが発生します。改行を入れればエラーは起きません。 > > > >/usr/lib/ruby/1.8/erb.rb:419:in `eval': /home/tdiary/tdiary/core/tdiary/rd_style.rb:217:in `dup': can't dup NilClass (TypeError) > > > >/usr/lib/ruby/1.8/erb.rb:419:in `eval' > >/usr/lib/ruby/1.8/erb.rb:419:in `result' > >/home/tdiary/tdiary/core/tdiary.rb:831:in `do_eval_rhtml' > >/home/tdiary/tdiary/core/tdiary.rb:1019:in `eval_rhtml' > >/home/tdiary/users/snak/update.rb:62 wiki_style.rb でやってるのと同じような処理が必要みたい。 diff -u -r1.12 rd_style.rb --- rd_style.rb 29 Jul 2003 02:09:28 -0000 1.12 +++ rd_style.rb 28 Aug 2003 02:37:01 -0000 @@ -202,6 +202,9 @@ @subtitle = nil @body = fragment.dup end + @body = @body || '' + @body.sub!( /[\n\r]+\Z/, '' ) + @body << "\n" @categories = get_categories @stripped_subtitle = strip_subtitle > (2) RDスタイルで段落が繋がる > >もう一つ、RDスタイル関係なのですが、以下のようにすると > >段落が繋がってしまいます。 > > > >1. 普通に文章を書き保存する。ただし、最後の行末に改行を > >入れない > >2. 適当な文書を追記し保存する。この時点では正しく表示さ > >れる > >3. 編集ボタンを押して編集画面にする。そうすると、2の最 > >初の行が1の最後の行と繋がってしまっている > >4. そのまま保存すると、当たり前ですが段落が繋がってしま > >う > > > >改行を入れていないので繋がってしかるべきかもしれませんが、 > >改行が自動的に挿入されるようになっている方が混乱がないの > >ではないかと思います。 これは、同じ問題が wiki スタイルでも起きますね。なので、 上記の "\n" を追加するところで "\n\n" を追加することにしました。 ちょっと試してみたところ、両方とも解決しているようです。 よろしければ wiki スタイルともどもコミットします。 -- かずひこ <http://wiki.fdiary.net/kazuhiko/> ★シャア「名字が付いてない」 ☆一兵卒「あんなの飾りです。偉い人にはそれが分からんのです」 |