Skip to content

Commit

Permalink
Translate documentation to Sphinx .rst
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed Aug 27, 2024
1 parent b148746 commit 834d62b
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 110 deletions.
8 changes: 2 additions & 6 deletions doc/filters.txt → doc/filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
================
Expand Down
5 changes: 0 additions & 5 deletions doc/i18n.txt → doc/i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ a plugin.
.. _`babel`: http://babel.edgewall.org/


.. contents:: Contents
:depth: 2
.. sectnum::


Basics
======

Expand Down
33 changes: 21 additions & 12 deletions doc/index.txt → doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,32 @@ which is heavily inspired by Kid.
Installation
------------

* `Installing Genshi <install.html>`_
* `Upgrading from Previous Versions <upgrade.html>`_
.. toctree::
:titlesonly:

install
upgrade

Usage
-----

* `Markup Streams <streams.html>`_
* `Templating Basics <templates.html>`_
* `XML Template Language <xml-templates.html>`_
* `Text Template Language <text-templates.html>`_
* `Loading Templates <loader.html>`_
* `Using Stream Filters <filters.html>`_
* `Using XPath <xpath.html>`_
* `Internationalization and Localization <i18n.html>`_
* `Using the Templating Plugin <plugin.html>`_
.. toctree::
:titlesonly:

streams
templates
xml-templates
text-templates
loader
filters
xpath
i18n
plugin

API Documentation
-----------------

* `Generated API Documentation <api/index.html>`_
.. toctree::
:glob:

api/*
5 changes: 0 additions & 5 deletions doc/install.txt → doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ Installing Genshi
=================


.. contents:: Contents
:depth: 2
.. sectnum::


Prerequisites
-------------

Expand Down
4 changes: 0 additions & 4 deletions doc/loader.txt → doc/loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions doc/plugin.txt → doc/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions doc/streams.txt → doc/streams.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======

Expand Down
4 changes: 0 additions & 4 deletions doc/templates.txt → doc/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ template is rendered, and template expressions_ that are dynamically substituted
by variable data.


.. contents:: Contents
:depth: 3
.. sectnum::

--------
Synopsis
--------
Expand Down
32 changes: 14 additions & 18 deletions doc/text-templates.txt → doc/text-templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ embedding Python code in templates.

.. _django: http://www.djangoproject.com/

.. contents:: Contents
:depth: 3
.. sectnum::


.. _`directives`:

Expand Down Expand Up @@ -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}
Expand All @@ -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 %}
Expand All @@ -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 %}\
Expand All @@ -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 %}\
Expand Down Expand Up @@ -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}!
Expand All @@ -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!
Expand All @@ -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 %}
Expand All @@ -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} %}
Expand All @@ -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 %}
Expand All @@ -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 %}
Expand All @@ -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 %}\
Expand All @@ -303,15 +299,15 @@ 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.
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.
Expand All @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions doc/upgrade.txt → doc/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Upgrading Genshi
================


.. contents:: Contents
:depth: 2
.. sectnum::

-------------------------------------------
Upgrading from Genshi 0.6.x to Genshi 0.7.x
-------------------------------------------
Expand Down
Loading

0 comments on commit 834d62b

Please sign in to comment.