Text from HTML field
by Contaura LLC
· original work by Grupo ESOC Ingeniería de Servicios, Tecnativa, Onestein, OCA
html_text
$ 29.00
Text from HTML field
This module provides some technical features that allow to extract text from any chunk of HTML, without HTML tags or attributes. You can chose either:
- To truncate the result by amount of words or characters.
- To append an ellipsis (or any character(s)) at the end of the result.
It can be used to easily generate excerpts.
Usage
This module just adds a technical utility, but nothing for the end user.
If you are a developer and need this utility for your module, see these examples and read the docs inside the code.
Python example:
@api.multi
def some_method(self):
# Get truncated text from an HTML field. It will 40 words and 100
# characters at most, and will have "..." appended at the end if it
# gets truncated.
truncated_text = self.env["ir.fields.converter"].text_from_html(
self.html_field, 40, 100, "...")
QWeb example:
<t t-esc="env['ir.fields.converter'].text_from_html(doc.html_field)"/>
Known issues / Roadmap
- An option could be added to try to respect the basic HTML tags inside the excerpt (<b>, <i>, <p>, etc.).
| Technical name | html_text |
|---|---|
| Module version | 12.0.1.0.0 |
| Tulio versions | 1.0 |
| Category | Tools |
| Publisher | Contaura LLC
Ported to Tulio, tested and supported by Contaura LLC. |
| Original authors | Grupo ESOC Ingeniería de Servicios, Tecnativa, Onestein, OCA |
| License | AGPL-3
Open source: you may use, change and share
this module under its license. The price covers the Tulio port, its testing on Tulio
1.0 and the download. |
| Python libraries | lxml
Install them on the server with pip before installing the module. |
| Requires (Tulio core) | base |
| Lines of code | 133 |
| Downloads | 0 |
| Released | 12/06/2026 |