diff --git a/doc/filters.txt b/doc/filters.rst similarity index 98% rename from doc/filters.txt rename to doc/filters.rst index 63949eeb..857bbc6c 100644 --- a/doc/filters.txt +++ b/doc/filters.rst @@ -4,16 +4,12 @@ Stream Filters ============== -`Markup Streams`_ showed how to write filters and how they are applied to +:doc:`streams` showed how to write filters and how they are applied to markup streams. This page describes the features of the various filters that come with Genshi itself. -.. _`Markup Streams`: streams.html - -.. contents:: Contents - :depth: 1 -.. sectnum:: +.. _`HTMLFormFiller`: HTML Form Filler ================ diff --git a/doc/i18n.txt b/doc/i18n.rst similarity index 99% rename from doc/i18n.txt rename to doc/i18n.rst index 2c0d1044..7e21a6e7 100644 --- a/doc/i18n.txt +++ b/doc/i18n.rst @@ -19,11 +19,6 @@ a plugin. .. _`babel`: http://babel.edgewall.org/ -.. contents:: Contents - :depth: 2 -.. sectnum:: - - Basics ====== diff --git a/doc/index.txt b/doc/index.rst similarity index 56% rename from doc/index.txt rename to doc/index.rst index 820e88ca..c18342fd 100644 --- a/doc/index.txt +++ b/doc/index.rst @@ -23,23 +23,32 @@ which is heavily inspired by Kid. Installation ------------ -* `Installing Genshi `_ -* `Upgrading from Previous Versions `_ +.. toctree:: + :titlesonly: + + install + upgrade Usage ----- -* `Markup Streams `_ -* `Templating Basics `_ -* `XML Template Language `_ -* `Text Template Language `_ -* `Loading Templates `_ -* `Using Stream Filters `_ -* `Using XPath `_ -* `Internationalization and Localization `_ -* `Using the Templating Plugin `_ +.. toctree:: + :titlesonly: + + streams + templates + xml-templates + text-templates + loader + filters + xpath + i18n + plugin API Documentation ----------------- -* `Generated API Documentation `_ +.. toctree:: + :glob: + + api/* diff --git a/doc/install.txt b/doc/install.rst similarity index 98% rename from doc/install.txt rename to doc/install.rst index ca409d82..09ae08f9 100644 --- a/doc/install.txt +++ b/doc/install.rst @@ -2,11 +2,6 @@ Installing Genshi ================= -.. contents:: Contents - :depth: 2 -.. sectnum:: - - Prerequisites ------------- diff --git a/doc/loader.txt b/doc/loader.rst similarity index 99% rename from doc/loader.txt rename to doc/loader.rst index 8f9a6d04..4884d70c 100644 --- a/doc/loader.txt +++ b/doc/loader.rst @@ -10,10 +10,6 @@ templates so they do not need to be reparsed when used, support for multiple template directories that together form a virtual search path, as well as support for different template loading strategies. -.. contents:: Contents - :depth: 3 -.. sectnum:: - ----- Usage diff --git a/doc/plugin.txt b/doc/plugin.rst similarity index 99% rename from doc/plugin.txt rename to doc/plugin.rst index 8a176ea9..55f9058f 100644 --- a/doc/plugin.txt +++ b/doc/plugin.rst @@ -11,13 +11,6 @@ flexibility of Genshi templates (for example, there's no good way to use filters such as Genshi's `HTMLFormFiller`_ when the plugin API is sitting between your code and Genshi). -.. _`HTMLFormFiller`: filters.html>#html-form-filler - - -.. contents:: Contents - :depth: 2 -.. sectnum:: - Introduction ============ diff --git a/doc/requirements.txt b/doc/requirements.rst similarity index 100% rename from doc/requirements.txt rename to doc/requirements.rst diff --git a/doc/streams.txt b/doc/streams.rst similarity index 99% rename from doc/streams.txt rename to doc/streams.rst index b8a22e5a..00da2c31 100644 --- a/doc/streams.txt +++ b/doc/streams.rst @@ -7,11 +7,6 @@ Markup Streams A stream is the common representation of markup as a *stream of events*. -.. contents:: Contents - :depth: 2 -.. sectnum:: - - Basics ====== diff --git a/doc/templates.txt b/doc/templates.rst similarity index 99% rename from doc/templates.txt rename to doc/templates.rst index b90e90d7..da39d45e 100644 --- a/doc/templates.txt +++ b/doc/templates.rst @@ -19,10 +19,6 @@ template is rendered, and template expressions_ that are dynamically substituted by variable data. -.. contents:: Contents - :depth: 3 -.. sectnum:: - -------- Synopsis -------- diff --git a/doc/text-templates.txt b/doc/text-templates.rst similarity index 95% rename from doc/text-templates.txt rename to doc/text-templates.rst index eb065677..367b06ef 100644 --- a/doc/text-templates.txt +++ b/doc/text-templates.rst @@ -25,10 +25,6 @@ embedding Python code in templates. .. _django: http://www.djangoproject.com/ -.. contents:: Contents - :depth: 3 -.. sectnum:: - .. _`directives`: @@ -60,7 +56,7 @@ Conditional Sections The content is only rendered if the expression evaluates to a truth value: -.. code-block:: genshitext +.. code-block:: jinja {% if foo %} ${bar} @@ -87,7 +83,7 @@ no ``when`` branch matches, the ``otherwise`` branch is be rendered. If the ``choose`` directive has no argument the nested ``when`` directives will be tested for truth: -.. code-block:: genshitext +.. code-block:: jinja The answer is: {% choose %} @@ -104,7 +100,7 @@ This would produce the following output:: If the ``choose`` does have an argument, the nested ``when`` directives will be tested for equality to the parent ``choose`` value: -.. code-block:: genshitext +.. code-block:: jinja The answer is: {% choose 1 %}\ @@ -129,7 +125,7 @@ Looping The content is repeated for every item in an iterable: -.. code-block:: genshitext +.. code-block:: jinja Your items: {% for item in items %}\ @@ -157,7 +153,7 @@ The ``def`` directive can be used to create macros, i.e. snippets of template text that have a name and optionally some parameters, and that can be inserted in other places: -.. code-block:: genshitext +.. code-block:: jinja {% def greeting(name) %} Hello, ${name}! @@ -173,7 +169,7 @@ The above would be rendered to:: If a macro doesn't require parameters, it can be defined without the parenthesis. For example: -.. code-block:: genshitext +.. code-block:: jinja {% def greeting %} Hello, world! @@ -194,7 +190,7 @@ The above would be rendered to:: To reuse common parts of template text across template files, you can include other files using the ``include`` directive: -.. code-block:: genshitext +.. code-block:: jinja {% include base.txt %} @@ -213,7 +209,7 @@ Just like other directives, the argument to the ``include`` directive accepts any Python expression, so the path to the included template can be determined dynamically: -.. code-block:: genshitext +.. code-block:: jinja {% include ${'%s.txt' % filename} %} @@ -239,7 +235,7 @@ to a variable using this directive would probably help. For example: -.. code-block:: genshitext +.. code-block:: jinja Magic numbers! {% with y=7; z=x+10 %} @@ -266,7 +262,7 @@ White-space and Line Breaks Note that space or line breaks around directives is never automatically removed. Consider the following example: -.. code-block:: genshitext +.. code-block:: jinja {% for item in items %} {% if item.visible %} @@ -278,7 +274,7 @@ This will result in two empty lines above and beneath every item, plus the spaces used for indentation. If you want to supress a line break, simply end the line with a backslash: -.. code-block:: genshitext +.. code-block:: jinja {% for item in items %}\ {% if item.visible %}\ @@ -303,7 +299,7 @@ Comments Parts in templates can be commented out using the delimiters ``{# ... #}``. Any content in comments are removed from the output. -.. code-block:: genshitext +.. code-block:: jinja {# This won't end up in the output #} This will. @@ -311,7 +307,7 @@ Any content in comments are removed from the output. Just like directive delimiters, these can be escaped by prefixing with a backslash. -.. code-block:: genshitext +.. code-block:: jinja \{# This *will* end up in the output, including delimiters #} This too. @@ -332,7 +328,7 @@ starting with dollar signs, similar to e.g. Cheetah_ or Velocity_. A simple template using the old syntax looked like this: -.. code-block:: genshitext +.. code-block:: jinja Dear $name, diff --git a/doc/upgrade.txt b/doc/upgrade.rst similarity index 99% rename from doc/upgrade.txt rename to doc/upgrade.rst index ad4c080f..b2cd05ad 100644 --- a/doc/upgrade.txt +++ b/doc/upgrade.rst @@ -3,10 +3,6 @@ Upgrading Genshi ================ -.. contents:: Contents - :depth: 2 -.. sectnum:: - ------------------------------------------- Upgrading from Genshi 0.6.x to Genshi 0.7.x ------------------------------------------- diff --git a/doc/xml-templates.txt b/doc/xml-templates.rst similarity index 95% rename from doc/xml-templates.txt rename to doc/xml-templates.rst index 6aec4091..844eec57 100644 --- a/doc/xml-templates.txt +++ b/doc/xml-templates.rst @@ -25,11 +25,6 @@ See `Genshi Templating Basics `_ for general information on embedding Python code in templates. -.. contents:: Contents - :depth: 3 -.. sectnum:: - - .. _`directives`: ------------------- @@ -44,7 +39,7 @@ conditionals and looping, among others. To use directives in a template, the namespace must be declared, which is usually done on the root element: -.. code-block:: genshi +.. code-block:: html+genshi ${bar} @@ -128,7 +123,7 @@ But setting ``foo=False`` would result in the following output: This directive can also be used as an element: -.. code-block:: genshi +.. code-block:: html+genshi
@@ -151,7 +146,7 @@ if no ``py:when`` branch matches, the ``py:otherwise`` branch is rendered. If the ``py:choose`` directive is empty the nested ``py:when`` directives will be tested for truth: -.. code-block:: genshi +.. code-block:: html+genshi
0 @@ -170,7 +165,7 @@ This would produce the following output: If the ``py:choose`` directive contains an expression the nested ``py:when`` directives will be tested for equality to the parent ``py:choose`` value: -.. code-block:: genshi +.. code-block:: html+genshi
0 @@ -188,7 +183,7 @@ This would produce the following output: These directives can also be used as elements: -.. code-block:: genshi +.. code-block:: html+genshi 0 @@ -206,7 +201,7 @@ Looping The element is repeated for every item in an iterable: -.. code-block:: genshi +.. code-block:: html+genshi
  • ${item}
  • @@ -222,7 +217,7 @@ Given ``items=[1, 2, 3]`` in the context data, this would produce: This directive can also be used as an element: -.. code-block:: genshi +.. code-block:: html+genshi
      @@ -244,7 +239,7 @@ 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 inserted in other places: -.. code-block:: genshi +.. code-block:: html+genshi

      @@ -270,7 +265,7 @@ The above would be rendered to: If a macro doesn't require parameters, it can be defined without the parenthesis. For example: -.. code-block:: genshi +.. code-block:: html+genshi

      @@ -291,7 +286,7 @@ The above would be rendered to: This directive can also be used as an element: -.. code-block:: genshi +.. code-block:: html+genshi

      @@ -313,7 +308,7 @@ content. For example, the match template defined in the following template matches any element with the tag name “greeting”: -.. code-block:: genshi +.. code-block:: html+genshi
      @@ -347,7 +342,7 @@ template. The match templates basically form a pipeline. This directive can also be used as an element: -.. code-block:: genshi +.. code-block:: html+genshi
      @@ -360,7 +355,7 @@ When used this way, the ``py:match`` directive can also be annotated with a couple of optimization hints. For example, the following informs the matching engine that the match should only be applied once: -.. code-block:: genshi +.. code-block:: html+genshi @@ -421,7 +416,7 @@ to a variable using this directive would probably help. For example: -.. code-block:: genshi +.. code-block:: html+genshi
      $x $y $z @@ -437,7 +432,7 @@ Given ``x=42`` in the context data, this would produce: This directive can also be used as an element: -.. code-block:: genshi +.. code-block:: html+genshi
      $x $y $z @@ -459,7 +454,7 @@ Structure Manipulation This directive adds, modifies or removes attributes from the element: -.. code-block:: genshi +.. code-block:: html+genshi
      • Bar
      • @@ -494,7 +489,7 @@ This directive can only be used as an attribute. This directive replaces any nested content with the result of evaluating the expression: -.. code-block:: genshi +.. code-block:: html+genshi
        • Hello
        • @@ -519,7 +514,7 @@ This directive can only be used as an attribute. This directive replaces the element itself with the result of evaluating the expression: -.. code-block:: genshi +.. code-block:: html+genshi
          Hello @@ -535,7 +530,7 @@ Given ``bar='Bye'`` in the context data, this would produce: This directive can also be used as an element (since version 0.5): -.. code-block:: genshi +.. code-block:: html+genshi
          Placeholder @@ -552,7 +547,7 @@ 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: -.. code-block:: genshi +.. code-block:: html+genshi
          foo
          @@ -608,7 +603,7 @@ For this, you need to declare the XInclude namespace (commonly bound to the prefix “xi”) and use the ```` element where you want the external file to be pulled in: -.. code-block:: genshi +.. code-block:: html+genshi @@ -651,7 +646,7 @@ attribute accepts expressions, and directives_ can be used on the ```` element just as on any other element, meaning you can do things like conditional includes: -.. code-block:: genshi +.. code-block:: html+genshi @@ -664,7 +659,7 @@ The ``parse`` attribute of the ```` element can be used to specify whether the included template is an XML template or a text template (using the new syntax added in Genshi 0.5): -.. code-block:: genshi +.. code-block:: html+genshi @@ -682,7 +677,7 @@ Comments Normal XML/HTML comment syntax can be used in templates: -.. code-block:: genshi +.. code-block:: html+genshi @@ -690,13 +685,13 @@ However, such comments get passed through the processing pipeline and are by default included in the final output. If that's not desired, prefix the comment text with an exclamation mark: -.. code-block:: genshi +.. code-block:: html+genshi Note that it does not matter whether there's whitespace before or after the exclamation mark, so the above could also be written as follows: -.. code-block:: genshi +.. code-block:: html+genshi diff --git a/doc/xpath.txt b/doc/xpath.rst similarity index 98% rename from doc/xpath.txt rename to doc/xpath.rst index a2c3c885..b7f8d3e9 100644 --- a/doc/xpath.txt +++ b/doc/xpath.rst @@ -9,11 +9,6 @@ Genshi provides basic XPath_ support for matching and querying event streams. .. _xpath: http://www.w3.org/TR/xpath -.. contents:: Contents - :depth: 2 -.. sectnum:: - - ----------- Limitations -----------