V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
redhatping
V2EX  ›  Python

python, dj---html 模板语句中是什么语法? (已上代码)

  •  
  •   redhatping · 2015-05-10 16:19:49 +08:00 · 2597 次点击
    这是一个创建于 3281 天前的主题,其中的信息可能已经有所发展或是发生改变。
    $def with (greeting)

    <html>
    <head>
    <title>Gothons Of Planet Percal #25</title>
    </head>
    <body>

    $if greeting:
    I just wanted to say <em style="color: green; font-size: 2em;">$greeting</em>.
    $else:
    <em>Hello</em>, world!

    </body>
    </html>

    $def with (greeting) 以及 $if greeting是撒语言啊?
    6 条回复    2015-05-11 09:32:18 +08:00
    Livid
        1
    Livid  
    MOD
       2015-05-10 16:21:43 +08:00
    模版自己的语言。
    imlonghao
        2
    imlonghao  
       2015-05-10 16:55:33 +08:00 via Android
    楼主你的 dj--- 是 Django 的意思么?
    我认为是模板自己的语言
    redhatping
        3
    redhatping  
    OP
       2015-05-10 17:17:30 +08:00 via iPhone
    打错字了,web.py,模板下
    FingerLiu
        4
    FingerLiu  
       2015-05-11 09:14:57 +08:00
    @imlonghao 貌似不是 django, django 里没这么神奇的语法。
    wizardoz
        5
    wizardoz  
       2015-05-11 09:31:23 +08:00
    我就说嘛,看这模板应该是webpy的模板。
    这个木板用的就是python的语法啊。只是在python代码加上了“$”而已。
    wizardoz
        6
    wizardoz  
       2015-05-11 09:32:18 +08:00
    $if greeting:

    就是python中的:
    if greeting:
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2233 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:40 · PVG 17:40 · LAX 02:40 · JFK 05:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.