我试图了解如何使用Heist,但我发现的任何一个例子似乎都没有用,我似乎无法找到其他人遇到同样问题的我上午。我在这里找到了一些示例代码:
但是,当我尝试运行第一个示例时,出现以下错误:
Main.hs:20:15:
‘hcCompiledSplices’ is not a record selector
In the expression:
mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In an equation for ‘heistConfig’:
heistConfig
= mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In the expression:
do { let heistConfig = ...;
heistState <- either (error "oops") id
<$> (runEitherT $ initHeist heistConfig);
builder <- maybe (error "oops") fst
$ renderTemplate heistState "simple";
toByteStringIO B.putStr builder }
Main.hs:22:15:
‘hcTemplateLocations’ is not a record selector
In the expression:
mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In an equation for ‘heistConfig’:
heistConfig
= mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In the expression:
do { let heistConfig = ...;
heistState <- either (error "oops") id
<$> (runEitherT $ initHeist heistConfig);
builder <- maybe (error "oops") fst
$ renderTemplate heistState "simple";
toByteStringIO B.putStr builder }
我做错了什么?
答案 0 :(得分:3)
使用镜头似乎是现在做事的方法。
另外,我更改了模板<RelativeLayout
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center|bottom">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:layout_alignParentTop="true"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:orientation="vertical">
<LinearLayout
android:id="@+id/content_view_panes"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<WebView
android:id="@+id/mainWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<FrameLayout
android:id="@+id/listContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/colorPrimaryDark"
android:layout_below="@+id/content_view_panes"
android:visibility="gone"
android:id="@+id/saveCancelBar">
<Button
android:id="@+id/editorCancelButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/editor_cancel"
android:textColor="@color/white"
android:layout_alignParentLeft="true"
android:background="@color/colorPrimaryDark"/>
<Button
android:id="@+id/editorSaveButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/editor_save"
android:textColor="@color/white"
android:layout_alignParentRight="true"
android:background="@color/colorPrimaryDark"/>
</RelativeLayout>
</LinearLayout>
以使用代码simple.tpl
,而不只是<h:foo>...</h:foo>
。
<foo>...</foo>