You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
このブログはJadeを使いたかったという経緯からhamlish-jinjaを使っているんだけど、pyjadeが出来てたので両方で書いてみた。 左がjadeで右がhamilish jadeはhamlishと違って%とか-みたいな記号がいらなくて、Node.jsのjadeと同じように書けるし、Jinjaのタグも自然な感じで直感的にかけるので、やっぱJadeのほうが好みかな。 ただ、url_forでsingle quoteとdouble quoteの使い分けではまった。 a.title(href="{{ url_for('show_entries', entry=entry.perma, _external=True) }}")
Today I wrote a little Django to Jinja2 template converter. While it can translate most of the builtin template tags into Jinja constructs it doesn't fully automate the process because you have to extend it for your own custom tags and it doesn't adapt your templates to the changed semantics.And these differences in semantics (and the underlying architecture) are something I want to discuss a bit
>>> from django.template import Lexer, StringOrigin >>> origin = StringOrigin("Hello {{ name|upper }}!") >>> for token in Lexer(origin.source, origin).tokenize(): ... print token ... <Text token: "Hello ..."> <Var token: "name|upper..."> <Text token: "!..."> So as you can see, whereas Jinja creates very tiny bits of the input string, Django only distinguishes between four different kinds of token
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く