# HG changeset patch # User cmlenz # Date 1158075342 0 # Node ID 41107d1ba1c869fdd5f742415f8c46921f8fa0e4 # Parent 39c424b80eddd571d66466b6899a4babe35c2ea5 Beautified the HTML docs a bit. diff --git a/doc/builder.txt b/doc/builder.txt --- 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 diff --git a/doc/custom.css b/doc/custom.css 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; -} diff --git a/doc/docutils.conf b/doc/docutils.conf --- 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 diff --git a/doc/docutils.css b/doc/docutils.css 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 } diff --git a/doc/index.txt b/doc/index.txt --- 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 diff --git a/doc/style/bkgnd_pattern.png b/doc/style/bkgnd_pattern.png new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..90e92682135d3f7213332f870f973bd06d6d57ee GIT binary patch literal 112 zc%17D@N?(olHy`uVBq!ia0vp^B0wy_$P6TPuAPklQfvV}A+FxOzMSaRTj#)AV3j$Ayz@Myi$y`k~e02bnvp_D$RTJdd?9OQ`;xMNQr6-*0k%)gGDlIK1ArveB)f zy1Birqq{afsXt{x+N6vrS=0I^&YBz=ojG&P!l|%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 -
  • Bar
  • - +Conditional Sections +-------------------- -Given ``foo={'class': 'collapse'}`` in the template context, this would -produce:: - -
      -
    • Bar
    • -
    +.. _`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`` +````````` -
      -
    • Bar
    • -
    +The element is only rendered if the expression evaluates to a truth value:: -This directive can only be used as an attribute. +
    + ${bar} +
    +Given the data ``foo=True`` and ``bar='Hello'`` in the template context, this +would produce:: + +
    + Hello +
    + +This directive can also be used as an element:: + +
    + + ${bar} + +
    .. _`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 @@ -.. _`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::
      -
    • Hello
    • +
    • ${item}
    -Given ``bar='Bye'`` in the context data, this would produce:: +Given ``items=[1, 2, 3]`` in the context data, this would produce::
      -
    • Bye
    • +
    • 1
    • 2
    • 3
    -This directive can only be used as an attribute. +This directive can also be used as an element:: +
      + +
    • ${item}
    • +
      +
    + + +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 @@ -.. _`py:for`: - -``py:for`` ----------- - -The element is repeated for every item in an iterable:: - -
      -
    • ${item}
    • -
    - -Given ``items=[1, 2, 3]`` in the context data, this would produce:: - -
      -
    • 1
    • 2
    • 3
    • -
    - -This directive can also be used as an element:: - -
      - -
    • ${item}
    • -
      -
    - - -.. _`py:if`: - -``py:if`` ------------- - -The element is only rendered if the expression evaluates to a truth value:: - -
    - ${bar} -
    - -Given the data ``foo=True`` and ``bar='Hello'`` in the template context, this -would produce:: - -
    - Hello -
    - -This directive can also be used as an element:: - -
    - - ${bar} - -
    - - +.. _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 @@ -.. _`py:replace`: - -``py:replace`` --------------- - -This directive replaces the element itself with the result of evaluating the -expression:: - -
    - Hello -
    - -Given ``bar='Bye'`` in the context data, this would produce:: - -
    - Bye -
    - -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:: - -
    -
    foo
    -
    - -This would be rendered as:: - -
    - foo -
    - -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:: + +
      +
    • Bar
    • +
    + +Given ``foo={'class': 'collapse'}`` in the template context, this would +produce:: + +
      +
    • Bar
    • +
    + +Attributes with the value ``None`` are omitted, so given ``foo={'class': None}`` +in the context for the same template this would produce:: + +
      +
    • Bar
    • +
    + +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:: + +
      +
    • Hello
    • +
    + +Given ``bar='Bye'`` in the context data, this would produce:: + +
      +
    • Bye
    • +
    + +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:: + +
    + Hello +
    + +Given ``bar='Bye'`` in the context data, this would produce:: + +
    + Bye +
    + +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:: + +
    +
    foo
    +
    + +This would be rendered as:: + +
    + foo +
    + +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