Text from HTML field

Text from HTML field

by Contaura LLC · original work by Grupo ESOC Ingeniería de Servicios, Tecnativa, Onestein, OCA
html_text
$ 29.00

Generate excerpts from any HTML field

1.0

One purchase covers every version. Already bought it? Sign in.

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 namehtml_text
Module version12.0.1.0.0
Tulio versions1.0
CategoryTools
PublisherContaura LLC
Ported to Tulio, tested and supported by Contaura LLC.
Original authorsGrupo ESOC Ingeniería de Servicios, Tecnativa, Onestein, OCA
LicenseAGPL-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 librarieslxml
Install them on the server with pip before installing the module.
Requires (Tulio core)base
Lines of code133
Downloads0
Released12/06/2026
12.0.1.0.0 Tulio 1.0 · 12/06/2026