# bq.rb $Revision: 1.2.2.1 $ # # bq: blockquoteを使った引用を生成する # パラメタ: # src: 引用するテキスト # title: 引用元のタイトル # url: 引用元のURL # # 引用元タイトルをうまく表示するには、スタイルシートでp.sourceを # 定義する必要があります。スタイルの例: # # p.source { # margin-top: 0.3em; # text-align: right; # font-size: 90%; # } # # Copyright (C) 2002 s.sawada # You can redistribute it and/or modify it under GPL2. # def bq( src, title = nil, url = nil ) if url then result = %Q[
\n] elsif title result = %Q[
\n] else result = %Q[
\n] end result << %Q[

#{src.gsub( /\n/, "

\n

" )}

\n].sub( %r[

], '' ) result << %Q[
\n] if url then result << %Q[

[#{title}より引用]

\n] elsif title result << %Q[

[#{title}より引用]

\n] end result end