haskell - 如何传递一个空白页面?
问题描述
我创建了一个简单的 yesod 应用程序,并想覆盖默认布局。
它可以在 Yesod 实例的 Foundation.hs 文件中被覆盖,如下所示:
instance Yesod App where
defaultLayout :: Widget -> Handler Html
defaultLayout widget = ([whamlet|<p>This is my page. I hope you enjoyed it.</p>|])
--do
-- master <- getYesod
-- mmsg <- getMessage
-- mcurrentRoute <- getCurrentRoute
-- -- Get the breadcrumbs, as defined in the YesodBreadcrumbs instance.
-- (title, parents) <- breadcrumbs
-- -- Define the menu items of the header.
-- let menuItems =
-- [ NavbarLeft $ MenuItem
-- { menuItemLabel = "Home"
-- , menuItemRoute = HomeR
-- , menuItemAccessCallback = True
-- }
-- ]
-- let navbarLeftMenuItems = [x | NavbarLeft x <- menuItems]
-- let navbarRightMenuItems = [x | NavbarRight x <- menuItems]
-- let navbarLeftFilteredMenuItems = [x | x <- navbarLeftMenuItems, menuItemAccessCallback x]
-- let navbarRightFilteredMenuItems = [x | x <- navbarRightMenuItems, menuItemAccessCallback x]
-- -- We break up the default layout into two components:
-- -- default-layout is the contents of the body tag, and
-- -- default-layout-wrapper is the entire page. Since the final
-- -- value passed to hamletToRepHtml cannot be a widget, this allows
-- -- you to use normal widget features in default-layout.
-- pc <- widgetToPageContent $ do
-- addStylesheet $ StaticR css_bootstrap_css
-- $(widgetFile "default-layout")
-- withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
如您所见,我试图用一个简单的文本输出覆盖,但它不会被编译。编译器抱怨:
A section must be enclosed in parentheses
thus: (whamlet |< p > This is my page . I hope you enjoyed it .</ p
>|)
|
88 | defaultLayout widget = [whamlet|<p>This is my page. I hope you enjoyed it.</p>|]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
我的目标是提供一个空白页面。
如何交付一个简单的空白页面?
解决方案
推荐阅读
- reactjs - TransformIgnore all react-native node modules for jest?
- css - 后跟ap时如何选择::after
- css - 让 nth-child 与添加的班级一起工作
- java - 如何在chrome中打开Websocket中定义的URI(写成java maven项目)?
- java - Spring Boot 运行 - 没有 manifest.mf
- ruby - 我需要覆盖权威范围,但我不知道如何
- ios - 检查 Firebase 登录状态
- javascript - WooCommerce 单品图片悬停放大闪烁
- apache - 组装自定义 Apache Sling 实例
- ecmascript-6 - 传播解构以避免重复