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