Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
201203b
Excerpt generator.
yajo Apr 4, 2016
12a0427
Do not die miserably when you get `False` as the HTML input. Test it.
yajo Apr 5, 2016
136a2c6
html_text * Updated README.rst
cubells Nov 28, 2016
d58ad15
[MIG][10.0][html_text] Migrate
yajo Jun 22, 2017
7628916
[MIG] html_text: Migration to 11.0
tarteo Feb 14, 2018
29c0b94
[FIX] External python override for package `lxml.html` (#1234)
Apr 27, 2018
555b5f2
[UPD] Update html_text.pot
oca-travis Jun 17, 2018
e979873
[MIG] html_text:Migration to 12.0
Dike90 Nov 3, 2018
84b8f80
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Aug 31, 2019
36cccb7
Translated using Weblate (Chinese (Simplified))
liweijie0812 Aug 31, 2019
cb2089a
Added translation using Weblate (Croatian)
badbole Nov 13, 2019
6573e55
Translated using Weblate (Croatian)
badbole Nov 13, 2019
5f845a3
[IMP] html_text: black, isort, prettier
victoralmau Feb 19, 2021
4b9ae38
[MIG] html_text: Migration to 13.0
victoralmau Feb 19, 2021
177423f
[UPD] Update html_text.pot
oca-travis Feb 19, 2021
cf4fcdf
[UPD] README.rst
OCA-git-bot Feb 19, 2021
7cbfe47
Update translation files
oca-transbot Feb 19, 2021
4bad4b4
Translated using Weblate (Spanish)
anasuarez1 Mar 19, 2021
39688e6
[MIG] html_text: Migration to 14.0
hkapatel-initos May 24, 2021
fec4717
[UPD] Update html_text.pot
oca-travis Jul 23, 2021
12c0909
[UPD] README.rst
OCA-git-bot Jul 23, 2021
825bdd4
Update translation files
oca-transbot Jul 23, 2021
0b07ba7
[MIG] html_text: Migration to 15.0
Jan 13, 2022
1962aca
[UPD] Update html_text.pot
Feb 2, 2022
14913a8
[UPD] README.rst
OCA-git-bot Feb 2, 2022
32d0d4a
[IMP] update dotfiles
OCA-git-bot Mar 30, 2022
4989a7e
Added translation using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2022
845f511
Translated using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2022
ad4d015
[IMP] html_text: pre-commit stuff
dsolanki-initos Mar 22, 2023
709de29
[MIG] html_text: Migration to 16.0
dsolanki-initos Mar 22, 2023
fc506c5
[UPD] Update html_text.pot
Nov 1, 2023
fe821ed
[BOT] post-merge updates
OCA-git-bot Nov 1, 2023
d23bcfa
Translated using Weblate (Spanish)
Ivorra78 Nov 9, 2023
2d85303
Translated using Weblate (Italian)
mymage Jan 3, 2024
26a2a18
[IMP] remove python libs included in odoo requirements
CRogos Apr 4, 2024
985fe11
[BOT] post-merge updates
OCA-git-bot Apr 9, 2024
29dc46b
[IMP] html_text: black, isort, prettier
manuelregidor Feb 21, 2025
075a67d
[MIG]html_text: Migration to 17.0
manuelregidor Feb 21, 2025
3159076
[UPD] Update html_text.pot
Feb 22, 2025
b86ba7f
[BOT] post-merge updates
OCA-git-bot Feb 22, 2025
10b0f77
Update translation files
weblate Feb 22, 2025
72b5ad4
[IMP] html_text: pre-commit auto fixes
chaule97 Mar 26, 2025
be25579
[MIG] html_text: Migration to 18.0
chaule97 Mar 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions html_text/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
====================
Text from HTML field
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0f87eb077e4457f21490754cf188e0717093fd7fbcc499983fe831308056ba07
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/18.0/html_text
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-html_text
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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.

**Table of contents**

.. contents::
:local:

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:

::

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)"/>

|Try me on Runbot|

.. |Try me on Runbot| image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:target: https://runbot.odoo-community.org/runbot/149/11.0

Known issues / Roadmap
======================

- An option could be added to try to respect the basic HTML tags inside
the excerpt (``<b>``, ``<i>``, ``<p>``, etc.).

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20html_text%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Grupo ESOC Ingeniería de Servicios
* Tecnativa
* Onestein

Contributors
------------

- Dennis Sluijk <d.sluijk@onestein.nl>
- `Tecnativa <https://www.tecnativa.com>`__:",
- Helly kapatel <helly.kapatel@initos.com>
- Mantas Šniukas <mantas@vialaurea.lt>
- Dhara Solanki <dhara.solanki@initos.com>

- Jairo Llopis
- Vicent Cubells
- Víctor Martínez

- Chau Le <chaulb@trobz.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/html_text>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions html_text/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions html_text/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Text from HTML field",
"summary": "Generate excerpts from any HTML field",
"version": "18.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-tools",
"author": "Grupo ESOC Ingeniería de Servicios, "
"Tecnativa, "
"Onestein, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["base"],
}
25 changes: 25 additions & 0 deletions html_text/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n"
"Last-Translator: Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
#, fuzzy
msgid "Fields Converter"
msgstr "ir.fields.converter"
25 changes: 25 additions & 0 deletions html_text/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
#, fuzzy
msgid "Fields Converter"
msgstr "ir.fields.converter"
37 changes: 37 additions & 0 deletions html_text/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-17 02:07+0000\n"
"PO-Revision-Date: 2023-11-09 20:38+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Convertidor de Campos"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID (identificación)"

#~ msgid "Last Modified on"
#~ msgstr "Última Modifiación el"

#~ msgid "Smart Search"
#~ msgstr "Búsqueda Inteligente"
22 changes: 22 additions & 0 deletions html_text/i18n/es_AR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-09-04 06:07+0000\n"
"Last-Translator: Ignacio Buioli <ibuioli@gmail.com>\n"
"Language-Team: none\n"
"Language: es_AR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Convertidor de Campos"
26 changes: 26 additions & 0 deletions html_text/i18n/es_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Fernando Lara <gennesis45@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-16 10:39+0000\n"
"PO-Revision-Date: 2017-02-16 10:39+0000\n"
"Last-Translator: Fernando Lara <gennesis45@gmail.com>, 2017\n"
"Language-Team: Spanish (Spain) (https://www.transifex.com/oca/teams/23907/"
"es_ES/)\n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
#, fuzzy
msgid "Fields Converter"
msgstr "ir.documentos.conversor"
23 changes: 23 additions & 0 deletions html_text/i18n/hr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-11-13 17:34+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 3.8\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Pretvaranje polja"
19 changes: 19 additions & 0 deletions html_text/i18n/html_text.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr ""
37 changes: 37 additions & 0 deletions html_text/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_text
#
# Translators:
# Paolo Valier <paolo.valier@hotmail.it>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-06 02:25+0000\n"
"PO-Revision-Date: 2024-01-03 15:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: html_text
#: model:ir.model,name:html_text.model_ir_fields_converter
msgid "Fields Converter"
msgstr "Convertitore file"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"

#~ msgid "Smart Search"
#~ msgstr "Ricerca intelligente"
Loading