Files
owl/doc/qweb.md
T

41 lines
1.3 KiB
Markdown
Raw Normal View History

# 🦉 QWeb 🦉
2019-03-14 12:51:19 +01:00
2019-04-25 17:24:39 +02:00
## Content
2019-03-14 14:23:27 +01:00
2019-04-25 17:24:39 +02:00
- [Overview](#overview)
- [Base Specification](#qweb-specification)
- [OWL Specific Extensions](#owl-specific-extensions)
2019-03-14 14:23:27 +01:00
2019-04-25 17:24:39 +02:00
## Overview
2019-03-14 14:23:27 +01:00
2019-04-25 17:24:39 +02:00
[QWeb](https://www.odoo.com/documentation/12.0/reference/qweb.html) is the primary templating engine used by Odoo. It is based on the XML format, and used
mostly to generate html.
2019-03-14 14:23:27 +01:00
2019-04-25 17:24:39 +02:00
Template directives are specified as XML attributes prefixed with `t-`, for instance `t-if` for conditionals, with elements and other attributes being rendered directly.
2019-03-14 14:23:27 +01:00
2019-04-25 17:24:39 +02:00
To avoid element rendering, a placeholder element `<t>` is also available, which executes its directive but doesnt generate any output in and of itself.
2019-04-25 17:24:39 +02:00
The QWeb implementation in the OWL project is slightly different. It compiles
templates into functions that output a virtual DOM instead of a string. This is
necessary for the component system. In addition, it has a few extra directives
(see [OWL Specific Extensions](#owlspecificextensions))
2019-04-25 17:24:39 +02:00
**Note on white spaces:** white spaces in a templates are handled in a special way:
- consecutive whitespaces are always condensed to a single whitespace
- if a whitespace-only text node contains a linebreak, it is ignored
- the previous rules do not apply if we are in a `<pre>` tag
2019-04-25 17:24:39 +02:00
## QWeb Specification
Todo
## OWL Specific Extensions
- t-on directive
- t-widget, t-props, t-key
- t-ref