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.3.0 lib/tdiary/rack/html_anchor.rb
tdiary-5.2.4 lib/tdiary/rack/html_anchor.rb
tdiary-5.2.3 lib/tdiary/rack/html_anchor.rb
tdiary-5.2.2 lib/tdiary/rack/html_anchor.rb
tdiary-5.2.1 lib/tdiary/rack/html_anchor.rb
tdiary-5.2.0 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.7 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/lib/tdiary/rack/html_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/lib/tdiary/rack/html_anchor.rb
tdiary-5.1.6 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/lib/tdiary/rack/html_anchor.rb
tdiary-5.1.5 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.4 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.3 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/lib/tdiary/rack/html_anchor.rb
tdiary-5.1.2 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/lib/tdiary/rack/html_anchor.rb
tdiary-5.1.1 lib/tdiary/rack/html_anchor.rb
tdiary-5.1.0 lib/tdiary/rack/html_anchor.rb
tdiary-5.0.14 lib/tdiary/rack/html_anchor.rb