Plim 中文文档¶
Plim 是 Ruby Slim 模版 的 Python 移植版本基于 Mako Templates ,并使用 Mako 预处理特性 将其语法转换为符合 HTML/Mako 标准的标签。
安装指南¶
pip install Plim
示例¶
/ base.html
--------------------------
doctype html
html = next.body()
/ helpers.html
--------------------------
-def other_headers()
meta charset="utf-8"
link rel="stylesheet" href="/static/css/main.css"
/ layout.html
--------------------------
-inherit base.html
-namespace name="helper" helpers.html
head
title Plim Example
meta name="keywords" content="template language"
= helper.other_headers()
script
/* "script" and "style" blocks do not require explicit literal indicator "|" */
$(content).do_something();
style
body {
background:#FFF;
}
-scss
/* SCSS/SASS extension */
@option compress: no;
.selector {
a {
display: block;
}
strong {
color: blue;
}
}
-coffee
# CoffeeScript extension
square = (x) -> x * x
body
h1 Markup examples
#content.example1
p Nest by indentation
<div>
p Mix raw HTML and Plim markup
</div>
-md
Use Markdown
============
See the syntax on [this page][1].
[1]: http://daringfireball.net/projects/markdown/basics
-rest
or Use reStructuredText
=======================
See the syntax on `this page`_.
.. _this page: http://docutils.sourceforge.net/docs/user/rst/quickref.html
-if items
table: -for item in items: tr
td = item.name
td = item.price
-elif show_empty
p No items found
-else
a href=request.route_url('items.add') =, _('Add items')
-unless user.authenticated
p Please, sign in.
-else
p Welcome, ${user.name}!
ul
--- i = 0
limit = 5
-while i < limit
li#idx-${i}.up: a href='#' title="Title" == i
--- i += 1
-until i < 0
li#idx-${i}.down-${i}: a href='''#''' title="""Title""" ==, i
--- i -= 1
#footer
Copyright © 2014.
-include footer_links.html
= render('tracking_code')