# otera v0.1.0 - API Reference

## Modules

- [Otera](Otera.md): Otera (お寺, "temple") renders Jinja templates in pure Elixir, with the semantics of Python Jinja2.
- [Otera.Bytes](Otera.Bytes.md): A Python `bytes` value, which `str.encode()` gives. It prints like Python, such as `b'caf\xc3\xa9'`, has a length in bytes, iterates as integers, and `decode()` gives the string back.

- [Otera.ChatTemplate](Otera.ChatTemplate.md): Renders the chat template of a Hugging Face model like `apply_chat_template` in Python transformers.
- [Otera.Cycler](Otera.Cycler.md): The `cycler(*items)` object of Jinja2. `next()` gives the current item and moves to the next one, `reset()` goes back to the first item, and `current` is the item that `next()` gives next. The position lives in `Otera.State`.

- [Otera.Dict](Otera.Dict.md): A dictionary that keeps the insertion order of its keys, like a Python `dict`.
- [Otera.Evaluator](Otera.Evaluator.md): Renders the syntax tree of `Otera.Parser` with the semantics of Python Jinja2.
- [Otera.Filters](Otera.Filters.md): The builtin filters of Jinja2, with their Python behavior.
- [Otera.Format](Otera.Format.md): Python string formatting: the `%` operator, which the `format` filter of Jinja2 uses, and `str.format()`.
- [Otera.Function](Otera.Function.md): An Elixir function with a Python signature, for a global, filter or test that takes keyword arguments.
- [Otera.GroupTuple](Otera.GroupTuple.md): An item of the result of the `groupby` filter: a Python named tuple `(grouper, list)` with the attributes `grouper` and `list`. It prints and compares like a tuple.

- [Otera.HTML](Otera.HTML.md): HTML text like Python: `escape/1` of markupsafe, `unescape/1` of `html.unescape`, and `striptags/1` of `Markup.striptags`.
- [Otera.Iterable](Otera.Iterable.md): A Python iterable that is not a list or a tuple, with the behavior of its Python type.
- [Otera.JSON](Otera.JSON.md): JSON with the rules of Python `json`: `dumps/2` for the `tojson` filter, and `decode!/1` to keep the key order of objects.
- [Otera.Joiner](Otera.Joiner.md): The `joiner(sep=", ")` object of Jinja2. A call gives an empty string the first time and `sep` after that. Whether it was called lives in `Otera.State`.

- [Otera.Lexer](Otera.Lexer.md): Splits a template source into tokens, with the rules of the Python Jinja2 lexer.
- [Otera.Lipsum](Otera.Lipsum.md): The `lipsum(n=5, html=True, min=20, max=100)` function of Jinja2: `n` paragraphs of random lorem ipsum, with the algorithm and the words of Jinja2. The text is random, as in Python.

- [Otera.Loop](Otera.Loop.md): The `loop` variable inside a `{% for %}` block, like the `LoopContext` of Jinja2.
- [Otera.Macro](Otera.Macro.md): A macro that a template defines with `{% macro %}`, or the `caller` of a `{% call %}` block, which has no name.
- [Otera.Method](Otera.Method.md): A Python method bound to a value, such as `message.content.strip` or `loop.cycle`. `Otera.Methods` runs it when the template calls it.

- [Otera.Methods](Otera.Methods.md): The Python methods that templates call on values, such as `content.strip()`, `name.startswith("get_")` or `message.get("tool_calls")`.
- [Otera.Namespace](Otera.Namespace.md): A `namespace()` object of Jinja2, which a template can change.
- [Otera.Parser](Otera.Parser.md): Parses the tokens of `Otera.Lexer` into an abstract syntax tree, with the grammar of the Python Jinja2 parser.
- [Otera.Pretty](Otera.Pretty.md): Python `pprint.pformat`, for the `pprint` filter, with its defaults: a width of 80, an indent of 1, and dicts sorted by key.
- [Otera.State](Otera.State.md): The mutable state of a render, for the Python objects that templates change: `namespace()` objects and the last value of `loop.changed()`.
- [Otera.Template](Otera.Template.md): A parsed template. `Otera.parse/2` makes it, and `Otera.render/3` renders it many times without parsing it again.
- [Otera.Tests](Otera.Tests.md): The builtin tests of Jinja2, such as `x is defined` or `x is divisibleby 3`, with their Python behavior.
- [Otera.TextWrap](Otera.TextWrap.md): Python `textwrap.wrap`, for the `wordwrap` filter, with the options that the filter uses: no tab expansion, no whitespace replacement, and whitespace dropped at the start and end of the lines.
- [Otera.Undefined](Otera.Undefined.md): The value of a missing variable, attribute or item, like the default `Undefined` of Jinja2.
- [Otera.Unicode](Otera.Unicode.md): The character properties of Python `str` methods, such as `isprintable()`, `isdigit()` and the cased letters of `title()`.
- [Otera.Value](Otera.Value.md): The Python semantics of template values.

- Exceptions
  - [Otera.Error](Otera.Error.md): An error that a template raises while it renders.
  - [Otera.SyntaxError](Otera.SyntaxError.md): An error in the syntax of a template, with the line where Otera found it.

