diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-16 22:28:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-16 22:28:42 -0400 |
commit | f7a0da1608b738d9665bb8f33abef55f55b7b14f (patch) | |
tree | fdbbb27513c65f622f83429927d3db74ad64960b /Build/EvilSplicer.hs | |
parent | 7e5dfb45dc1cc2970533efc89b07fdaab5d4d609 (diff) |
Splicer contines his evil ways (and Joey goes slowly insane)
Diffstat (limited to 'Build/EvilSplicer.hs')
-rw-r--r-- | Build/EvilSplicer.hs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs index 86dbc6f4c..d99283030 100644 --- a/Build/EvilSplicer.hs +++ b/Build/EvilSplicer.hs @@ -291,6 +291,7 @@ mangleCode :: String -> String mangleCode = declaration_parens . remove_declaration_splices . yesod_url_render_hack + . yesod_static_route_render_hack . nested_instances . collapse_multiline_strings . remove_package_version @@ -354,6 +355,45 @@ mangleCode = declaration_parens token :: Parser String token = many1 $ satisfy isAlphaNum <|> oneOf "-.'" +{- This works around a problem in the expanded template haskell for Yesod's + - static site route rendering. + - + - renderRoute (StaticR sub_a1nUH) + - = \ (a_a1nUI, b_a1nUJ) + - -> (((pack "static") : a_a1nUI), b_a1nUJ) + - (renderRoute sub_a1nUH) + - + - That is missing parens around the lambda expression (which + - is supposed to be applied to renderRoute). Add those parens. + -} +yesod_static_route_render_hack :: String -> String +yesod_static_route_render_hack = parsecAndReplace $ do + def <- string "renderRoute (StaticR sub_a1nUH)" + whitespace + string "= \\ (" + t1 <- token + string ", " + t2 <- token + string ")" + whitespace + f <- string "-> (((pack \"static\") : " + string t1 + string "), " + string t2 + string ")" + return $ concat + [ def + , " = (\\ (", t1, ",", t2, ") " + , f, t1, "), ", t2, "))" + ] + where + whitespace :: Parser String + whitespace = many $ oneOf " \t\r\n" + + token :: Parser String + token = many1 $ satisfy isAlphaNum <|> oneOf "_" + + {- This works around a problem in the expanded template haskell for Yesod - type-safe url rendering. - |