Sha256: bef956f072563b8d5a5982712ba9dadf27fca67c418c240a376a7104e4ba9c50

Contents?: true

Size: 961 Bytes

Versions: 38

Compression:

Stored size: 961 Bytes

Contents

# number_anchor.rb
#
# number_anchor: アンカーにid属性を付加する
#          アンカー画像を異なるものにするためのもの
# 	   使用するさいは、設定画面のヘッダに
#	   <%= use_number_anchor( アンカーの種数 ) %>
#	   と書いてください。
#
# Copyright (C) 2002 by zoe <http://www.kasumi.sakura.ne.jp/~zoe/tdiary/>
# Distributed under the GPL2 or any later version.
#

def use_number_anchor( n = 1 )
	@use_number_anchor = true
	@total_anchor = n
	""
end

alias :_orig_anchor :anchor

def anchor( s )
	if @use_number_anchor == true then
	if /^(\d+)#?([pct])?(\d*)?$/ =~ s then
		if $2 then
			n = $3.to_i
			if n && n > @total_anchor then
				n = (n % @total_anchor)
			end
			"#{_orig_anchor(s)}\" class=\"#$2#{'%02d' % n}"
		else
			_orig_anchor(s)
		end
	else
		""
	end
	else
		_orig_anchor(s)
	end
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/number_anchor.rb
tdiary-5.2.4 misc/plugin/number_anchor.rb
tdiary-5.2.3 misc/plugin/number_anchor.rb
tdiary-5.2.2 misc/plugin/number_anchor.rb
tdiary-5.2.1 misc/plugin/number_anchor.rb
tdiary-5.2.0 misc/plugin/number_anchor.rb
tdiary-5.1.7 misc/plugin/number_anchor.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/misc/plugin/number_anchor.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/number_anchor.rb
tdiary-5.1.6 misc/plugin/number_anchor.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/misc/plugin/number_anchor.rb
tdiary-5.1.5 misc/plugin/number_anchor.rb
tdiary-5.1.4 misc/plugin/number_anchor.rb
tdiary-5.1.3 misc/plugin/number_anchor.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/number_anchor.rb
tdiary-5.1.2 misc/plugin/number_anchor.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/misc/plugin/number_anchor.rb
tdiary-5.1.1 misc/plugin/number_anchor.rb
tdiary-5.1.0 misc/plugin/number_anchor.rb
tdiary-5.0.14 misc/plugin/number_anchor.rb