Skip to content

Commit

Permalink
template syntax
Browse files Browse the repository at this point in the history
git-svn-id: http://pony.tigris.org/svn/pony/trunk@57 698dff77-f410-0410-8918-cf622e150f36
  • Loading branch information
kozlovsky committed Nov 15, 2006
1 parent f226ddb commit 7471727
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/template-css.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
root {
<html>
<head>
<title>University &text{university/@name}</title>
<link rel="stylesheet" type="text/css" href="university.css" />
</head>
<body>
<h1>List of students:</h1>
&transform{university/groups/group}
</body>
</html>
}

group {
<div>
<h2>Group &text{@number}</h2>
<p>
Count of students: &text{count(students)},<br>
among them &text{count(student[@type="contract"])} of contract />
</p>
<ol>&transform{student}</ol>
</div>
}

student { <li class="@type">&text{.}</li> }
55 changes: 55 additions & 0 deletions docs/template-syntax.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

&# comment
&// comment
&/* comment */

&if(expr){ text }
&elif(expr) { text }
&else { text }

&for(var in expr) {
text
&row{text1}{text2}{text3}
&row(i:j){text}
&row(odd){text} &// &row(1:2){text}
&row(even){text} &// &row(2:2){text}
&row(first){text} &// &row(1){text}
&row(not first){text} &// &row(not 1){text}
&row(last){text} &// &row(-1){text}
&row(not last){text} &// &row(not -1)text
} &separator {
text
} &else {
text
}

&{text} &// localization

&list(expr){text}

&link(expr, attr=value, ...){text}

------------------------------------------------

&myfunc(1, 2, a=3, b=4){ text1 }{ text2 }&c={ text3 }&d={ text4 }


&layout(title="hello, world!", navsize=160, navleft=True)
&header={
<h1>This is page header!</h1>
}&footer={
<small>All right reserved</small>
}&navbar={
<ul>
<li>item1
<li>item2
</ul>
}&content={

&unit{ text }

&columns("1/4", "1/4", "1/2")
{ text }{ text }{ text }


}

0 comments on commit 7471727

Please sign in to comment.