changeset 235:41107d1ba1c8 trunk

Beautified the HTML docs a bit.
author cmlenz
date Tue, 12 Sep 2006 15:35:42 +0000
parents 39c424b80edd
children 7fb269e7da81
files doc/builder.txt doc/custom.css doc/docutils.conf doc/docutils.css doc/index.txt doc/style/bkgnd_pattern.png doc/style/docutils.css doc/style/edgewall.css doc/style/shadow.gif doc/style/vertbars.png doc/xml-templates.txt
diffstat 11 files changed, 483 insertions(+), 450 deletions(-) [+]
line wrap: on
line diff
--- a/doc/builder.txt
+++ b/doc/builder.txt
@@ -63,7 +63,7 @@
 The ``tag`` object also allows creating “fragments”, which are basically lists
 of nodes (elements or text) that don't have a parent element. This can be useful
 for creating snippets of markup that are attached to a parent element later (for
-example in a template). Fragments are created by calling the ``tag`` object:
+example in a template). Fragments are created by calling the ``tag`` object::
 
   >>> fragment = tag('Hello, ', tag.em('word'), '!')
   >>> fragment
deleted file mode 100644
--- a/doc/custom.css
+++ /dev/null
@@ -1,34 +0,0 @@
-@import(docutils.css);
-
-body { background: #fff; color: #000; margin: 10px 10px 10px 30px; padding: 0; }
-body, th, td {
-  font: normal 13px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;
-}
-h1, h2, h3, h4 {
- font-family: arial,verdana,'Bitstream Vera Sans',helvetica,sans-serif;
- font-weight: bold;
- letter-spacing: -0.018em;
-}
-h1 { font-size: 19px; margin: .15em 1em 0 0 }
-h2 { font-size: 16px }
-h3 { font-size: 14px }
-hr { border: none;  border-top: 1px solid #ccb; margin: 2em 0 }
-
-:link, :visited {
- text-decoration: none;
- color: #b00;
- border-bottom: 1px dotted #bbb;
-}
-:link:hover, :visited:hover {
- background-color: #eee;
- color: #555;
-}
-:link img, :visited img { border: none }
-h1 :link, h1 :visited ,h2 :link, h2 :visited, h3 :link, h3 :visited,
-h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited {
- color: #000;
-}
-
-pre.literal-block { background: #f7f7f7;  border: 1px solid #d7d7d7;
- margin: 1em 1.75em; padding: .25em; overflow: auto;
-}
--- a/doc/docutils.conf
+++ b/doc/docutils.conf
@@ -1,8 +1,9 @@
 [general]
 input_encoding = utf-8
 strip_comments = yes
+toc_backlinks = none
 
 [html4css1 writer]
 embed_stylesheet = no
-stylesheet = custom.css
+stylesheet = style/edgewall.css
 xml_declaration = no
deleted file mode 100644
--- a/doc/docutils.css
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
-:Author: David Goodger
-:Contact: goodger@users.sourceforge.net
-:Date: $Date: 2005-12-18 01:56:14 +0100 (Sun, 18 Dec 2005) $
-:Revision: $Revision: 4224 $
-:Copyright: This stylesheet has been placed in the public domain.
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
-  border: 0 }
-
-table.borderless td, table.borderless th {
-  /* Override padding for "table.docutils td" with "! important".
-     The right padding separates the table cells. */
-  padding: 0 0.5em 0 0 ! important }
-
-.first {
-  /* Override more specific margin styles with "! important". */
-  margin-top: 0 ! important }
-
-.last, .with-subtitle {
-  margin-bottom: 0 ! important }
-
-.hidden {
-  display: none }
-
-a.toc-backref {
-  text-decoration: none ;
-  color: black }
-
-blockquote.epigraph {
-  margin: 2em 5em ; }
-
-dl.docutils dd {
-  margin-bottom: 0.5em }
-
-/* Uncomment (and remove this text!) to get bold-faced definition list terms
-dl.docutils dt {
-  font-weight: bold }
-*/
-
-div.abstract {
-  margin: 2em 5em }
-
-div.abstract p.topic-title {
-  font-weight: bold ;
-  text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
-  margin: 2em ;
-  border: medium outset ;
-  padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
-  font-weight: bold ;
-  font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
-  color: red ;
-  font-weight: bold ;
-  font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
-   compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
-  margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
-  margin-top: 0.5em }
-*/
-
-div.dedication {
-  margin: 2em 5em ;
-  text-align: center ;
-  font-style: italic }
-
-div.dedication p.topic-title {
-  font-weight: bold ;
-  font-style: normal }
-
-div.figure {
-  margin-left: 2em ;
-  margin-right: 2em }
-
-div.footer, div.header {
-  clear: both;
-  font-size: smaller }
-
-div.line-block {
-  display: block ;
-  margin-top: 1em ;
-  margin-bottom: 1em }
-
-div.line-block div.line-block {
-  margin-top: 0 ;
-  margin-bottom: 0 ;
-  margin-left: 1.5em }
-
-div.sidebar {
-  margin-left: 1em ;
-  border: medium outset ;
-  padding: 1em ;
-  background-color: #ffffee ;
-  width: 40% ;
-  float: right ;
-  clear: right }
-
-div.sidebar p.rubric {
-  font-family: sans-serif ;
-  font-size: medium }
-
-div.system-messages {
-  margin: 5em }
-
-div.system-messages h1 {
-  color: red }
-
-div.system-message {
-  border: medium outset ;
-  padding: 1em }
-
-div.system-message p.system-message-title {
-  color: red ;
-  font-weight: bold }
-
-div.topic {
-  margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
-  margin-top: 0.4em }
-
-h1.title {
-  text-align: center }
-
-h2.subtitle {
-  text-align: center }
-
-hr.docutils {
-  width: 75% }
-
-img.align-left {
-  clear: left }
-
-img.align-right {
-  clear: right }
-
-ol.simple, ul.simple {
-  margin-bottom: 1em }
-
-ol.arabic {
-  list-style: decimal }
-
-ol.loweralpha {
-  list-style: lower-alpha }
-
-ol.upperalpha {
-  list-style: upper-alpha }
-
-ol.lowerroman {
-  list-style: lower-roman }
-
-ol.upperroman {
-  list-style: upper-roman }
-
-p.attribution {
-  text-align: right ;
-  margin-left: 50% }
-
-p.caption {
-  font-style: italic }
-
-p.credits {
-  font-style: italic ;
-  font-size: smaller }
-
-p.label {
-  white-space: nowrap }
-
-p.rubric {
-  font-weight: bold ;
-  font-size: larger ;
-  color: maroon ;
-  text-align: center }
-
-p.sidebar-title {
-  font-family: sans-serif ;
-  font-weight: bold ;
-  font-size: larger }
-
-p.sidebar-subtitle {
-  font-family: sans-serif ;
-  font-weight: bold }
-
-p.topic-title {
-  font-weight: bold }
-
-pre.address {
-  margin-bottom: 0 ;
-  margin-top: 0 ;
-  font-family: serif ;
-  font-size: 100% }
-
-pre.literal-block, pre.doctest-block {
-  margin-left: 2em ;
-  margin-right: 2em ;
-  background-color: #eeeeee }
-
-span.classifier {
-  font-family: sans-serif ;
-  font-style: oblique }
-
-span.classifier-delimiter {
-  font-family: sans-serif ;
-  font-weight: bold }
-
-span.interpreted {
-  font-family: sans-serif }
-
-span.option {
-  white-space: nowrap }
-
-span.pre {
-  white-space: pre }
-
-span.problematic {
-  color: red }
-
-span.section-subtitle {
-  /* font-size relative to parent (h1..h6 element) */
-  font-size: 80% }
-
-table.citation {
-  border-left: solid 1px gray;
-  margin-left: 1px }
-
-table.docinfo {
-  margin: 2em 4em }
-
-table.docutils {
-  margin-top: 0.5em ;
-  margin-bottom: 0.5em }
-
-table.footnote {
-  border-left: solid 1px black;
-  margin-left: 1px }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
-  padding-left: 0.5em ;
-  padding-right: 0.5em ;
-  vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
-  font-weight: bold ;
-  text-align: left ;
-  white-space: nowrap ;
-  padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
-  font-size: 100% }
-
-tt.docutils {
-  background-color: #eeeeee }
-
-ul.auto-toc {
-  list-style-type: none }
--- a/doc/index.txt
+++ b/doc/index.txt
@@ -1,8 +1,11 @@
 .. -*- mode: rst; encoding: utf-8 -*-
 
-======
-Genshi
-======
+.. image:: logo.png
+   :width: 225
+   :height: 81
+   :align: center
+   :alt: Genshi - Generate output for the web
+   :class: logo
 
 -----------------------------------------------------------
 A toolkit for stream-based generation of output for the web
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..90e92682135d3f7213332f870f973bd06d6d57ee
GIT binary patch
literal 112
zc%17D@N?(olHy`uVBq!ia0vp^B0wy_$P6TPuAPklQfvV}A+FxOzM<ja$?1EZ14UFl
zT^vI=t|to=iYB~>SaRTj#)AV3j$Ayz@Myi$<MK684X4~sFf(*H@+4o{pJfBoz~JfX
K=d#Wzp$PzDHzRKV
new file mode 100644
--- /dev/null
+++ b/doc/style/docutils.css
@@ -0,0 +1,277 @@
+/*
+:Author: David Goodger
+:Contact: goodger@users.sourceforge.net
+:Date: $Date: 2005-12-18 01:56:14 +0100 (Sun, 18 Dec 2005) $
+:Revision: $Revision: 4224 $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+dl.docutils dt {
+  font-weight: bold }
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin-left: 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left {
+  clear: left }
+
+img.align-right {
+  clear: right }
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font-family: serif ;
+  font-size: 100% }
+
+pre.literal-block, pre.doctest-block {
+  margin-left: 2em ;
+  margin-right: 2em ;
+  background-color: #eeeeee }
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+tt.docutils {
+  background-color: #eeeeee }
+
+ul.auto-toc {
+  list-style-type: none }
new file mode 100644
--- /dev/null
+++ b/doc/style/edgewall.css
@@ -0,0 +1,51 @@
+@import(docutils.css);
+
+html, body { height: 100%; margin: 0; padding: 0; }
+html, body { background: #4b4d4d url(bkgnd_pattern.png); color: #000; }
+body, th, td {
+  font: normal small Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;
+}
+pre, code, tt { font-size: medium; }
+h1, h2, h3, h4 {
+  font-family: Arial,Verdana,'Bitstream Vera Sans',Helvetica,sans-serif;
+  font-weight: bold; letter-spacing: -0.018em;
+}
+h1 { font-size: 19px; margin: 2em 1em 0 0; }
+h2 { font-size: 16px; }
+h3 { font-size: 14px; }
+hr { border: none;  border-top: 1px solid #ccb; margin: 2em 0; }
+
+:link, :visited { text-decoration: none; border-bottom: 1px dotted #bbb;
+  color: #b00;
+}
+:link:hover, :visited:hover { background-color: #eee; color: #555; }
+:link img, :visited img { border: none }
+h1 :link, h1 :visited ,h2 :link, h2 :visited, h3 :link, h3 :visited,
+h4 :link, h4 :visited, h5 :link, h5 :visited, h6 :link, h6 :visited {
+  color: #000;
+}
+
+div.document { background: #fff url(shadow.gif) right top repeat-y;
+  border-left: 1px solid #000; margin: 0 auto 0 80px;
+  min-height: 100%; width: 54em; padding: 0 180px 1px 20px;
+}
+h1.title { background: url(vertbars.png) repeat-x; color: #666;
+  font-size: x-large; margin: 0 -20px 1em; padding: 2em 20px 0;
+}
+pre.literal-block { background: #f7f7f7; border: 1px solid #d7d7d7;
+  margin: 1em 0; padding: .25em; overflow: auto;
+}
+
+div.contents { position: absolute; position: fixed; margin-left: 80px;
+  left: 57.3em; top: 30px; right: 0;
+}
+div.contents .topic-title { display: none; }
+div.contents ul { list-style: none; padding-left: 0; }
+div.contents :link, div.contents :visited { color: #c6c6c6; border: none;
+  display: block; padding: 3px 5px 3px 10px;
+}
+div.contents :link:hover, div.contents :visited:hover { background: #000;
+  color: #fff;
+}
+
+img.logo { margin-top: 4.5em; }
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..326cd1b37dcd637d2e8b7193fe0011f51cca3ce9
GIT binary patch
literal 227
zc${<hbhEHbT)@D^u!sQ!Lc_zoeZ4HLt&EM0|1mOw#TXQSvapIUurla?I3TqQ%quud
zlrDZSmDDaVyF7E}b@6Ytvoj_shOWv?&*N&2(|LPsf$hGxedl*76r8xsnPhgyIr50X
zd<6}!Q;RpPnW`>y`k~e02bnvp_D$RTJdd?9OQ`;xMNQr6-*0k%)gGDlIK1ArveB)f
zy1Birqq{afsXt{x+N6vrS=0I^&YBz=ojG&P!l|<tFPgq&`LYE|*W`4qZ`#nham(gy
aPIaAIoocJPH|^MWAiw3{(IdQ^4AuZ)%VDtq
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..42ae3f86d7f1513fd585ad02959afbb37ad476cb
GIT binary patch
literal 270
zc%17D@N?(olHy`uVBq!ia0vp^0zj<5!2~3yyw0Buq&N#aB8wRqxP?KOkzv*x37{Z*
ziKnkC`xPz@COHia{`NUQp|zeajv*GOr}lgD9aa!v`Tf8C>%IowZOI~+1jT1O3(*SY
z=AC!{^{#V=egxhBzNNG+Wcfh@o-JZ+A^YdBKeo7Z&60On=AvAqCA)Sc&P(TZUiF#(
z^rj1DlCO7NijoNWTO^lr+bufXqg3k6Z@=t^|9Q_@g4NuszNO~8s$076@rDAqInO=8
zN?HUmba__RS@I|KY$^3?e!VMWHqT1EydCdvADZy$5&PrG?DFy^Z!PAn-4+0JID@CF
KpUXO@geCwp5oi<u
--- a/doc/xml-templates.txt
+++ b/doc/xml-templates.txt
@@ -155,40 +155,41 @@
 ====================
 
 
-.. _`py:attrs`:
-
-``py:attrs``
-------------
-
-This directive adds, modifies or removes attributes from the element::
-
-  <ul>
-    <li py:attrs="foo">Bar</li>
-  </ul>
+Conditional Sections
+--------------------
 
-Given ``foo={'class': 'collapse'}`` in the template context, this would
-produce::
-
-  <ul>
-    <li class="collapse">Bar</li>
-  </ul>
+.. _`py:if`:
 
-Attributes with the value ``None`` are omitted, so given ``foo={'class': None}``
-in the context for the same template this would produce::
+``py:if``
+`````````
 
-  <ul>
-    <li>Bar</li>
-  </ul>
+The element is only rendered if the expression evaluates to a truth value::
 
-This directive can only be used as an attribute.
+  <div>
+    <b py:if="foo">${bar}</b>
+  </div>
 
+Given the data ``foo=True`` and ``bar='Hello'`` in the template context, this
+would produce::
+
+  <div>
+    <b>Hello</b>
+  </div>
+
+This directive can also be used as an element::
+
+  <div>
+    <py:if test="foo">
+      <b>${bar}</b>
+    </py:if>
+  </div>
 
 .. _`py:choose`:
 .. _`py:when`:
 .. _`py:otherwise`:
 
 ``py:choose`` / ``py:when`` / ``py:otherwise``
-----------------------------------------------
+``````````````````````````````````````````````
 
 This set of directives provides advanced contional processing for rendering one
 of several alternatives. The first matching ``py:when`` branch is rendered, or,
@@ -225,32 +226,43 @@
   </div>
 
 
-.. _`py:content`:
+Looping
+-------
 
-``py:content``
---------------
+.. _`py:for`:
 
-This directive replaces any nested content with the result of evaluating the
-expression::
+``py:for``
+``````````
+
+The element is repeated for every item in an iterable::
 
   <ul>
-    <li py:content="bar">Hello</li>
+    <li py:for="item in items">${item}</li>
   </ul>
 
-Given ``bar='Bye'`` in the context data, this would produce::
+Given ``items=[1, 2, 3]`` in the context data, this would produce::
 
   <ul>
-    <li>Bye</li>
+    <li>1</li><li>2</li><li>3</li>
   </ul>
 
-This directive can only be used as an attribute.
+This directive can also be used as an element::
 
+  <ul>
+    <py:for each="item in items">
+      <li>${item}</li>
+    </py:for>
+  </ul>
+
+
+Snippet Reuse
+-------------
 
 .. _`py:def`:
 .. _`macros`:
 
 ``py:def``
-----------
+``````````
 
 The ``py:def`` directive can be used to create macros, i.e. snippets of
 template code that have a name and optionally some parameters, and that can be
@@ -302,64 +314,11 @@
   </div>
 
 
-.. _`py:for`:
-
-``py:for``
-----------
-
-The element is repeated for every item in an iterable::
-
-  <ul>
-    <li py:for="item in items">${item}</li>
-  </ul>
-
-Given ``items=[1, 2, 3]`` in the context data, this would produce::
-
-  <ul>
-    <li>1</li><li>2</li><li>3</li>
-  </ul>
-
-This directive can also be used as an element::
-
-  <ul>
-    <py:for each="item in items">
-      <li>${item}</li>
-    </py:for>
-  </ul>
-
-
-.. _`py:if`:
-
-``py:if``
-------------
-
-The element is only rendered if the expression evaluates to a truth value::
-
-  <div>
-    <b py:if="foo">${bar}</b>
-  </div>
-
-Given the data ``foo=True`` and ``bar='Hello'`` in the template context, this
-would produce::
-
-  <div>
-    <b>Hello</b>
-  </div>
-
-This directive can also be used as an element::
-
-  <div>
-    <py:if test="foo">
-      <b>${bar}</b>
-    </py:if>
-  </div>
-
-
+.. _Match Templates:
 .. _`py:match`:
-.. _Match Templates:
 
 ``py:match``
-------------
+````````````
 
 This directive defines a *match template*: given an XPath expression, it
 replaces any element in the template that matches the expression with its own
@@ -398,54 +357,13 @@
   </div>
 
 
-.. _`py:replace`:
-
-``py:replace``
---------------
-
-This directive replaces the element itself with the result of evaluating the
-expression::
-
-  <div>
-    <span py:replace="bar">Hello</span>
-  </div>
-
-Given ``bar='Bye'`` in the context data, this would produce::
-
-  <div>
-    Bye
-  </div>
-
-This directive can only be used as an attribute.
-
-
-.. _`py:strip`:
-
-``py:strip``
-------------
-
-This directive conditionally strips the top-level element from the output. When
-the value of the ``py:strip`` attribute evaluates to ``True``, the element is
-stripped from the output::
-
-  <div>
-    <div py:strip="True"><b>foo</b></div>
-  </div>
-
-This would be rendered as::
-
-  <div>
-    <b>foo</b>
-  </div>
-
-As a shorthand, if the value of the ``py:strip`` attribute is empty, that has
-the same effect as using a truth value (i.e. the element is stripped).
-
+Variable Binding
+----------------
 
 .. _`with`:
 
 ``py:with``
------------
+```````````
 
 The ``py:with`` directive lets you assign expressions to variables, which can
 be used to make expressions inside the directive less verbose and more
@@ -477,6 +395,102 @@
 Effectively, this means that variables are immutable in Genshi.
 
 
+Structure Manipulation
+----------------------
+
+.. _`py:attrs`:
+
+``py:attrs``
+````````````
+
+This directive adds, modifies or removes attributes from the element::
+
+  <ul>
+    <li py:attrs="foo">Bar</li>
+  </ul>
+
+Given ``foo={'class': 'collapse'}`` in the template context, this would
+produce::
+
+  <ul>
+    <li class="collapse">Bar</li>
+  </ul>
+
+Attributes with the value ``None`` are omitted, so given ``foo={'class': None}``
+in the context for the same template this would produce::
+
+  <ul>
+    <li>Bar</li>
+  </ul>
+
+This directive can only be used as an attribute.
+
+
+.. _`py:content`:
+
+``py:content``
+``````````````
+
+This directive replaces any nested content with the result of evaluating the
+expression::
+
+  <ul>
+    <li py:content="bar">Hello</li>
+  </ul>
+
+Given ``bar='Bye'`` in the context data, this would produce::
+
+  <ul>
+    <li>Bye</li>
+  </ul>
+
+This directive can only be used as an attribute.
+
+
+.. _`py:replace`:
+
+``py:replace``
+``````````````
+
+This directive replaces the element itself with the result of evaluating the
+expression::
+
+  <div>
+    <span py:replace="bar">Hello</span>
+  </div>
+
+Given ``bar='Bye'`` in the context data, this would produce::
+
+  <div>
+    Bye
+  </div>
+
+This directive can only be used as an attribute.
+
+
+.. _`py:strip`:
+
+``py:strip``
+````````````
+
+This directive conditionally strips the top-level element from the output. When
+the value of the ``py:strip`` attribute evaluates to ``True``, the element is
+stripped from the output::
+
+  <div>
+    <div py:strip="True"><b>foo</b></div>
+  </div>
+
+This would be rendered as::
+
+  <div>
+    <b>foo</b>
+  </div>
+
+As a shorthand, if the value of the ``py:strip`` attribute is empty, that has
+the same effect as using a truth value (i.e. the element is stripped).
+
+
 .. _order:
 
 Processing Order
Copyright (C) 2012-2017 Edgewall Software