Sha256: 2f282feea4246d01c7e503fdebaf56468d9599336b6c92886600bf562cd15989

Contents?: true

Size: 576 Bytes

Versions: 38

Compression:

Stored size: 576 Bytes

Contents

require 'rack/request'

module TDiary
	module Rack
		class HtmlAnchor
			def initialize( app )
				@app = app
			end

			def call( env )
				if env['PATH_INFO'].match(/(.*\/)([0-9\-]+)(p(\d\d))?\.html$/)
					env["PATH_INFO"] = $1
					date = $2
					anchor = $4
					env["QUERY_STRING"] += "&" unless env["QUERY_STRING"].empty?
					env["QUERY_STRING"] += "date=#{date}"
					env["QUERY_STRING"] += "&p=#{anchor}" if anchor
				end
				@app.call( env )
			end
		end
	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.0.13 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.12.1 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.11 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.10 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.9 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/lib/tdiary/rack/html_anchor.rb
tdiary-5.0.8 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.7 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.6 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.5 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/tdiary-5.0.3/lib/tdiary/rack/html_anchor.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/lib/tdiary/rack/html_anchor.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.3/lib/tdiary/rack/html_anchor.rb
tdiary-5.0.4 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.4 vendor/bundle/gems/tdiary-5.0.3/lib/tdiary/rack/html_anchor.rb
tdiary-5.0.3 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.2 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.1 lib/tdiary/rack/html_anchor.rb