    Translation
    -----------

    This document contains functional template tests covering the TAL
    directives.

      >>> from z3c.pt.translation import translate

      >>> def render(body, **kwargs):
      ...    source, _globals = translate(body)
      ...    _locals = {}
      ...    exec source in _globals, _locals
      ...    return _locals['render'](**kwargs)

    Canonical test template
    -----------------------

      >>> body = """\
      ...
... ...

...
- ... ...
...

...

No paragraph here.

...

No paragraph here either.

...

A paragraph here.

... Hello Universe! ...
... """ >>> print render(body)
abcghi

- Item 0)
- Item 1)
- Item 2)
- Item 3)
- Item 4)

No paragraph here. No paragraph here either.

A paragraph here.

Hello World!
Error handling -------------- This section demonstrates how the package handles templates that contain errors. No default namespace declaration: A default namespace must be explicitly declared for the parser to work. >>> body = '
' >>> render(body) Traceback (most recent call last): ... ValueError: Must set default namespace. Bad XML We expect the xml-parser to raise an exception. >>> body = '
>> render(body) Traceback (most recent call last): ... XMLSyntaxError: line 1: Couldn't find end of Start Tag div line 1 Missing namespace definition: We expect the engine to render the attributes as static. >>> body = """\ ...
... """ >>> print render(body)