問題タブ [hamlet]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
48 参照

haskell - Hamlet ブロックを引数として関数に渡す方法はありますか?

を受け取り、 HTML でラップする汎用content :: Widget -> Widgetヘルパーがあるとします。Widget

Ruby on Rails で行うのと同様に、この関数を Hamlet ファイル内でインラインで引数を指定して呼び出すことはできますか? たとえばlink_to、URL とそのコンテンツを受け取る helper があるとします。次のように呼び出すことができます。

お譲りし<a href="/some_url"><span class="icon"/>Click me</a>ます。

任意の Hamlet スニペットを関数の引数としてテンプレートに直接渡すことができる、Hamlet に同様のパターンはありますか?

0 投票する
1 に答える
107 参照

haskell - 純粋なコードで whamlet を実行しますか?

yesod アプリケーションで、 graphvizによってレンダリングされるグラフの URL 属性を作成し、補間を使用したいと考えています。理想的には、

もちろん、型は一致しません。

  • の属性URLは pureTextですが、whamletモナディックです (ウィジェット)
  • で置き換えるとshamlet、タイプは問題ありませんが、補間できません。URL interpolation used, but no URL renderer provided

これを解決する簡単な方法はありますか?

0 投票する
1 に答える
112 参照

yesod - Yesod Mform and hamlet

Hi I am new to yesod and following the documentation to make a form. In the documentation the form template was created in .hs file itself. But I have a separate hamlet where I want to customize.

I want to access "fields" in my hamlet file. The expected type of 'generateFormPost' is (xml, Enctype) . Can anybody tell me what I should be returning from 'tableMform extra' . I think it should be in xml format. But I think I should not be using toWidget as in below example of documentation.

#xA;

Please let me know if there is any misunderstanding. I have idea of how to get the form from the way done in the documentation, but I want to use a separate hamlet file, as I want to customize the look of the form.

Thanks Sai

EDIT: Sorry, I wasn't clear. I was trying to make a Mform where instead of creating the layout of the form in the ".hs" file , I wanted to give the layout in hamlet file. I have done it through http://pastebin.com/fwpZsKXy . But after doing that I could split it in to two files as I wanted. I have solved those errors. Thanks anyways

0 投票する
1 に答える
37 参照

haskell - Hamlet ライブラリからのインポートが見つからない

これは、O reilly - Yesod - Widgetsのコード スニペットです。

このコードはエラーを生成します。

からのモジュールは何Hamletですか。これを機能させるためにインポートする必要がありますか? haskell には、モジュール名を検索して自動インポートしようとする自動補完機能がありますか?

0 投票する
1 に答える
134 参照

haskell - Yesod: きれいな html を出力する方法

きれいにフォーマットされたhtmlを印刷するにはどうすればよいですか?

のようなものが欲しいapp.locals.pretty = trueExpressJS: きれいな html を出力する方法

0 投票する
1 に答える
161 参照

haskell - ハムレットシェイクスピアリアン(yesod/haskell)テンプレートのSVGタグ?

ハムレットにタグを含める方法はありますか? そうでない場合、回避策/代替手段は何ですか?

0 投票する
3 に答える
176 参照

haskell - Hamlet テンプレートのコンパイル時と実行時のコスト

Hamletテンプレート メカニズムについては、コンパイル時にテンプレートが解析され、blaze-html コンビネータ (および補間による他の式) への呼び出しを含むソース コードが生成されることを理解しています。したがって、補間が発生するポイント (サブツリー) はコンパイル時に認識されます。

実行時に、補間された値を計算し (もちろん)、ツリーに「プラグイン」する必要があります。つまり、html コンビネータを適用します。それらのすべて?実際、これらのアプリケーションの一部はコンパイル時に評価できます (下に補間がないもの)。これは起こりますか?

0 投票する
1 に答える
106 参照

haskell - データベースを使用して Yesod の管理者権限を確認する

これらの Yesod book examplesisAdminと同様の方法で関数を実装しようとしています。問題は、「管理者」の電子メールをデータベースに保持したいのですが、データベースクエリを実行すると、その純粋さが失われるため、. さて、これはハムレットでそれを可能にする非常に優れた構文シュガーを廃棄します:isAdminHandler-something IO BoolBool

isAdminデータベースを呼び出しても純粋な関数を保持する方法はありますisAdminか? それとも$if、不純な関数で構文を使用できますか?

PS: 現在、ハンドラー モジュールでハックを使用しています。

したがって、そのハンドラに対応するハムレットに次のように記述できます。

しかし、それは普遍的ではなく、最初の方法がより好きです。