Text from HTML field
html_text · OCA/server-tools
Health
67/100
fair
-
Security25/25No findings
-
Activity12/25Last human commit 20 months ago
-
Required by5/250 modules depend on it
-
Maturity25/25In 11 Odoo series since 8.0
Heuristic over the facts below, not an audit · How it's computed
Required by
0
Modules depending on it
External deps
0 pip · 0 bin
Python packages / system binaries
License
AGPL-3
No conflicts with its dependencies
Folder size
0.04 MB
Module directory on disk
Code analysis
0 migration notes
1 model
0 views
0 HTTP endpoints
Description
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.
Dependencies
- Odoo dependencies
-
odoo/odoo:- base
- Python dependencies
- None
- System dependencies
- None
- Required by
- None
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 0
No views found for this module.
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 1
New fields (0)
No new fields.
Public methods (1)-
text_from_html(self, html_content, max_words=None, max_chars=None, ellipsis='…', fail=False)@api.modelExtract text from an HTML field in a generator. :param str html_content: HTML contents from where to extract the text. :param int max_words: Maximum amount of words allowed in the resulting string. :param int max_chars: Maximum amount of characters allowed in the resulting string. If you apply this limit, beware that the last word could get cut in an unexpected place. :param str ellipsis: Character(s) to be appended to the end of the resulting string if it gets truncated after applying limits set in :param:`max_words` or :param:`max_chars`. If you want nothing applied, just set an empty string. :param bool fail: If ``True``, exceptions will be raised. Otherwise, an empty string will be returned on failure.
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…