Sha256: 59b6519ced37b9c85b786063b33d45f668d3b317b7328bf35439e4d78d5104a8

Contents?: true

Size: 1.28 KB

Versions: 38

Compression:

Stored size: 1.28 KB

Contents

# bq.rb
#
# 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 <moonwave@ba2.so-net.ne.jp>
# You can redistribute it and/or modify it under GPL2 or any later version.
#
def bq( src, title = nil, url = nil )
	if url
		result = %Q[<blockquote cite="#{h url}" title="#{h title}">\n]
	elsif title
		result = %Q[<blockquote title="#{h title}">\n]
	else
		result = %Q[<blockquote>\n]
	end
	result << %Q[<p>#{src.gsub( /\n/, "</p>\n<p>" )}</p>\n].sub( %r[<p></p>], '' )
	result << %Q[</blockquote>\n]
	if url
		cite = %Q[<cite><a href="#{h url}" title="#{h bq_cite_from( title )}">#{title}</a></cite>]
		result << %Q[<p class="source">[#{bq_cite_from cite}]</p>\n]
	elsif title
		cite = %Q[<cite>#{title}</cite>]
		result << %Q[<p class="source">[#{bq_cite_from cite}]</p>\n]
	end

	result
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:

Version data entries

38 entries across 28 versions & 1 rubygems

Version Path
tdiary-5.3.0 misc/plugin/bq.rb
tdiary-5.2.4 misc/plugin/bq.rb
tdiary-5.2.3 misc/plugin/bq.rb
tdiary-5.2.2 misc/plugin/bq.rb
tdiary-5.2.1 misc/plugin/bq.rb
tdiary-5.2.0 misc/plugin/bq.rb
tdiary-5.1.7 misc/plugin/bq.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/misc/plugin/bq.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/bq.rb
tdiary-5.1.6 misc/plugin/bq.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/bq.rb
tdiary-5.1.5 misc/plugin/bq.rb
tdiary-5.1.4 misc/plugin/bq.rb
tdiary-5.1.3 misc/plugin/bq.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/bq.rb
tdiary-5.1.2 misc/plugin/bq.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/bq.rb
tdiary-5.1.1 misc/plugin/bq.rb
tdiary-5.1.0 misc/plugin/bq.rb
tdiary-5.0.14 misc/plugin/bq.rb