From 4c087f67f14a1b652710adf6dbe3c25812b79e18 Mon Sep 17 00:00:00 2001 From: Yajo Date: Mon, 4 Apr 2016 16:58:49 +0200 Subject: [PATCH 01/30] 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 000000000..38eac30af --- /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 000000000..09356048f --- /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 000000000..07f931ee8 --- /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 000000000..11b8b13d5 --- /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 000000000..503b2c7c7 --- /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.png new file mode 100644 index 0000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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 000000000..60346a281 --- /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 000000000..f7d0843d3 --- /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 971a27006651f182c1bdab1aa8c824ed68d0de0f Mon Sep 17 00:00:00 2001 From: Yajo Date: Tue, 5 Apr 2016 16:58:19 +0200 Subject: [PATCH 02/30] 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 503b2c7c7..1ad3572ea 100644 --- a/html_text/models/ir_fields_converter.py +++ b/html_text/models/ir_fields_converter.py @@ -41,7 +41,7 @@ class IrFieldsConverter(models.Model): # 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 f7d0843d3..22443e32a 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -46,6 +46,12 @@ class ExtractorCase(TransactionCase): 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 8f1245097639dd8853090aec78d001f44646d65c Mon Sep 17 00:00:00 2001 From: cubells Date: Mon, 28 Nov 2016 11:12:30 +0100 Subject: [PATCH 03/30] 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 38eac30af..52c7755be 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 09356048f..197214cdd 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 07f931ee8..173d737a0 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 000000000..218f75161 --- /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 000000000..b9f4c6287 --- /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 000000000..0a08e7b0f --- /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 000000000..0394084e0 --- /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 000000000..3531df8fb --- /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 11b8b13d5..5746f8b6b 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 1ad3572ea..5180665f0 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 0ba56f7e656961dffb94b4414dff8792d73b3999 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 22 Jun 2017 13:08:16 +0200 Subject: [PATCH 04/30] [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 52c7755be..59ab65597 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 197214cdd..a77a6fcbc 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 173d737a0..af0df87b6 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 000000000..454889f20 --- /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 5746f8b6b..6fcbec0b6 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 5180665f0..1e84b1cad 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 60346a281..f8ca9e601 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 22443e32a..938361fd7 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 @@ class ExtractorCase(TransactionCase): 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 1aa658a9338c701fa02aa9b91287ccf80a5cfded Mon Sep 17 00:00:00 2001 From: tarteo Date: Wed, 14 Feb 2018 13:15:58 +0100 Subject: [PATCH 05/30] [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 59ab65597..2b53f8388 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 a77a6fcbc..31660d6a9 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 af0df87b6..a0d081878 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 6fcbec0b6..e21238ee9 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 1e84b1cad..f1c523280 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 f8ca9e601..d9d2b331a 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 938361fd7..8922f4e25 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 @@ class ExtractorCase(TransactionCase): 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 4c2292e59be991ceeb35bfc84abc1deb8be29217 Mon Sep 17 00:00:00 2001 From: Jaume Planas Date: Fri, 27 Apr 2018 20:15:26 +0200 Subject: [PATCH 06/30] [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 a0d081878..4c2d71a39 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 c48effd221f8104f2e86223bb10830a44b164168 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Sun, 17 Jun 2018 20:50:52 +0000 Subject: [PATCH 07/30] [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 218f75161..ad8bc2494 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 b9f4c6287..83dcba664 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 0a08e7b0f..49d31dfad 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 0394084e0..ff75c8990 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 000000000..92ef6e773 --- /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 454889f20..8931b2ef4 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 3531df8fb..9c8231fe2 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 748865326e786eb86a18e5c96120c0c1bb69f659 Mon Sep 17 00:00:00 2001 From: Dike90 <919055994@qq.com> Date: Sat, 3 Nov 2018 15:19:37 +0800 Subject: [PATCH 08/30] [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 4c2d71a39..38af0cb63 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 ad8bc2494..910cf3a66 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 83dcba664..3eb49ad54 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 49d31dfad..c295b18ed 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 ff75c8990..7ffe5ac8d 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 92ef6e773..3820ebcdf 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 8931b2ef4..20ec4335d 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 9c8231fe2..b15870275 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 f18f00361fc5e948611ed11d2118ff6997ef674c 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/30] 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 000000000..60fcf8baf --- /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 a960d10b06f94ab46fc29102a2b5c5333ffc987b 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/30] 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 60fcf8baf..34b66a179 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 c5ad556c9f07448b9caa46a6acdf8ea66c7b1747 Mon Sep 17 00:00:00 2001 From: Bole Date: Wed, 13 Nov 2019 14:56:29 +0000 Subject: [PATCH 11/30] 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 000000000..6398ce339 --- /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 18481b71ac060f17239d2aad7a445dcb5825bf59 Mon Sep 17 00:00:00 2001 From: Bole Date: Wed, 13 Nov 2019 14:56:47 +0000 Subject: [PATCH 12/30] 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 6398ce339..5e5ad8c1e 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 f5cab2b92f8c237a0d547329a27e6fb6a777bce6 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/30] [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 38af0cb63..88f39b3d7 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 f1c523280..7a07a359d 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 @@ class IrFieldsConverter(models.AbstractModel): 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 @@ class IrFieldsConverter(models.AbstractModel): # 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 8922f4e25..d81b88765 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 @@ class ExtractorCase(TransactionCase): 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 8f3b44bdacb84dc621937e1e9ea36b7623c25d77 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/30] [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 2b53f8388..d740940ae 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 88f39b3d7..4438a7700 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 000000000..07e67237b --- /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 000000000..579fd7667 --- /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 000000000..0a77fddef --- /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 000000000..ae34a9b25 --- /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 d81b88765..1f0b7c91c 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -7,7 +7,7 @@ from odoo.tools import mute_logger 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 @@ class ExtractorCase(TransactionCase): """ - self.assertEqual( self.text_from_html(html), u"I'm a title I'm a paragraph ¡Pues yo soy español!", From 946fd8321d00a217304dca3be8922db070d5247f Mon Sep 17 00:00:00 2001 From: oca-travis Date: Fri, 19 Feb 2021 15:34:17 +0000 Subject: [PATCH 15/30] [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 3820ebcdf..38e7394f8 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 46b243b5262ee3ef4f1e42d635389f24f1d15209 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 19 Feb 2021 15:41:42 +0000 Subject: [PATCH 16/30] [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 d740940ae..933a2e9d5 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 000000000..389c5bce8 --- /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 f6a5a1cedd78e0bf41020c483e0b565c63666512 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Fri, 19 Feb 2021 15:50:17 +0000 Subject: [PATCH 17/30] 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 5e5ad8c1e..1f6bad881 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 34b66a179..b47ea1995 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 0b94af782da49591ef7ce713cac86799e1b55bb9 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/30] 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 c295b18ed..fdcdc4231 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 eab2f0377e02387c33044dc0c3f7adb90a0f7e64 Mon Sep 17 00:00:00 2001 From: hkapatel Date: Mon, 24 May 2021 22:23:51 +0530 Subject: [PATCH 19/30] [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 4438a7700..fe31f3989 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 07e67237b..bd6b8caf4 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 8c63e24d4b349225e65e7d3f96e254798c559c69 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Fri, 23 Jul 2021 16:25:36 +0000 Subject: [PATCH 20/30] [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 38e7394f8..382577d81 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 b90c54dc6a38f360e457a746b6ad3a79978c55d5 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 23 Jul 2021 16:39:31 +0000 Subject: [PATCH 21/30] [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 933a2e9d5..7d9b8452e 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 389c5bce8..b626cc6ca 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! 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 @@ excerpt (<b>, 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 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    Contributors

    From 184b6d4e1c34f3bcdd87c4333a63300c404000ac Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Fri, 23 Jul 2021 18:44:23 +0000 Subject: [PATCH 22/30] 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 910cf3a66..b82487c21 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 3eb49ad54..e75d5aa47 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 fdcdc4231..d32bd69b4 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 7ffe5ac8d..b6e252571 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 1f6bad881..a0cc5ac2f 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 20ec4335d..1c4d41231 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 b15870275..c5d8d9aa8 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 b47ea1995..7aea0bc70 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 e21db2d2907b783497f1c521bf7b51f8885f546c Mon Sep 17 00:00:00 2001 From: Mantux11 Date: Thu, 13 Jan 2022 11:01:34 +0000 Subject: [PATCH 23/30] [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 7d9b8452e..b70b6fbfd 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 fe31f3989..746e99635 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 bd6b8caf4..cb155b7d8 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 1f0b7c91c..8036eace4 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 @@ class ExtractorCase(TransactionCase): 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 dfc985349cac522f80739caca79d0575b913c3db Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 2 Feb 2022 13:18:26 +0000 Subject: [PATCH 24/30] [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 382577d81..731ee9a0b 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 16dea204914a97b4bd52739c3f0b6970f53a7841 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 2 Feb 2022 13:20:42 +0000 Subject: [PATCH 25/30] [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 b70b6fbfd..6820781ad 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 b626cc6ca..5e675fdab 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! 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 @@ excerpt (<b>, 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 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
      From f7a5b4dd71ba186bfebadadedaedf6407eba091c Mon Sep 17 00:00:00 2001 From: oca-git-bot Date: Wed, 30 Mar 2022 21:14:00 +0200 Subject: [PATCH 26/30] [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 7a07a359d..f407aeab3 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 @@ class IrFieldsConverter(models.AbstractModel): 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 @@ class IrFieldsConverter(models.AbstractModel): 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 8036eace4..6280f3886 100644 --- a/html_text/tests/test_extractor.py +++ b/html_text/tests/test_extractor.py @@ -15,7 +15,7 @@ class ExtractorCase(TransactionCase): def test_excerpts(self): """Text gets correctly extracted.""" - html = u""" + html = """
      @@ -28,17 +28,17 @@ class ExtractorCase(TransactionCase): """ 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 9bd2f7e39a4b540c22f2436e81629f2c2dce13be Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 4 Sep 2022 03:50:41 +0000 Subject: [PATCH 27/30] 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 000000000..46501ad58 --- /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 ce4497427a27dcf8b10f91af3a5d61c1f467c78f Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 4 Sep 2022 03:52:06 +0000 Subject: [PATCH 28/30] 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 46501ad58..e7d0b12af 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 904342c06034c477aa898280270f78c0e4d60922 Mon Sep 17 00:00:00 2001 From: dsolanki Date: Wed, 22 Mar 2023 16:22:09 +0530 Subject: [PATCH 29/30] [IMP] html_text: pre-commit stuff --- html_text/__manifest__.py | 2 +- requirements.txt | 1 + setup/html_text/odoo/addons/html_text | 1 + setup/html_text/setup.py | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) create mode 120000 setup/html_text/odoo/addons/html_text create mode 100644 setup/html_text/setup.py diff --git a/html_text/__manifest__.py b/html_text/__manifest__.py index 746e99635..45433fd43 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, " diff --git a/requirements.txt b/requirements.txt index d1df8effa..6a7c072e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ # generated from manifests external_dependencies astor dataclasses +lxml mako odoorpc openupgradelib diff --git a/setup/html_text/odoo/addons/html_text b/setup/html_text/odoo/addons/html_text new file mode 120000 index 000000000..a8751217b --- /dev/null +++ b/setup/html_text/odoo/addons/html_text @@ -0,0 +1 @@ +../../../../html_text \ No newline at end of file diff --git a/setup/html_text/setup.py b/setup/html_text/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/html_text/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From a3802694f6370de77f54dbc26f249011d33f286c Mon Sep 17 00:00:00 2001 From: dsolanki Date: Wed, 22 Mar 2023 17:57:55 +0530 Subject: [PATCH 30/30] [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 6820781ad..31c86e1fc 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 cb155b7d8..664c8bad8 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 5e675fdab..ca59e3a55 100644 --- a/html_text/static/description/index.html +++ b/html_text/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! 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 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

        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.