From 0a33e3a9dead85bfae8f7542fcdbe1c483d77377 Mon Sep 17 00:00:00 2001 From: Yajo Date: Mon, 4 Apr 2016 16:58:49 +0200 Subject: [PATCH 01/47] Excerpt generator. * [8.0][html_text] Excerpt generator. This module adds a technical utility to allow the developer to get an excerpt from any HTML chunk. You can choose the maximum amount of words or characters if you want. See the README and inline docstrings for further details. --- html_text/README.rst | 82 ++++++++++++++++++++++++ html_text/__init__.py | 5 ++ html_text/__openerp__.py | 23 +++++++ html_text/models/__init__.py | 5 ++ html_text/models/ir_fields_converter.py | 72 +++++++++++++++++++++ html_text/static/description/icon.png | Bin 0 -> 9455 bytes html_text/tests/__init__.py | 5 ++ html_text/tests/test_extractor.py | 53 +++++++++++++++ 8 files changed, 245 insertions(+) create mode 100644 html_text/README.rst create mode 100644 html_text/__init__.py create mode 100644 html_text/__openerp__.py create mode 100644 html_text/models/__init__.py create mode 100644 html_text/models/ir_fields_converter.py create mode 100644 html_text/static/description/icon.png create mode 100644 html_text/tests/__init__.py create mode 100644 html_text/tests/test_extractor.py diff --git a/html_text/README.rst b/html_text/README.rst new file mode 100644 index 00000000000..38eac30afee --- /dev/null +++ b/html_text/README.rst @@ -0,0 +1,82 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +==================== +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:: + + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/149/8.0 + +Known issues / Roadmap +====================== + +* An option could be added to try to respect the basic HTML tags inside the + excerpt (````, ````, ``

``, etc.). + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed `feedback +`_. + +Credits +======= + +Contributors +------------ + +* Jairo Llopis + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/html_text/__init__.py b/html_text/__init__.py new file mode 100644 index 00000000000..09356048ff7 --- /dev/null +++ b/html_text/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/html_text/__openerp__.py b/html_text/__openerp__.py new file mode 100644 index 00000000000..07f931ee8fa --- /dev/null +++ b/html_text/__openerp__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Text from HTML field", + "summary": "Generate excerpts from any HTML field", + "version": "8.0.1.0.0", + "category": "Tools", + "website": "https://grupoesoc.es", + "author": "Grupo ESOC Ingeniería de Servicios, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "external_dependencies": { + "python": [ + "lxml.html", + ], + }, + "depends": [ + "base", + ], +} diff --git a/html_text/models/__init__.py b/html_text/models/__init__.py new file mode 100644 index 00000000000..11b8b13d5a8 --- /dev/null +++ b/html_text/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import ir_fields_converter diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py new file mode 100644 index 00000000000..503b2c7c75d --- /dev/null +++ b/html_text/models/ir_fields_converter.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import logging +from lxml import etree, html +from openerp import api, models + +_logger = logging.getLogger(__name__) + + +class IrFieldsConverter(models.Model): + _inherit = "ir.fields.converter" + + @api.model + def text_from_html(self, html_content, max_words=None, max_chars=None, + ellipsis=u"…", fail=False): + """Extract 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. + """ + # Parse HTML + try: + doc = html.fromstring(html_content) + except (etree.XMLSyntaxError, etree.ParserError): + if fail: + raise + else: + _logger.exception("Failure parsing this HTML:\n%s", + html_content) + return "" + + # Get words + words = u"".join(doc.xpath("//text()")).split() + + # Truncate words + suffix = max_words and len(words) > max_words + if max_words: + words = words[:max_words] + + # Get text + text = u" ".join(words) + + # Truncate text + suffix = suffix or max_chars and len(text) > max_chars + if max_chars: + text = text[:max_chars - (len(ellipsis) if suffix else 0)].strip() + + # Append ellipsis if needed + if suffix: + text += ellipsis + + return text diff --git a/html_text/static/description/icon.png b/html_text/static/description/icon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@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/html_text/tests/__init__.py b/html_text/tests/__init__.py new file mode 100644 index 00000000000..60346a281dc --- /dev/null +++ b/html_text/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_extractor diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py new file mode 100644 index 00000000000..f7d0843d377 --- /dev/null +++ b/html_text/tests/test_extractor.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from lxml import etree +from openerp.tests.common import TransactionCase + + +class ExtractorCase(TransactionCase): + def setUp(self): + super(ExtractorCase, self).setUp() + + # Shortcut + self.text_from_html = self.env["ir.fields.converter"].text_from_html + + def test_excerpts(self): + """Text gets correctly extracted.""" + html = u""" + + +

+

I'm a title

+

I'm a paragraph

