Merge pull request #1182 from mrkkrp/master

Allow lines of dashes in route files
This commit is contained in:
Michael Snoyman 2016-03-13 08:24:57 +02:00
commit 292270f36a
2 changed files with 4 additions and 2 deletions

View File

@ -18,7 +18,7 @@ import Language.Haskell.TH.Quote
import qualified System.IO as SIO import qualified System.IO as SIO
import Yesod.Routes.TH import Yesod.Routes.TH
import Yesod.Routes.Overlap (findOverlapNames) import Yesod.Routes.Overlap (findOverlapNames)
import Data.List (foldl') import Data.List (foldl', isPrefixOf)
import Data.Maybe (mapMaybe) import Data.Maybe (mapMaybe)
import qualified Data.Set as Set import qualified Data.Set as Set
@ -86,7 +86,7 @@ resourcesFromString =
spaces = takeWhile (== ' ') thisLine spaces = takeWhile (== ' ') thisLine
(others, remainder) = parse indent otherLines' (others, remainder) = parse indent otherLines'
(this, otherLines') = (this, otherLines') =
case takeWhile (/= "--") $ words thisLine of case takeWhile (not . isPrefixOf "--") $ words thisLine of
(pattern:rest0) (pattern:rest0)
| Just (constr:rest) <- stripColonLast rest0 | Just (constr:rest) <- stripColonLast rest0
, Just attrs <- mapM parseAttr rest -> , Just attrs <- mapM parseAttr rest ->

View File

@ -78,6 +78,8 @@ do
let resources = [parseRoutes| let resources = [parseRoutes|
/ HomeR GET / HomeR GET
----------------------------------------
/!#Int BackwardsR GET /!#Int BackwardsR GET
/admin/#Int AdminR: /admin/#Int AdminR: