2011年7月25日月曜日

Text::Xslateのcascade


このエントリーをはてなブックマークに追加


参考ページ


http://perl-users.jp/articles/advent-calendar/2010/casual/8
http://search.cpan.org/~gfuji/Text-Xslate/lib/Text/Xslate/Syntax/Kolon.pm
http://pixiv.cc/himachoco/tag/Xslate


環境


mojoliciousとText::Xslate(Kolon)


基本


welcome.html.tx を呼び出した際に、wrapper.txでラップする。



# welcome.html.tx
<p>xslate render this</p>




# wrapper.tx
<!DOCTYPE html>
<html>
<head></head>
<body>
</body>
</html>



継承


wrapper.txを別テンプレートを利用して組み立てる。



<!DOCTYPE html>
<html>
<body>
</body>
</html>




# head.tx
<head>
<meta hoge />
</head>



でも、この場合は継承する必要もなかったから
: include inc::head で読み込むだけでいいか。


todo


今のままだと全部のファイルに
: cascade inc::wrapper # template/inc/wrapper.tx
: around main -> {
: }
を書かないといけないんだけど、どうやるんだろう。。。





0 件のコメント:

コメントを投稿