+ ¡Pues yo soy español! +
+ + + """ + + self.assertEqual( + self.text_from_html(html), + u"I'm a title I'm a paragraph ¡Pues yo soy español!") + self.assertEqual( + self.text_from_html(html, 8), + u"I'm a title I'm a paragraph ¡Pues yo…") + self.assertEqual( + self.text_from_html(html, 8, 31), + u"I'm a title I'm a paragraph ¡P…") + self.assertEqual( + self.text_from_html(html, 7, ellipsis=""), + u"I'm a title I'm a paragraph ¡Pues") + + def test_empty_html(self): + """Empty HTML handled correctly.""" + self.assertEqual(self.text_from_html(""), "") + with self.assertRaises(etree.XMLSyntaxError): + self.text_from_html("", fail=True) + + def test_bad_html(self): + """Bad HTML handled correctly.""" + self.assertEqual(self.text_from_html("<"), "") + with self.assertRaises(etree.ParserError): + self.text_from_html("<", fail=True) From 203f08bffd00c5b258f252577f9e240b3d9a5be9 Mon Sep 17 00:00:00 2001 From: Yajo Date: Tue, 5 Apr 2016 16:58:19 +0200 Subject: [PATCH 02/47] Do not die miserably when you get `False` as the HTML input. Test it. --- html_text/models/ir_fields_converter.py | 2 +- html_text/tests/test_extractor.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index 503b2c7c75d..1ad3572ea41 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -41,7 +41,7 @@ def text_from_html(self, html_content, max_words=None, max_chars=None, # Parse HTML try: doc = html.fromstring(html_content) - except (etree.XMLSyntaxError, etree.ParserError): + except (TypeError, etree.XMLSyntaxError, etree.ParserError): if fail: raise else: diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index f7d0843d377..22443e32a14 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -46,6 +46,12 @@ def test_empty_html(self): with self.assertRaises(etree.XMLSyntaxError): self.text_from_html("", fail=True) + def test_false_html(self): + """``False`` HTML handled correctly.""" + self.assertEqual(self.text_from_html(False), "") + with self.assertRaises(TypeError): + self.text_from_html(False, fail=True) + def test_bad_html(self): """Bad HTML handled correctly.""" self.assertEqual(self.text_from_html("<"), "") From 9f5e245b4c5edc7e9494b6d4209570caec936add Mon Sep 17 00:00:00 2001 From: cubells Date: Mon, 28 Nov 2016 11:12:30 +0100 Subject: [PATCH 03/47] html_text * Updated README.rst OCA Transbot updated translations from Transifex --- html_text/README.rst | 9 +++------ html_text/__init__.py | 3 ++- html_text/__openerp__.py | 8 +++++--- html_text/i18n/ca.po | 24 ++++++++++++++++++++++++ html_text/i18n/de.po | 24 ++++++++++++++++++++++++ html_text/i18n/es.po | 24 ++++++++++++++++++++++++ html_text/i18n/es_ES.po | 24 ++++++++++++++++++++++++ html_text/i18n/tr.po | 24 ++++++++++++++++++++++++ html_text/models/__init__.py | 3 ++- html_text/models/ir_fields_converter.py | 3 ++- 10 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 html_text/i18n/ca.po create mode 100644 html_text/i18n/de.po create mode 100644 html_text/i18n/es.po create mode 100644 html_text/i18n/es_ES.po create mode 100644 html_text/i18n/tr.po diff --git a/html_text/README.rst b/html_text/README.rst index 38eac30afee..52c7755be32 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -38,7 +38,7 @@ QWeb example:: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/8.0 + :target: https://runbot.odoo-community.org/runbot/149/9.0 Known issues / Roadmap ====================== @@ -52,11 +52,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed `feedback -`_. +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -65,6 +61,7 @@ Contributors ------------ * Jairo Llopis +* Vicent Cubells Maintainer ---------- diff --git a/html_text/__init__.py b/html_text/__init__.py index 09356048ff7..197214cddf8 100644 --- a/html_text/__init__.py +++ b/html_text/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/html_text/__openerp__.py b/html_text/__openerp__.py index 07f931ee8fa..173d737a0e7 100644 --- a/html_text/__openerp__.py +++ b/html_text/__openerp__.py @@ -1,13 +1,15 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "8.0.1.0.0", + "version": "9.0.1.0.0", "category": "Tools", - "website": "https://grupoesoc.es", + "website": "https://tecnativa.com", "author": "Grupo ESOC Ingeniería de Servicios, " + "Tecnativa, " "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, diff --git a/html_text/i18n/ca.po b/html_text/i18n/ca.po new file mode 100644 index 00000000000..218f7516114 --- /dev/null +++ b/html_text/i18n/ca.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +# Translators: +# Marc Tormo i Bochaca , 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 , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "ir.fields.converter" +msgstr "ir.fields.converter" diff --git a/html_text/i18n/de.po b/html_text/i18n/de.po new file mode 100644 index 00000000000..b9f4c6287f2 --- /dev/null +++ b/html_text/i18n/de.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +# Translators: +# Rudolf Schnapka , 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 , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "ir.fields.converter" +msgstr "ir.fields.converter" diff --git a/html_text/i18n/es.po b/html_text/i18n/es.po new file mode 100644 index 00000000000..0a08e7b0fd5 --- /dev/null +++ b/html_text/i18n/es.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +# Translators: +# Pedro M. Baeza , 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: 2016-12-17 02:07+0000\n" +"Last-Translator: Pedro M. Baeza , 2016\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "ir.fields.converter" +msgstr "ir.fields.converter" diff --git a/html_text/i18n/es_ES.po b/html_text/i18n/es_ES.po new file mode 100644 index 00000000000..0394084e0f5 --- /dev/null +++ b/html_text/i18n/es_ES.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +# Translators: +# Fernando Lara , 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 , 2017\n" +"Language-Team: Spanish (Spain) (https://www.transifex.com/oca/teams/23907/es_ES/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es_ES\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "ir.fields.converter" +msgstr "ir.documentos.conversor" diff --git a/html_text/i18n/tr.po b/html_text/i18n/tr.po new file mode 100644 index 00000000000..3531df8fb77 --- /dev/null +++ b/html_text/i18n/tr.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +# Translators: +# Ahmet Altinisik , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-29 03:40+0000\n" +"PO-Revision-Date: 2016-12-29 03:40+0000\n" +"Last-Translator: Ahmet Altinisik , 2016\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: tr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "ir.fields.converter" +msgstr "ir.fields.converter" diff --git a/html_text/models/__init__.py b/html_text/models/__init__.py index 11b8b13d5a8..5746f8b6bad 100644 --- a/html_text/models/__init__.py +++ b/html_text/models/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import ir_fields_converter diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index 1ad3572ea41..5180665f097 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging From e352457ce09dd71d9d1de8f15bb68f763499b602 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 22 Jun 2017 13:08:16 +0200 Subject: [PATCH 04/47] [MIG][10.0][html_text] Migrate OCA Transbot updated translations from Transifex --- html_text/README.rst | 2 +- html_text/__init__.py | 2 -- html_text/{__openerp__.py => __manifest__.py} | 4 ++-- html_text/i18n/it.po | 24 +++++++++++++++++++ html_text/models/__init__.py | 2 -- html_text/models/ir_fields_converter.py | 6 ++--- html_text/tests/__init__.py | 1 - html_text/tests/test_extractor.py | 10 +++++--- 8 files changed, 37 insertions(+), 14 deletions(-) rename html_text/{__openerp__.py => __manifest__.py} (86%) create mode 100644 html_text/i18n/it.po diff --git a/html_text/README.rst b/html_text/README.rst index 52c7755be32..59ab65597e4 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -38,7 +38,7 @@ QWeb example:: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/9.0 + :target: https://runbot.odoo-community.org/runbot/149/10.0 Known issues / Roadmap ====================== diff --git a/html_text/__init__.py b/html_text/__init__.py index 197214cddf8..a77a6fcbc5d 100644 --- a/html_text/__init__.py +++ b/html_text/__init__.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis -# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/html_text/__openerp__.py b/html_text/__manifest__.py similarity index 86% rename from html_text/__openerp__.py rename to html_text/__manifest__.py index 173d737a0e7..af0df87b6b7 100644 --- a/html_text/__openerp__.py +++ b/html_text/__manifest__.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016-2017 Jairo Llopis # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "category": "Tools", "website": "https://tecnativa.com", "author": "Grupo ESOC Ingeniería de Servicios, " diff --git a/html_text/i18n/it.po b/html_text/i18n/it.po new file mode 100644 index 00000000000..454889f2035 --- /dev/null +++ b/html_text/i18n/it.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +# Translators: +# Paolo Valier , 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: 2018-01-06 02:25+0000\n" +"Last-Translator: Paolo Valier , 2018\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "ir.fields.converter" +msgstr "ir.fields.converter" diff --git a/html_text/models/__init__.py b/html_text/models/__init__.py index 5746f8b6bad..6fcbec0b616 100644 --- a/html_text/models/__init__.py +++ b/html_text/models/__init__.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis -# Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import ir_fields_converter diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index 5180665f097..1e84b1cadd6 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016-2017 Jairo Llopis # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging from lxml import etree, html -from openerp import api, models +from odoo import api, models _logger = logging.getLogger(__name__) -class IrFieldsConverter(models.Model): +class IrFieldsConverter(models.AbstractModel): _inherit = "ir.fields.converter" @api.model diff --git a/html_text/tests/__init__.py b/html_text/tests/__init__.py index 60346a281dc..f8ca9e6010b 100644 --- a/html_text/tests/__init__.py +++ b/html_text/tests/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_extractor diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 22443e32a14..938361fd75f 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# Copyright 2016-2017 Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from lxml import etree -from openerp.tests.common import TransactionCase +from odoo.tools import mute_logger +from odoo.tests.common import TransactionCase +from ..models import ir_fields_converter class ExtractorCase(TransactionCase): def setUp(self): super(ExtractorCase, self).setUp() - # Shortcut self.text_from_html = self.env["ir.fields.converter"].text_from_html @@ -40,18 +41,21 @@ def test_excerpts(self): self.text_from_html(html, 7, ellipsis=""), u"I'm a title I'm a paragraph ¡Pues") + @mute_logger(ir_fields_converter.__name__) def test_empty_html(self): """Empty HTML handled correctly.""" self.assertEqual(self.text_from_html(""), "") with self.assertRaises(etree.XMLSyntaxError): self.text_from_html("", fail=True) + @mute_logger(ir_fields_converter.__name__) def test_false_html(self): """``False`` HTML handled correctly.""" self.assertEqual(self.text_from_html(False), "") with self.assertRaises(TypeError): self.text_from_html(False, fail=True) + @mute_logger(ir_fields_converter.__name__) def test_bad_html(self): """Bad HTML handled correctly.""" self.assertEqual(self.text_from_html("<"), "") From cd0b175096d13b8e4c6b10455b28b45d05d55a7c Mon Sep 17 00:00:00 2001 From: tarteo Date: Wed, 14 Feb 2018 13:15:58 +0100 Subject: [PATCH 05/47] [MIG] html_text: Migration to 11.0 [FIX] Tests [FIX] Do not test the specific exception [FIX] Do not test the specific exception --- html_text/README.rst | 9 ++++++--- html_text/__init__.py | 3 +-- html_text/__manifest__.py | 8 ++++---- html_text/models/__init__.py | 3 +-- html_text/models/ir_fields_converter.py | 3 +-- html_text/tests/__init__.py | 3 +-- html_text/tests/test_extractor.py | 20 +++++--------------- 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/html_text/README.rst b/html_text/README.rst index 59ab65597e4..2b53f838860 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -1,5 +1,5 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl :alt: License: AGPL-3 ==================== @@ -38,7 +38,7 @@ QWeb example:: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/10.0 + :target: https://runbot.odoo-community.org/runbot/149/11.0 Known issues / Roadmap ====================== @@ -62,6 +62,9 @@ Contributors * Jairo Llopis * Vicent Cubells +* Dennis Sluijk + +Do not contact contributors directly about support or help with technical issues. Maintainer ---------- diff --git a/html_text/__init__.py b/html_text/__init__.py index a77a6fcbc5d..31660d6a965 100644 --- a/html_text/__init__.py +++ b/html_text/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import models diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index af0df87b6b7..a0d081878b0 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -1,15 +1,15 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 Jairo Llopis # Copyright 2016 Tecnativa - Vicent Cubells -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# 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": "10.0.1.0.0", + "version": "11.0.1.0.0", "category": "Tools", - "website": "https://tecnativa.com", + "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, diff --git a/html_text/models/__init__.py b/html_text/models/__init__.py index 6fcbec0b616..e21238ee902 100644 --- a/html_text/models/__init__.py +++ b/html_text/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import ir_fields_converter diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index 1e84b1cadd6..f1c523280b4 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -1,7 +1,6 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 Jairo Llopis # Copyright 2016 Tecnativa - Vicent Cubells -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging from lxml import etree, html diff --git a/html_text/tests/__init__.py b/html_text/tests/__init__.py index f8ca9e6010b..d9d2b331a8f 100644 --- a/html_text/tests/__init__.py +++ b/html_text/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import test_extractor diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 938361fd75f..8922f4e25ce 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -1,11 +1,8 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 Jairo Llopis -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from lxml import etree from odoo.tools import mute_logger from odoo.tests.common import TransactionCase -from ..models import ir_fields_converter class ExtractorCase(TransactionCase): @@ -41,23 +38,16 @@ def test_excerpts(self): self.text_from_html(html, 7, ellipsis=""), u"I'm a title I'm a paragraph ¡Pues") - @mute_logger(ir_fields_converter.__name__) + @mute_logger("odoo.addons.html_text.models.ir_fields_converter") def test_empty_html(self): """Empty HTML handled correctly.""" self.assertEqual(self.text_from_html(""), "") - with self.assertRaises(etree.XMLSyntaxError): + with self.assertRaises(Exception): self.text_from_html("", fail=True) - @mute_logger(ir_fields_converter.__name__) + @mute_logger("odoo.addons.html_text.models.ir_fields_converter") def test_false_html(self): """``False`` HTML handled correctly.""" self.assertEqual(self.text_from_html(False), "") - with self.assertRaises(TypeError): + with self.assertRaises(Exception): self.text_from_html(False, fail=True) - - @mute_logger(ir_fields_converter.__name__) - def test_bad_html(self): - """Bad HTML handled correctly.""" - self.assertEqual(self.text_from_html("<"), "") - with self.assertRaises(etree.ParserError): - self.text_from_html("<", fail=True) From 47f068dad5eb58ddb670fbada0b886c6bf22a225 Mon Sep 17 00:00:00 2001 From: Jaume Planas Date: Fri, 27 Apr 2018 20:15:26 +0200 Subject: [PATCH 06/47] [FIX] External python override for package `lxml.html` (#1234) --- html_text/__manifest__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index a0d081878b0..4c2d71a39be 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "11.0.1.0.0", + "version": "11.0.1.0.2", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " @@ -16,7 +16,7 @@ "installable": True, "external_dependencies": { "python": [ - "lxml.html", + "lxml", ], }, "depends": [ From 82f380f0d3a4accdb8870091825898d5540ac0ee Mon Sep 17 00:00:00 2001 From: oca-travis Date: Sun, 17 Jun 2018 20:50:52 +0000 Subject: [PATCH 07/47] [UPD] Update html_text.pot --- html_text/i18n/ca.po | 4 ++-- html_text/i18n/de.po | 4 ++-- html_text/i18n/es.po | 4 ++-- html_text/i18n/es_ES.po | 7 ++++--- html_text/i18n/html_text.pot | 20 ++++++++++++++++++++ html_text/i18n/it.po | 4 ++-- html_text/i18n/tr.po | 4 ++-- 7 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 html_text/i18n/html_text.pot diff --git a/html_text/i18n/ca.po b/html_text/i18n/ca.po index 218f7516114..ad8bc24941e 100644 --- a/html_text/i18n/ca.po +++ b/html_text/i18n/ca.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * html_text -# +# # Translators: # Marc Tormo i Bochaca , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-04-19 18:00+0000\n" "Last-Translator: Marc Tormo i Bochaca , 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" -"Language: ca\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: html_text diff --git a/html_text/i18n/de.po b/html_text/i18n/de.po index b9f4c6287f2..83dcba664b9 100644 --- a/html_text/i18n/de.po +++ b/html_text/i18n/de.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * html_text -# +# # Translators: # Rudolf Schnapka , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-04-19 18:00+0000\n" "Last-Translator: Rudolf Schnapka , 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" -"Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: html_text diff --git a/html_text/i18n/es.po b/html_text/i18n/es.po index 0a08e7b0fd5..49d31dfad56 100644 --- a/html_text/i18n/es.po +++ b/html_text/i18n/es.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * html_text -# +# # Translators: # Pedro M. Baeza , 2016 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2016-12-17 02:07+0000\n" "Last-Translator: Pedro M. Baeza , 2016\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" -"Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: html_text diff --git a/html_text/i18n/es_ES.po b/html_text/i18n/es_ES.po index 0394084e0f5..ff75c89903d 100644 --- a/html_text/i18n/es_ES.po +++ b/html_text/i18n/es_ES.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * html_text -# +# # Translators: # Fernando Lara , 2017 msgid "" @@ -11,11 +11,12 @@ msgstr "" "POT-Creation-Date: 2017-02-16 10:39+0000\n" "PO-Revision-Date: 2017-02-16 10:39+0000\n" "Last-Translator: Fernando Lara , 2017\n" -"Language-Team: Spanish (Spain) (https://www.transifex.com/oca/teams/23907/es_ES/)\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" -"Language: es_ES\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: html_text diff --git a/html_text/i18n/html_text.pot b/html_text/i18n/html_text.pot new file mode 100644 index 00000000000..92ef6e77320 --- /dev/null +++ b/html_text/i18n/html_text.pot @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * html_text +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.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 "ir.fields.converter" +msgstr "" + diff --git a/html_text/i18n/it.po b/html_text/i18n/it.po index 454889f2035..8931b2ef426 100644 --- a/html_text/i18n/it.po +++ b/html_text/i18n/it.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * html_text -# +# # Translators: # Paolo Valier , 2018 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2018-01-06 02:25+0000\n" "Last-Translator: Paolo Valier , 2018\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" -"Language: it\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: html_text diff --git a/html_text/i18n/tr.po b/html_text/i18n/tr.po index 3531df8fb77..9c8231fe2d2 100644 --- a/html_text/i18n/tr.po +++ b/html_text/i18n/tr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * html_text -# +# # Translators: # Ahmet Altinisik , 2016 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2016-12-29 03:40+0000\n" "Last-Translator: Ahmet Altinisik , 2016\n" "Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: tr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: html_text From aef2ccca32c9ce3b230b99d49977d9445143f990 Mon Sep 17 00:00:00 2001 From: Dike90 <919055994@qq.com> Date: Sat, 3 Nov 2018 15:19:37 +0800 Subject: [PATCH 08/47] [MIG] html_text:Migration to 12.0 --- html_text/__manifest__.py | 2 +- html_text/i18n/ca.po | 3 ++- html_text/i18n/de.po | 3 ++- html_text/i18n/es.po | 3 ++- html_text/i18n/es_ES.po | 3 ++- html_text/i18n/html_text.pot | 4 ++-- html_text/i18n/it.po | 3 ++- html_text/i18n/tr.po | 3 ++- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index 4c2d71a39be..38af0cb6390 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "11.0.1.0.2", + "version": "12.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " diff --git a/html_text/i18n/ca.po b/html_text/i18n/ca.po index ad8bc24941e..910cf3a661d 100644 --- a/html_text/i18n/ca.po +++ b/html_text/i18n/ca.po @@ -20,5 +20,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +#, fuzzy +msgid "Fields Converter" msgstr "ir.fields.converter" diff --git a/html_text/i18n/de.po b/html_text/i18n/de.po index 83dcba664b9..3eb49ad5435 100644 --- a/html_text/i18n/de.po +++ b/html_text/i18n/de.po @@ -20,5 +20,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +#, fuzzy +msgid "Fields Converter" msgstr "ir.fields.converter" diff --git a/html_text/i18n/es.po b/html_text/i18n/es.po index 49d31dfad56..c295b18ed68 100644 --- a/html_text/i18n/es.po +++ b/html_text/i18n/es.po @@ -20,5 +20,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +#, fuzzy +msgid "Fields Converter" msgstr "ir.fields.converter" diff --git a/html_text/i18n/es_ES.po b/html_text/i18n/es_ES.po index ff75c89903d..7ffe5ac8d29 100644 --- a/html_text/i18n/es_ES.po +++ b/html_text/i18n/es_ES.po @@ -21,5 +21,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +#, fuzzy +msgid "Fields Converter" msgstr "ir.documentos.conversor" diff --git a/html_text/i18n/html_text.pot b/html_text/i18n/html_text.pot index 92ef6e77320..3820ebcdf17 100644 --- a/html_text/i18n/html_text.pot +++ b/html_text/i18n/html_text.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" @@ -15,6 +15,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +msgid "Fields Converter" msgstr "" diff --git a/html_text/i18n/it.po b/html_text/i18n/it.po index 8931b2ef426..20ec4335d34 100644 --- a/html_text/i18n/it.po +++ b/html_text/i18n/it.po @@ -20,5 +20,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +#, fuzzy +msgid "Fields Converter" msgstr "ir.fields.converter" diff --git a/html_text/i18n/tr.po b/html_text/i18n/tr.po index 9c8231fe2d2..b1587027536 100644 --- a/html_text/i18n/tr.po +++ b/html_text/i18n/tr.po @@ -20,5 +20,6 @@ msgstr "" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter -msgid "ir.fields.converter" +#, fuzzy +msgid "Fields Converter" msgstr "ir.fields.converter" From 4fcef111d871077a06a8360286c193f95c72c495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Sat, 31 Aug 2019 06:14:01 +0000 Subject: [PATCH 09/47] Added translation using Weblate (Chinese (Simplified)) --- html_text/i18n/zh_CN.po | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 html_text/i18n/zh_CN.po diff --git a/html_text/i18n/zh_CN.po b/html_text/i18n/zh_CN.po new file mode 100644 index 00000000000..60fcf8baff0 --- /dev/null +++ b/html_text/i18n/zh_CN.po @@ -0,0 +1,20 @@ +# 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" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "Fields Converter" +msgstr "" From 515f9ce1272c4dd19d8ff729a438fb9606b58b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Sat, 31 Aug 2019 06:15:09 +0000 Subject: [PATCH 10/47] Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (1 of 1 strings) Translation: server-tools-12.0/server-tools-12.0-html_text Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-html_text/zh_CN/ --- html_text/i18n/zh_CN.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html_text/i18n/zh_CN.po b/html_text/i18n/zh_CN.po index 60fcf8baff0..34b66a179e4 100644 --- a/html_text/i18n/zh_CN.po +++ b/html_text/i18n/zh_CN.po @@ -6,15 +6,17 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2019-08-31 06:18+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" "Language-Team: none\n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" -msgstr "" +msgstr "字段转换器" From 0754161e8c5b07223190c8f8fec6181f8607b065 Mon Sep 17 00:00:00 2001 From: Bole Date: Wed, 13 Nov 2019 14:56:29 +0000 Subject: [PATCH 11/47] Added translation using Weblate (Croatian) --- html_text/i18n/hr.po | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 html_text/i18n/hr.po diff --git a/html_text/i18n/hr.po b/html_text/i18n/hr.po new file mode 100644 index 00000000000..6398ce339f2 --- /dev/null +++ b/html_text/i18n/hr.po @@ -0,0 +1,21 @@ +# 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" +"Last-Translator: Automatically generated\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" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "Fields Converter" +msgstr "" From cb890517a533ac68b98be1e0b3b904b4e380746f Mon Sep 17 00:00:00 2001 From: Bole Date: Wed, 13 Nov 2019 14:56:47 +0000 Subject: [PATCH 12/47] Translated using Weblate (Croatian) Currently translated at 100.0% (1 of 1 strings) Translation: server-tools-12.0/server-tools-12.0-html_text Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-html_text/hr/ --- html_text/i18n/hr.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html_text/i18n/hr.po b/html_text/i18n/hr.po index 6398ce339f2..5e5ad8c1eae 100644 --- a/html_text/i18n/hr.po +++ b/html_text/i18n/hr.po @@ -6,7 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2019-11-13 17:34+0000\n" +"Last-Translator: Bole \n" "Language-Team: none\n" "Language: hr\n" "MIME-Version: 1.0\n" @@ -14,8 +15,9 @@ msgstr "" "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 "" +msgstr "Pretvaranje polja" From e15b8e82f4e516367a7c3e2c8f1eea2d36de9fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 19 Feb 2021 10:49:09 +0100 Subject: [PATCH 13/47] [IMP] html_text: black, isort, prettier --- html_text/__manifest__.py | 16 +++++----------- html_text/models/ir_fields_converter.py | 12 +++++++----- html_text/tests/test_extractor.py | 16 +++++++++------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index 38af0cb6390..88f39b3d7c2 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -8,18 +8,12 @@ "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " - "Tecnativa, " - "Onestein, " - "Odoo Community Association (OCA)", + "Tecnativa, " + "Onestein, " + "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, - "external_dependencies": { - "python": [ - "lxml", - ], - }, - "depends": [ - "base", - ], + "external_dependencies": {"python": ["lxml",],}, + "depends": ["base",], } diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index f1c523280b4..7a07a359d33 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -3,7 +3,9 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging + from lxml import etree, html + from odoo import api, models _logger = logging.getLogger(__name__) @@ -13,8 +15,9 @@ class IrFieldsConverter(models.AbstractModel): _inherit = "ir.fields.converter" @api.model - def text_from_html(self, html_content, max_words=None, max_chars=None, - ellipsis=u"…", fail=False): + def text_from_html( + self, html_content, max_words=None, max_chars=None, ellipsis=u"…", fail=False + ): """Extract text from an HTML field in a generator. :param str html_content: @@ -45,8 +48,7 @@ def text_from_html(self, html_content, max_words=None, max_chars=None, if fail: raise else: - _logger.exception("Failure parsing this HTML:\n%s", - html_content) + _logger.exception("Failure parsing this HTML:\n%s", html_content) return "" # Get words @@ -63,7 +65,7 @@ def text_from_html(self, html_content, max_words=None, max_chars=None, # Truncate text suffix = suffix or max_chars and len(text) > max_chars if max_chars: - text = text[:max_chars - (len(ellipsis) if suffix else 0)].strip() + text = text[: max_chars - (len(ellipsis) if suffix else 0)].strip() # Append ellipsis if needed if suffix: diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 8922f4e25ce..d81b8876502 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -1,8 +1,8 @@ # Copyright 2016-2017 Jairo Llopis # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo.tools import mute_logger from odoo.tests.common import TransactionCase +from odoo.tools import mute_logger class ExtractorCase(TransactionCase): @@ -27,16 +27,18 @@ def test_excerpts(self): self.assertEqual( self.text_from_html(html), - u"I'm a title I'm a paragraph ¡Pues yo soy español!") + u"I'm a title I'm a paragraph ¡Pues yo soy español!", + ) self.assertEqual( - self.text_from_html(html, 8), - u"I'm a title I'm a paragraph ¡Pues yo…") + self.text_from_html(html, 8), u"I'm a title I'm a paragraph ¡Pues yo…" + ) self.assertEqual( - self.text_from_html(html, 8, 31), - u"I'm a title I'm a paragraph ¡P…") + self.text_from_html(html, 8, 31), u"I'm a title I'm a paragraph ¡P…" + ) self.assertEqual( self.text_from_html(html, 7, ellipsis=""), - u"I'm a title I'm a paragraph ¡Pues") + u"I'm a title I'm a paragraph ¡Pues", + ) @mute_logger("odoo.addons.html_text.models.ir_fields_converter") def test_empty_html(self): From fa6887ad4fdc0c4f3e691d2e12256709da5242ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 19 Feb 2021 10:52:54 +0100 Subject: [PATCH 14/47] [MIG] html_text: Migration to 13.0 --- html_text/README.rst | 1 - html_text/__manifest__.py | 6 +++--- html_text/readme/CONTRIBUTORS.rst | 6 ++++++ html_text/readme/DESCRIPTION.rst | 7 +++++++ html_text/readme/ROADMAP.rst | 2 ++ html_text/readme/USAGE.rst | 21 +++++++++++++++++++++ html_text/tests/test_extractor.py | 3 +-- 7 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 html_text/readme/CONTRIBUTORS.rst create mode 100644 html_text/readme/DESCRIPTION.rst create mode 100644 html_text/readme/ROADMAP.rst create mode 100644 html_text/readme/USAGE.rst diff --git a/html_text/README.rst b/html_text/README.rst index 2b53f838860..d740940ae42 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -24,7 +24,6 @@ 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 diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index 88f39b3d7c2..4438a77002e 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " @@ -14,6 +14,6 @@ "license": "AGPL-3", "application": False, "installable": True, - "external_dependencies": {"python": ["lxml",],}, - "depends": ["base",], + "external_dependencies": {"python": ["lxml"]}, + "depends": ["base"], } diff --git a/html_text/readme/CONTRIBUTORS.rst b/html_text/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..07e67237bb3 --- /dev/null +++ b/html_text/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Dennis Sluijk +* `Tecnativa `_:", + + * Jairo Llopis + * Vicent Cubells + * Víctor Martínez diff --git a/html_text/readme/DESCRIPTION.rst b/html_text/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..579fd7667e9 --- /dev/null +++ b/html_text/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +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. diff --git a/html_text/readme/ROADMAP.rst b/html_text/readme/ROADMAP.rst new file mode 100644 index 00000000000..0a77fddef64 --- /dev/null +++ b/html_text/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* An option could be added to try to respect the basic HTML tags inside the + excerpt (````, ````, ``

``, etc.). diff --git a/html_text/readme/USAGE.rst b/html_text/readme/USAGE.rst new file mode 100644 index 00000000000..ae34a9b25e9 --- /dev/null +++ b/html_text/readme/USAGE.rst @@ -0,0 +1,21 @@ +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:: + + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/149/11.0 diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index d81b8876502..1f0b7c91cb2 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -7,7 +7,7 @@ class ExtractorCase(TransactionCase): def setUp(self): - super(ExtractorCase, self).setUp() + super().setUp() # Shortcut self.text_from_html = self.env["ir.fields.converter"].text_from_html @@ -24,7 +24,6 @@ def test_excerpts(self): """ - self.assertEqual( self.text_from_html(html), u"I'm a title I'm a paragraph ¡Pues yo soy español!", From 0597248e2f58a21954a00e4deb7304ded86fd9c6 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Fri, 19 Feb 2021 15:34:17 +0000 Subject: [PATCH 15/47] [UPD] Update html_text.pot --- html_text/i18n/html_text.pot | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/html_text/i18n/html_text.pot b/html_text/i18n/html_text.pot index 3820ebcdf17..38e7394f8c8 100644 --- a/html_text/i18n/html_text.pot +++ b/html_text/i18n/html_text.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * html_text +# * html_text # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -17,4 +17,3 @@ msgstr "" #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "" - From 8b0c9d2439e5fca777b972fa92ecaab75a91a700 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 19 Feb 2021 15:41:42 +0000 Subject: [PATCH 16/47] [UPD] README.rst --- html_text/README.rst | 70 +++- html_text/static/description/index.html | 462 ++++++++++++++++++++++++ 2 files changed, 515 insertions(+), 17 deletions(-) create mode 100644 html_text/static/description/index.html diff --git a/html_text/README.rst b/html_text/README.rst index d740940ae42..933a2e9d574 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -1,11 +1,30 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - ==================== Text from HTML field ==================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/13.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-13-0/server-tools-13-0-html_text + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/149/13.0 + :alt: Try me on Runbot + +|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: @@ -14,6 +33,11 @@ any chunk of HTML, without HTML tags or attributes. You can chose either: It can be used to easily generate excerpts. +**Table of contents** + +.. contents:: + :local: + Usage ===== @@ -48,34 +72,46 @@ Known issues / Roadmap Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Grupo ESOC Ingeniería de Servicios +* Tecnativa +* Onestein + Contributors ------------- +~~~~~~~~~~~~ -* Jairo Llopis -* Vicent Cubells * Dennis Sluijk +* `Tecnativa `_:", -Do not contact contributors directly about support or help with technical issues. + * Jairo Llopis + * Vicent Cubells + * Víctor Martínez -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/server-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/html_text/static/description/index.html b/html_text/static/description/index.html new file mode 100644 index 00000000000..389c5bce843 --- /dev/null +++ b/html_text/static/description/index.html @@ -0,0 +1,462 @@ + + + + + + +Text from HTML field + + + +

+

Text from HTML field

+ + +

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

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

+ +
+

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 +
+
+

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. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Grupo ESOC Ingeniería de Servicios
  • +
  • Tecnativa
  • +
  • Onestein
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From 00d54c61347b3f937dc7062e7fcd63e8a707c9e9 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Fri, 19 Feb 2021 15:50:17 +0000 Subject: [PATCH 17/47] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-13.0/server-tools-13.0-html_text Translate-URL: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-html_text/ --- html_text/i18n/hr.po | 6 +++--- html_text/i18n/zh_CN.po | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/html_text/i18n/hr.po b/html_text/i18n/hr.po index 5e5ad8c1eae..1f6bad881a2 100644 --- a/html_text/i18n/hr.po +++ b/html_text/i18n/hr.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * html_text +# * html_text # msgid "" msgstr "" @@ -13,8 +13,8 @@ msgstr "" "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" +"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 diff --git a/html_text/i18n/zh_CN.po b/html_text/i18n/zh_CN.po index 34b66a179e4..b47ea1995c4 100644 --- a/html_text/i18n/zh_CN.po +++ b/html_text/i18n/zh_CN.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * html_text +# * html_text # msgid "" msgstr "" From fe8c2922e401297913f6ea23523667b3640512fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Su=C3=A1rez?= Date: Fri, 19 Mar 2021 15:12:44 +0000 Subject: [PATCH 18/47] Translated using Weblate (Spanish) Currently translated at 100.0% (1 of 1 strings) Translation: server-tools-13.0/server-tools-13.0-html_text Translate-URL: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-html_text/es/ --- html_text/i18n/es.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/html_text/i18n/es.po b/html_text/i18n/es.po index c295b18ed68..fdcdc423117 100644 --- a/html_text/i18n/es.po +++ b/html_text/i18n/es.po @@ -9,17 +9,17 @@ 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: 2016-12-17 02:07+0000\n" -"Last-Translator: Pedro M. Baeza , 2016\n" +"PO-Revision-Date: 2021-03-19 17:46+0000\n" +"Last-Translator: Ana Suárez \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" +"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 -#, fuzzy msgid "Fields Converter" -msgstr "ir.fields.converter" +msgstr "Convertidor de Campos" From de1ef034e9c1f3554d3b02c9121fc32289757f74 Mon Sep 17 00:00:00 2001 From: hkapatel Date: Mon, 24 May 2021 22:23:51 +0530 Subject: [PATCH 19/47] [MIG] html_text: Migration to 14.0 --- html_text/__manifest__.py | 2 +- html_text/readme/CONTRIBUTORS.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index 4438a77002e..fe31f398908 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " diff --git a/html_text/readme/CONTRIBUTORS.rst b/html_text/readme/CONTRIBUTORS.rst index 07e67237bb3..bd6b8caf4d5 100644 --- a/html_text/readme/CONTRIBUTORS.rst +++ b/html_text/readme/CONTRIBUTORS.rst @@ -1,5 +1,6 @@ * Dennis Sluijk * `Tecnativa `_:", +* Helly kapatel * Jairo Llopis * Vicent Cubells From 055235cc37a546857b93da865b3bdb538d5bb303 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Fri, 23 Jul 2021 16:25:36 +0000 Subject: [PATCH 20/47] [UPD] Update html_text.pot --- html_text/i18n/html_text.pot | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/html_text/i18n/html_text.pot b/html_text/i18n/html_text.pot index 38e7394f8c8..382577d81fd 100644 --- a/html_text/i18n/html_text.pot +++ b/html_text/i18n/html_text.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -13,7 +13,27 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" From b96145cb8b0c8c61391a7ed02fe9f0fa75840da5 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 23 Jul 2021 16:39:31 +0000 Subject: [PATCH 21/47] [UPD] README.rst --- html_text/README.rst | 11 ++++++----- html_text/static/description/index.html | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/html_text/README.rst b/html_text/README.rst index 933a2e9d574..7d9b8452ed3 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -14,13 +14,13 @@ Text from HTML field :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/13.0/html_text + :target: https://github.com/OCA/server-tools/tree/14.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-13-0/server-tools-13-0-html_text + :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-html_text :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/13.0 + :target: https://runbot.odoo-community.org/runbot/149/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -75,7 +75,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -94,6 +94,7 @@ Contributors * Dennis Sluijk * `Tecnativa `_:", +* Helly kapatel * Jairo Llopis * Vicent Cubells @@ -112,6 +113,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/html_text/static/description/index.html b/html_text/static/description/index.html index 389c5bce843..b626cc6ca78 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -367,7 +367,7 @@

