Sha256: 56f4bfcaea48fba089190b34381184ff668f3c03d4b0b15bd5335ae25496adc5

Contents?: true

Size: 708 Bytes

Versions: 52

Compression:

Stored size: 708 Bytes

Contents

# Copyright (C) 2011, KADO Masanori <kdmsnr@gmail.com>
# You can redistribute it and/or modify it under GPL.
#
# section_link_anchor.rb
# - enables section link with mod_rewrite
# - depends on section_link.rb
#
# sample .htaccess:
# <IfModule mod_rewrite.c>
#    RewriteEngine on
#    RewriteRule ^([0-9\-]+)p?([0-9]*)\.html$ ?date=$1&section=$2 [L]
# </IfModule>

def anchor( s )
	if /^([\-\d]+)#?([pct]\d*)?$/ =~ s then
		if $2 then
			s1 = $1
			s2 = $2
			if $2 =~ /^p/
				"#{s1}p#{s2.gsub(/p/, '')}.html"
			else
				"#{s1}.html##{s2}"
			end
		else
			"#$1.html"
		end
	else
		""
	end
end

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

Version data entries

52 entries across 46 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.2.4 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.2.3 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.2.2 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.2.1 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.2.0 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.7 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.6 util/section_link/misc/plugin/section_link_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-contrib-5.1.4/util/section_link/misc/plugin/section_link_anchor.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.5 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.4 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.3 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.2 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.1 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.1.0 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.0.13 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.0.12 util/section_link/misc/plugin/section_link_anchor.rb
tdiary-contrib-5.0.11 util/section_link/misc/plugin/section_link_anchor.rb