# HG changeset patch # User cmlenz # Date 1167328240 0 # Node ID cab6b0256019daaf82e45a4fd273faf4f08cc90c # Parent 1dc3d3df4a85042433cad1468e8c26e20dfa885f Minor doc fixes. diff --git a/doc/streams.txt b/doc/streams.txt --- a/doc/streams.txt +++ b/doc/streams.txt @@ -202,7 +202,7 @@ what the ``data`` item of the event tuple looks like. The different kinds of events are documented below. -.. note:: The ``data`` item is generally immutable. It the data is to be +.. note:: The ``data`` item is generally immutable. If the data is to be modified when processing a stream, it must be replaced by a new tuple. Effectively, this means the entire event tuple is immutable. @@ -229,7 +229,7 @@ TEXT ---- -Character data outside of elements and other nodes. +Character data outside of elements and comments. For text events, the ``data`` item should be a unicode object:: diff --git a/doc/text-templates.txt b/doc/text-templates.txt --- a/doc/text-templates.txt +++ b/doc/text-templates.txt @@ -72,9 +72,10 @@ .. _python: http://www.python.org/ -If the expression starts with a letter and contains only letters and digits, -the curly braces may be omitted. In all other cases, the braces are required -so that the template processors knows where the expression ends:: +If the expression starts with a letter and contains only letters, digits, dots, +and underscores, the curly braces may be omitted. In all other cases, the +braces are required so that the template processor knows where the expression +ends:: >>> from genshi.template import TextTemplate >>> tmpl = TextTemplate('${items[0].capitalize()} item') diff --git a/doc/xml-templates.txt b/doc/xml-templates.txt --- a/doc/xml-templates.txt +++ b/doc/xml-templates.txt @@ -74,9 +74,10 @@ Expressions need to prefixed with a dollar sign (``$``) and usually enclosed in curly braces (``{…}``). -If the expression starts with a letter and contains only letters and digits, -the curly braces may be omitted. In all other cases, the braces are required so -that the template processors knows where the expression ends:: +If the expression starts with a letter and contains only letters, digits, dots, +and underscores, the curly braces may be omitted. In all other cases, the +braces are required so that the template processor knows where the expression +ends:: >>> from genshi.template import MarkupTemplate >>> tmpl = MarkupTemplate('${items[0].capitalize()} item') @@ -123,7 +124,7 @@ template is rendered in a number of ways: Genshi provides directives for conditionals and looping, among others. -To use directives in a template, the namespace should be declared, which is +To use directives in a template, the namespace must be declared, which is usually done on the root element:: -If a macro doesn't require parameters, it can be defined as well as called -without the parenthesis. For example:: +If a macro doesn't require parameters, it can be defined without the +parenthesis. For example::

Hello, world!

- ${greeting} + ${greeting()}
The above would be rendered to:: diff --git a/doc/xpath.txt b/doc/xpath.txt --- a/doc/xpath.txt +++ b/doc/xpath.txt @@ -36,7 +36,7 @@ for I don't know). Basically, any path expression that would require buffering of the stream is not supported. -Predicates are of course supported, but Path expressions *inside* predicates +Predicates are of course supported, but path expressions *inside* predicates are restricted to attribute lookups (again due to the lack of buffering). Most of the XPath functions and operators are supported, however they diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -22,22 +22,6 @@ from distutils.core import setup -class test_doc(Command): - description = 'Tests the code examples in the documentation' - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - for filename in glob('doc/*.txt'): - print 'testing documentation file %s' % filename - doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS) - - class build_doc(Command): description = 'Builds the documentation' user_options = [] @@ -61,6 +45,22 @@ argv=['--config=%s' % conf, source, dest]) +class test_doc(Command): + description = 'Tests the code examples in the documentation' + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + for filename in glob('doc/*.txt'): + print 'testing documentation file %s' % filename + doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS) + + setup( name = 'Genshi', version = '0.4',