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
love
V2EX  ›  Python

看到一个脑洞大开的用 python 直接作模板语法的模板引擎

  •  
  •   love · 2014-08-13 22:59:23 +08:00 · 4486 次点击
    这是一个创建于 3534 天前的主题,其中的信息可能已经有所发展或是发生改变。
    之前以为这是不可能的,因为python的语法比较严格,又有缩进,又没block语法,直接当DSL来写模板一定会死得很惨,直到看到这个奇葩:

    http://breve.twisty-industries.com/documentation

    把python模板写得几乎有原版HTML一样的可读性。
    6 条回复    2014-08-15 09:52:04 +08:00
    WildCat
        1
    WildCat  
       2014-08-13 23:13:00 +08:00 via iPad
    Jade躺枪,TJ大大泪目
    fwee
        2
    fwee  
       2014-08-13 23:17:15 +08:00
    现在知道大括号的好了?
    love
        3
    love  
    OP
       2014-08-13 23:28:00 +08:00
    @WildCat 关Jade什么事?
    lyhapple
        4
    lyhapple  
       2014-08-14 09:18:59 +08:00
    果是个奇葩, 只有想不到,没有做不到.
    skywalker
        5
    skywalker  
       2014-08-14 09:38:24 +08:00   ❤️ 1
    编程语言直接做模板,看到过最舒服的是CoffeeKup
    bombless
        6
    bombless  
       2014-08-15 09:52:04 +08:00
    这个的确是Jade风格。
    在Jade之前包括Racket在内的Lisp系就是这种风格了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1165 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:23 · PVG 02:23 · LAX 11:23 · JFK 14:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.