Makoのテンプレート継承について、ドキュメントを読みながら確認してみました。はじめはこのドキュメントを翻訳しようとしていたのですが、原文の説明がちょっと回りくどい感じがしたので、それは省略。わざわざPylonsプロジェクトを作るのも面倒なので、次のようなスクリプトを用意し、コマンドラインから試してみます。必要なテンプレートは、templatesというディレクトリの下に置いています。 from mako.lookup import TemplateLookup lookup = TemplateLookup(directories=['templates']) tmpl = lookup.get_template('c.html') print tmpl.render() 単純な継承c.htmlがa.htmlを継承するという一番単純なケースです。 ## a.html html> head>
Hyperfast and lightweight templating for the Python platform. Mako Templates for Python Mako is a template library written in Python. It provides a familiar, non-XML syntax which compiles into Python modules for maximum performance. Mako's syntax and API borrows from the best ideas of many others, including Django and Jinja2 templates, Cheetah, Myghty, and Genshi. Conceptually, Mako is an embedded
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く