我想使用 Yesod 中的莎士比亚模板(Licius + Hamlet + Julius)。但我对此有一些困难。此处输入链接描述中的以下代码有效:
type TestAPI
= "tests" :> Get '[JSON] [Test]
:<|> "test" :> Get '[JSON] Test
:<|> "TestHTML.html" :> Get '[HTML] Page_TestHTML
serverTestAPI :: ServerT TestAPI AppM
serverTestAPI = tests
:<|> test
:<|> testHtml
data Page_TestHTML = Page_TestHTML
instance ToMarkup Page_TestHTML where
toMarkup Page_TestHTML = builderHtml
testHtml = return Page_TestHTML
builderHtml = [shamlet|
$doctype 5
<html>
<head>
<title>Greeting2
<body>
<h2> Hello world HTML Qqqqq |]
但是下一个代码不起作用:
data Page_TestHTML_2 = Page_TestHTML_2
instance ToMarkup Page_TestHTML_2 where
toMarkup Page_TestHTML_2 = builderHtml_2
testHtml_2 = return Page_TestHTML_2
builderHtml_2 = do
$(luciusFile "templates/test/TestHTML2.lucius")
$(shamletFile "templates/test/TestHTML2.hamlet")
我如何为仆人(没有整个 Yesod)构建 Licius + Hamlet + Julius?