Mercurial > genshi > genshi-test
comparison doc/xml-templates.txt @ 612:09de73cae3d5
Using `html` code-blocks for examples isn't so nice when viewing the docs over Trac, so change them to `xml`.
author | cmlenz |
---|---|
date | Wed, 29 Aug 2007 19:34:04 +0000 |
parents | 6a37018199fd |
children | 69b3b6ca968b |
comparison
equal
deleted
inserted
replaced
611:16b1be35c265 | 612:09de73cae3d5 |
---|---|
110 </div> | 110 </div> |
111 | 111 |
112 Given the data ``foo=True`` and ``bar='Hello'`` in the template context, this | 112 Given the data ``foo=True`` and ``bar='Hello'`` in the template context, this |
113 would produce: | 113 would produce: |
114 | 114 |
115 .. code-block:: html | 115 .. code-block:: xml |
116 | 116 |
117 <div> | 117 <div> |
118 <b>Hello</b> | 118 <b>Hello</b> |
119 </div> | 119 </div> |
120 | 120 |
151 <span py:otherwise="">2</span> | 151 <span py:otherwise="">2</span> |
152 </div> | 152 </div> |
153 | 153 |
154 This would produce the following output: | 154 This would produce the following output: |
155 | 155 |
156 .. code-block:: html | 156 .. code-block:: xml |
157 | 157 |
158 <div> | 158 <div> |
159 <span>1</span> | 159 <span>1</span> |
160 </div> | 160 </div> |
161 | 161 |
170 <span py:otherwise="">2</span> | 170 <span py:otherwise="">2</span> |
171 </div> | 171 </div> |
172 | 172 |
173 This would produce the following output: | 173 This would produce the following output: |
174 | 174 |
175 .. code-block:: html | 175 .. code-block:: xml |
176 | 176 |
177 <div> | 177 <div> |
178 <span>1</span> | 178 <span>1</span> |
179 </div> | 179 </div> |
180 | 180 |
195 <li py:for="item in items">${item}</li> | 195 <li py:for="item in items">${item}</li> |
196 </ul> | 196 </ul> |
197 | 197 |
198 Given ``items=[1, 2, 3]`` in the context data, this would produce: | 198 Given ``items=[1, 2, 3]`` in the context data, this would produce: |
199 | 199 |
200 .. code-block:: html | 200 .. code-block:: xml |
201 | 201 |
202 <ul> | 202 <ul> |
203 <li>1</li><li>2</li><li>3</li> | 203 <li>1</li><li>2</li><li>3</li> |
204 </ul> | 204 </ul> |
205 | 205 |
237 ${greeting('everyone else')} | 237 ${greeting('everyone else')} |
238 </div> | 238 </div> |
239 | 239 |
240 The above would be rendered to: | 240 The above would be rendered to: |
241 | 241 |
242 .. code-block:: html | 242 .. code-block:: xml |
243 | 243 |
244 <div> | 244 <div> |
245 <p class="greeting"> | 245 <p class="greeting"> |
246 Hello, world! | 246 Hello, world! |
247 </p> | 247 </p> |
262 ${greeting()} | 262 ${greeting()} |
263 </div> | 263 </div> |
264 | 264 |
265 The above would be rendered to: | 265 The above would be rendered to: |
266 | 266 |
267 .. code-block:: html | 267 .. code-block:: xml |
268 | 268 |
269 <div> | 269 <div> |
270 <p class="greeting"> | 270 <p class="greeting"> |
271 Hello, world! | 271 Hello, world! |
272 </p> | 272 </p> |
305 <greeting name="Dude" /> | 305 <greeting name="Dude" /> |
306 </div> | 306 </div> |
307 | 307 |
308 This would result in the following output: | 308 This would result in the following output: |
309 | 309 |
310 .. code-block:: html | 310 .. code-block:: xml |
311 | 311 |
312 <div> | 312 <div> |
313 <span> | 313 <span> |
314 Hello Dude | 314 Hello Dude |
315 </span> | 315 </span> |
393 <span py:with="y=7; z=x+10">$x $y $z</span> | 393 <span py:with="y=7; z=x+10">$x $y $z</span> |
394 </div> | 394 </div> |
395 | 395 |
396 Given ``x=42`` in the context data, this would produce: | 396 Given ``x=42`` in the context data, this would produce: |
397 | 397 |
398 .. code-block:: html | 398 .. code-block:: xml |
399 | 399 |
400 <div> | 400 <div> |
401 <span>42 7 52</span> | 401 <span>42 7 52</span> |
402 </div> | 402 </div> |
403 | 403 |
432 </ul> | 432 </ul> |
433 | 433 |
434 Given ``foo={'class': 'collapse'}`` in the template context, this would | 434 Given ``foo={'class': 'collapse'}`` in the template context, this would |
435 produce: | 435 produce: |
436 | 436 |
437 .. code-block:: html | 437 .. code-block:: xml |
438 | 438 |
439 <ul> | 439 <ul> |
440 <li class="collapse">Bar</li> | 440 <li class="collapse">Bar</li> |
441 </ul> | 441 </ul> |
442 | 442 |
443 Attributes with the value ``None`` are omitted, so given ``foo={'class': None}`` | 443 Attributes with the value ``None`` are omitted, so given ``foo={'class': None}`` |
444 in the context for the same template this would produce: | 444 in the context for the same template this would produce: |
445 | 445 |
446 .. code-block:: html | 446 .. code-block:: xml |
447 | 447 |
448 <ul> | 448 <ul> |
449 <li>Bar</li> | 449 <li>Bar</li> |
450 </ul> | 450 </ul> |
451 | 451 |
466 <li py:content="bar">Hello</li> | 466 <li py:content="bar">Hello</li> |
467 </ul> | 467 </ul> |
468 | 468 |
469 Given ``bar='Bye'`` in the context data, this would produce: | 469 Given ``bar='Bye'`` in the context data, this would produce: |
470 | 470 |
471 .. code-block:: html | 471 .. code-block:: xml |
472 | 472 |
473 <ul> | 473 <ul> |
474 <li>Bye</li> | 474 <li>Bye</li> |
475 </ul> | 475 </ul> |
476 | 476 |
491 <span py:replace="bar">Hello</span> | 491 <span py:replace="bar">Hello</span> |
492 </div> | 492 </div> |
493 | 493 |
494 Given ``bar='Bye'`` in the context data, this would produce: | 494 Given ``bar='Bye'`` in the context data, this would produce: |
495 | 495 |
496 .. code-block:: html | 496 .. code-block:: xml |
497 | 497 |
498 <div> | 498 <div> |
499 Bye | 499 Bye |
500 </div> | 500 </div> |
501 | 501 |
517 <div py:strip="True"><b>foo</b></div> | 517 <div py:strip="True"><b>foo</b></div> |
518 </div> | 518 </div> |
519 | 519 |
520 This would be rendered as: | 520 This would be rendered as: |
521 | 521 |
522 .. code-block:: html | 522 .. code-block:: xml |
523 | 523 |
524 <div> | 524 <div> |
525 <b>foo</b> | 525 <b>foo</b> |
526 </div> | 526 </div> |
527 | 527 |