Allow !# as well as #! #652

This commit is contained in:
Michael Snoyman 2014-01-11 19:51:04 +02:00
parent 12480b2d2a
commit 47d136b057
3 changed files with 7 additions and 1 deletions

View File

@ -184,6 +184,7 @@ ttToType (TTList t) = ListT `AppT` ttToType t
pieceFromString :: String -> Either String (CheckOverlap, Piece String) pieceFromString :: String -> Either String (CheckOverlap, Piece String)
pieceFromString ('#':'!':x) = Right $ (False, Dynamic x) pieceFromString ('#':'!':x) = Right $ (False, Dynamic x)
pieceFromString ('!':'#':x) = Right $ (False, Dynamic x) -- https://github.com/yesodweb/yesod/issues/652
pieceFromString ('#':x) = Right $ (True, Dynamic x) pieceFromString ('#':x) = Right $ (True, Dynamic x)
pieceFromString ('*':x) = Left x pieceFromString ('*':x) = Left x
pieceFromString ('+':x) = Left x pieceFromString ('+':x) = Left x

View File

@ -77,6 +77,8 @@ do
let resources = [parseRoutes| let resources = [parseRoutes|
/ HomeR GET / HomeR GET
/!#Int BackwardsR GET
/admin/#Int AdminR: /admin/#Int AdminR:
/ AdminRootR GET / AdminRootR GET
/login LoginR GET POST /login LoginR GET POST
@ -141,6 +143,9 @@ getAfter :: Handler site String; getAfter = "after"
getHomeR :: Handler site String getHomeR :: Handler site String
getHomeR = "home" getHomeR = "home"
getBackwardsR :: Int -> Handler site Text
getBackwardsR _ = pack "backwards"
getAdminRootR :: Int -> Handler site Text getAdminRootR :: Int -> Handler site Text
getAdminRootR i = pack $ "admin root: " ++ show i getAdminRootR i = pack $ "admin root: " ++ show i

View File

@ -1,5 +1,5 @@
name: yesod-routes name: yesod-routes
version: 1.2.0.5 version: 1.2.0.6
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>