Allow lines of dashes in route files

See #1180.
This commit is contained in:
mrkkrp 2016-03-11 14:09:57 +06:00
parent 8df56ecaa1
commit 3640d75c99
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 Yesod.Routes.TH
import Yesod.Routes.Overlap (findOverlapNames)
import Data.List (foldl')
import Data.List (foldl', isPrefixOf)
import Data.Maybe (mapMaybe)
import qualified Data.Set as Set
@ -86,7 +86,7 @@ resourcesFromString =
spaces = takeWhile (== ' ') thisLine
(others, remainder) = parse indent otherLines'
(this, otherLines') =
case takeWhile (/= "--") $ words thisLine of
case takeWhile (not . isPrefixOf "--") $ words thisLine of
(pattern:rest0)
| Just (constr:rest) <- stripColonLast rest0
, Just attrs <- mapM parseAttr rest ->

View File

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