Text from HTML field

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

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:

    @@ -421,7 +421,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

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

    @@ -438,7 +438,8 @@

    Authors

    Contributors

    From 4279224f0f5a6a75f5d2db96c419da9bdd54ad9e Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Fri, 23 Jul 2021 18:44:23 +0000 Subject: [PATCH 22/47] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-14.0/server-tools-14.0-html_text Translate-URL: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-html_text/ --- html_text/i18n/ca.po | 20 ++++++++++++++++++++ html_text/i18n/de.po | 20 ++++++++++++++++++++ html_text/i18n/es.po | 20 ++++++++++++++++++++ html_text/i18n/es_ES.po | 20 ++++++++++++++++++++ html_text/i18n/hr.po | 20 ++++++++++++++++++++ html_text/i18n/it.po | 20 ++++++++++++++++++++ html_text/i18n/tr.po | 20 ++++++++++++++++++++ html_text/i18n/zh_CN.po | 20 ++++++++++++++++++++ 8 files changed, 160 insertions(+) diff --git a/html_text/i18n/ca.po b/html_text/i18n/ca.po index 910cf3a661d..b82487c21f7 100644 --- a/html_text/i18n/ca.po +++ b/html_text/i18n/ca.po @@ -18,8 +18,28 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter #, fuzzy msgid "Fields Converter" msgstr "ir.fields.converter" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/de.po b/html_text/i18n/de.po index 3eb49ad5435..e75d5aa47f2 100644 --- a/html_text/i18n/de.po +++ b/html_text/i18n/de.po @@ -18,8 +18,28 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter #, fuzzy msgid "Fields Converter" msgstr "ir.fields.converter" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/es.po b/html_text/i18n/es.po index fdcdc423117..d32bd69b47f 100644 --- a/html_text/i18n/es.po +++ b/html_text/i18n/es.po @@ -19,7 +19,27 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.3.2\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "Convertidor de Campos" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/es_ES.po b/html_text/i18n/es_ES.po index 7ffe5ac8d29..b6e25257100 100644 --- a/html_text/i18n/es_ES.po +++ b/html_text/i18n/es_ES.po @@ -19,8 +19,28 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter #, fuzzy msgid "Fields Converter" msgstr "ir.documentos.conversor" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/hr.po b/html_text/i18n/hr.po index 1f6bad881a2..a0cc5ac2f73 100644 --- a/html_text/i18n/hr.po +++ b/html_text/i18n/hr.po @@ -17,7 +17,27 @@ msgstr "" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 3.8\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "Pretvaranje polja" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/it.po b/html_text/i18n/it.po index 20ec4335d34..1c4d41231bd 100644 --- a/html_text/i18n/it.po +++ b/html_text/i18n/it.po @@ -18,8 +18,28 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter #, fuzzy msgid "Fields Converter" msgstr "ir.fields.converter" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/tr.po b/html_text/i18n/tr.po index b1587027536..c5d8d9aa801 100644 --- a/html_text/i18n/tr.po +++ b/html_text/i18n/tr.po @@ -18,8 +18,28 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter #, fuzzy msgid "Fields Converter" msgstr "ir.fields.converter" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" diff --git a/html_text/i18n/zh_CN.po b/html_text/i18n/zh_CN.po index b47ea1995c4..7aea0bc70f9 100644 --- a/html_text/i18n/zh_CN.po +++ b/html_text/i18n/zh_CN.po @@ -16,7 +16,27 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.8\n" +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name +msgid "Display Name" +msgstr "" + #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "字段转换器" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id +msgid "ID" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update +msgid "Last Modified on" +msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" From 5f24bf9d775236b817faee0e868912641287c308 Mon Sep 17 00:00:00 2001 From: Mantux11 Date: Thu, 13 Jan 2022 11:01:34 +0000 Subject: [PATCH 23/47] [MIG] html_text: Migration to 15.0 --- html_text/README.rst | 1 + html_text/__manifest__.py | 2 +- html_text/readme/CONTRIBUTORS.rst | 1 + html_text/tests/test_extractor.py | 6 ++++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/html_text/README.rst b/html_text/README.rst index 7d9b8452ed3..b70b6fbfd29 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -95,6 +95,7 @@ Contributors * Dennis Sluijk * `Tecnativa `_:", * Helly kapatel +* Mantas Šniukas * Jairo Llopis * Vicent Cubells diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index fe31f398908..746e99635d7 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " diff --git a/html_text/readme/CONTRIBUTORS.rst b/html_text/readme/CONTRIBUTORS.rst index bd6b8caf4d5..cb155b7d8e0 100644 --- a/html_text/readme/CONTRIBUTORS.rst +++ b/html_text/readme/CONTRIBUTORS.rst @@ -1,6 +1,7 @@ * Dennis Sluijk * `Tecnativa `_:", * Helly kapatel +* Mantas Šniukas * Jairo Llopis * Vicent Cubells diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 1f0b7c91cb2..8036eace407 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -1,6 +1,8 @@ # Copyright 2016-2017 Jairo Llopis # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from lxml import etree + from odoo.tests.common import TransactionCase from odoo.tools import mute_logger @@ -43,12 +45,12 @@ def test_excerpts(self): def test_empty_html(self): """Empty HTML handled correctly.""" self.assertEqual(self.text_from_html(""), "") - with self.assertRaises(Exception): + with self.assertRaises(etree.ParserError): self.text_from_html("", fail=True) @mute_logger("odoo.addons.html_text.models.ir_fields_converter") def test_false_html(self): """``False`` HTML handled correctly.""" self.assertEqual(self.text_from_html(False), "") - with self.assertRaises(Exception): + with self.assertRaises(TypeError): self.text_from_html(False, fail=True) From ab5e8f2f570a56b8b6301523db8b778cebc3f2bd Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 2 Feb 2022 13:18:26 +0000 Subject: [PATCH 24/47] [UPD] Update html_text.pot --- html_text/i18n/html_text.pot | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/html_text/i18n/html_text.pot b/html_text/i18n/html_text.pot index 382577d81fd..731ee9a0b0e 100644 --- a/html_text/i18n/html_text.pot +++ b/html_text/i18n/html_text.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -13,27 +13,7 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: html_text -#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__display_name -msgid "Display Name" -msgstr "" - #. module: html_text #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "" - -#. module: html_text -#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__id -msgid "ID" -msgstr "" - -#. module: html_text -#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter____last_update -msgid "Last Modified on" -msgstr "" - -#. module: html_text -#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search -msgid "Smart Search" -msgstr "" From ab636909efd029a479f498b2f5bb1f29946b3f75 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 2 Feb 2022 13:20:42 +0000 Subject: [PATCH 25/47] [UPD] README.rst --- html_text/README.rst | 10 +++++----- html_text/static/description/index.html | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/html_text/README.rst b/html_text/README.rst index b70b6fbfd29..6820781ad0a 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -14,13 +14,13 @@ Text from HTML field :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/14.0/html_text + :target: https://github.com/OCA/server-tools/tree/15.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-14-0/server-tools-14-0-html_text + :target: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-html_text :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/14.0 + :target: https://runbot.odoo-community.org/runbot/149/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -75,7 +75,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -114,6 +114,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/html_text/static/description/index.html b/html_text/static/description/index.html index b626cc6ca78..5e675fdab2d 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -367,7 +367,7 @@

    Text from HTML field

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

    +

    Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

    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:

      @@ -421,7 +421,7 @@

      Bug Tracker

      Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

      +feedback.

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

      @@ -439,7 +439,8 @@

      Contributors

      From eea9c4d20c64a7dd277c7e075bc1767d1111ffe4 Mon Sep 17 00:00:00 2001 From: oca-git-bot Date: Wed, 30 Mar 2022 21:14:00 +0200 Subject: [PATCH 26/47] [IMP] update dotfiles --- html_text/models/ir_fields_converter.py | 6 +++--- html_text/tests/test_extractor.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/html_text/models/ir_fields_converter.py b/html_text/models/ir_fields_converter.py index 7a07a359d33..f407aeab3a3 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -16,7 +16,7 @@ class IrFieldsConverter(models.AbstractModel): @api.model def text_from_html( - self, html_content, max_words=None, max_chars=None, ellipsis=u"…", fail=False + self, html_content, max_words=None, max_chars=None, ellipsis="…", fail=False ): """Extract text from an HTML field in a generator. @@ -52,7 +52,7 @@ def text_from_html( return "" # Get words - words = u"".join(doc.xpath("//text()")).split() + words = "".join(doc.xpath("//text()")).split() # Truncate words suffix = max_words and len(words) > max_words @@ -60,7 +60,7 @@ def text_from_html( words = words[:max_words] # Get text - text = u" ".join(words) + text = " ".join(words) # Truncate text suffix = suffix or max_chars and len(text) > max_chars diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 8036eace407..6280f388613 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -15,7 +15,7 @@ def setUp(self): def test_excerpts(self): """Text gets correctly extracted.""" - html = u""" + html = """
      @@ -28,17 +28,17 @@ def test_excerpts(self): """ self.assertEqual( self.text_from_html(html), - u"I'm a title I'm a paragraph ¡Pues yo soy español!", + "I'm a title I'm a paragraph ¡Pues yo soy español!", ) self.assertEqual( - self.text_from_html(html, 8), u"I'm a title I'm a paragraph ¡Pues yo…" + self.text_from_html(html, 8), "I'm a title I'm a paragraph ¡Pues yo…" ) self.assertEqual( - self.text_from_html(html, 8, 31), u"I'm a title I'm a paragraph ¡P…" + self.text_from_html(html, 8, 31), "I'm a title I'm a paragraph ¡P…" ) self.assertEqual( self.text_from_html(html, 7, ellipsis=""), - u"I'm a title I'm a paragraph ¡Pues", + "I'm a title I'm a paragraph ¡Pues", ) @mute_logger("odoo.addons.html_text.models.ir_fields_converter") From ab0e8f0d82f9fd287752a15c65bdcde0a90d17f3 Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 4 Sep 2022 03:50:41 +0000 Subject: [PATCH 27/47] Added translation using Weblate (Spanish (Argentina)) --- html_text/i18n/es_AR.po | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 html_text/i18n/es_AR.po diff --git a/html_text/i18n/es_AR.po b/html_text/i18n/es_AR.po new file mode 100644 index 00000000000..46501ad580a --- /dev/null +++ b/html_text/i18n/es_AR.po @@ -0,0 +1,20 @@ +# 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" +"Last-Translator: Automatically generated\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" + +#. module: html_text +#: model:ir.model,name:html_text.model_ir_fields_converter +msgid "Fields Converter" +msgstr "" From e1aed51e2354da998de7968db303f8c71423846a Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 4 Sep 2022 03:52:06 +0000 Subject: [PATCH 28/47] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (1 of 1 strings) Translation: server-tools-15.0/server-tools-15.0-html_text Translate-URL: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-html_text/es_AR/ --- html_text/i18n/es_AR.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html_text/i18n/es_AR.po b/html_text/i18n/es_AR.po index 46501ad580a..e7d0b12af27 100644 --- a/html_text/i18n/es_AR.po +++ b/html_text/i18n/es_AR.po @@ -6,15 +6,17 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-09-04 06:07+0000\n" +"Last-Translator: Ignacio Buioli \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 "" +msgstr "Convertidor de Campos" From 9bd408bc670852a77d290fa087993ad4b7cb062b Mon Sep 17 00:00:00 2001 From: dsolanki Date: Wed, 22 Mar 2023 16:22:09 +0530 Subject: [PATCH 29/47] [IMP] html_text: pre-commit stuff --- html_text/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index 746e99635d7..45433fd43ad 100644 --- a/html_text/__manifest__.py +++ b/html_text/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Text from HTML field", "summary": "Generate excerpts from any HTML field", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/server-tools", "author": "Grupo ESOC Ingeniería de Servicios, " From c81ab5fb5c090c6969790a75bbdb432e795934dc Mon Sep 17 00:00:00 2001 From: dsolanki Date: Wed, 22 Mar 2023 17:57:55 +0530 Subject: [PATCH 30/47] [MIG] html_text: Migration to 16.0 --- html_text/README.rst | 5 +++-- html_text/readme/CONTRIBUTORS.rst | 1 + html_text/static/description/index.html | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/html_text/README.rst b/html_text/README.rst index 6820781ad0a..31c86e1fce1 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -14,7 +14,7 @@ Text from HTML field :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/15.0/html_text + :target: https://github.com/OCA/server-tools/tree/16.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-15-0/server-tools-15-0-html_text @@ -96,6 +96,7 @@ Contributors * `Tecnativa `_:", * Helly kapatel * Mantas Šniukas +* Dhara Solanki * Jairo Llopis * Vicent Cubells @@ -114,6 +115,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/html_text/readme/CONTRIBUTORS.rst b/html_text/readme/CONTRIBUTORS.rst index cb155b7d8e0..664c8bad807 100644 --- a/html_text/readme/CONTRIBUTORS.rst +++ b/html_text/readme/CONTRIBUTORS.rst @@ -2,6 +2,7 @@ * `Tecnativa `_:", * Helly kapatel * Mantas Šniukas +* Dhara Solanki * Jairo Llopis * Vicent Cubells diff --git a/html_text/static/description/index.html b/html_text/static/description/index.html index 5e675fdab2d..ca59e3a559b 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -367,7 +367,7 @@

      Text from HTML field

      !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

      Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

      +

      Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

      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:

        @@ -455,7 +455,7 @@

        Maintainers

        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 project on GitHub.

        +

        This module is part of the OCA/server-tools project on GitHub.

        You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

      From 2472a5a3578b8dd8d726da0dbffdd7fca235fab4 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 1 Nov 2023 06:57:11 +0000 Subject: [PATCH 31/47] [UPD] Update html_text.pot --- html_text/i18n/html_text.pot | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/html_text/i18n/html_text.pot b/html_text/i18n/html_text.pot index 731ee9a0b0e..f6a31efc496 100644 --- a/html_text/i18n/html_text.pot +++ b/html_text/i18n/html_text.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -17,3 +17,8 @@ msgstr "" #: model:ir.model,name:html_text.model_ir_fields_converter msgid "Fields Converter" msgstr "" + +#. module: html_text +#: model:ir.model.fields,field_description:html_text.field_ir_fields_converter__smart_search +msgid "Smart Search" +msgstr "" From 430997a8e217c7c7794b6401f177ca42f52e0273 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 1 Nov 2023 07:06:10 +0000 Subject: [PATCH 32/47] [BOT] post-merge updates --- html_text/README.rst | 19 +++++----- html_text/static/description/index.html | 47 +++++++++++++------------ 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/html_text/README.rst b/html_text/README.rst index 31c86e1fce1..85fbeab2808 100644 --- a/html_text/README.rst +++ b/html_text/README.rst @@ -2,10 +2,13 @@ Text from HTML field ==================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7c377c62e6608920605229a29147973288dc49805cbc1e1d8bbbeeb4d3359eaa + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -17,13 +20,13 @@ Text from HTML field :target: https://github.com/OCA/server-tools/tree/16.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-15-0/server-tools-15-0-html_text + :target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-html_text :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/15.0 - :alt: Try me on Runbot +.. |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=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|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: @@ -74,8 +77,8 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/html_text/static/description/index.html b/html_text/static/description/index.html index ca59e3a559b..8e2380a9fbc 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -1,20 +1,20 @@ - + - + Text from HTML field -
      -

      Text from HTML field

      +
      + + +Odoo Community Association + +
      +

      Text from HTML field

      -

      Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runboat

      +

      Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runboat

      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:

      @@ -393,7 +398,7 @@

      Text from HTML field

    -

    Usage

    +

    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.

    @@ -413,24 +418,24 @@

    Usage

    Try me on Runbot

    -

    Known issues / Roadmap

    +

    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

    +

    Bug Tracker

    Bugs are tracked on GitHub 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.

    +feedback.

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

    -

    Credits

    +

    Credits

    -

    Authors

    +

    Authors

    • Grupo ESOC Ingeniería de Servicios
    • Tecnativa
    • @@ -438,7 +443,7 @@

      Authors

    -

    Contributors

    +

    Contributors

    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association @@ -462,10 +467,11 @@

    Maintainers

    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 project on GitHub.

    +

    This module is part of the OCA/server-tools project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    + diff --git a/html_text/tests/test_extractor.py b/html_text/tests/test_extractor.py index 04523552465..c117ab8b647 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -1,8 +1,6 @@ # Copyright 2016-2017 Jairo Llopis # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from lxml import etree - from odoo.tests.common import TransactionCase from odoo.tools import mute_logger @@ -46,8 +44,9 @@ def test_excerpts(self): def test_empty_html(self): """Empty HTML handled correctly.""" self.assertEqual(self.text_from_html(""), "") - with self.assertRaises(etree.ParserError): - self.text_from_html("", fail=True) + # 19.0 lxml no longer raises ParserError on empty input; the parser + # returns an empty document, so fail=True yields "" as well. + self.assertEqual(self.text_from_html("", fail=True), "") @mute_logger("odoo.addons.html_text.models.ir_fields_converter") def test_false_html(self):