Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions html_image_url_extractor/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==========================
Image URLs from HTML field
==========================

This module includes a method that extracts image URLs from any chunk of HTML,
in appearing order.

It is useful for modules such as `website_blog_excerpt_img
<https://github.com/OCA/website/tree/9.0/website_blog_excerpt_img>`_: blog list shows the first
image included in the post if haven't a defined cover image.

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 images from an HTML field
imgs = self.env["ir.fields.converter"].imgs_from_html(self.html_field)
for url in imgs:
# Do stuff with those URLs
pass

QWeb example::

<!-- Extract first image from a blog post -->
<t t-foreach="env['ir.fields.converter']
.imgs_from_html(blog_post.content, 1)"
t-as="url">
<img t-att-href="url"/>
</t>

.. 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/12.0

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

* The regexp to find the URL could be better.

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

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

* Jairo Llopis <jairo.llopis@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Dennis Sluijk <d.sluijk@onestein.nl>
* Cristina Martin R. <cristina.martin@tecnativa.com>

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

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.
3 changes: 3 additions & 0 deletions html_image_url_extractor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
25 changes: 25 additions & 0 deletions html_image_url_extractor/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells
# Copyright 2016 Tecnativa - Cristina Martin R.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Image URLs from HTML field",
"summary": "Extract images found in any HTML field",
"version": "12.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-tools",
"author": "Tecnativa, "
"Onestein, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"external_dependencies": {
"python": [
"lxml",
],
},
"depends": [
"base",
],
}
36 changes: 36 additions & 0 deletions html_image_url_extractor/i18n/am.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 04:11+0000\n"
"PO-Revision-Date: 2016-12-03 04:11+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Amharic (https://www.transifex.com/oca/teams/23907/am/)\n"
"Language: am\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_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr ""

#~ msgid "Created by"
#~ msgstr "Creado por"

#~ msgid "Created on"
#~ msgstr "Creado en"

#~ msgid "Last Updated by"
#~ msgstr "Última actualización por"

#~ msgid "Last Updated on"
#~ msgstr "Última actualización en"
37 changes: 37 additions & 0 deletions html_image_url_extractor/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 04:11+0000\n"
"PO-Revision-Date: 2016-12-03 04:11+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: html_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr ""

#~ msgid "Created by"
#~ msgstr "أنشئ بواسطة"

#~ msgid "Created on"
#~ msgstr "أنشئ في"

#~ msgid "Last Updated by"
#~ msgstr "آخر تحديث بواسطة"

#~ msgid "Last Updated on"
#~ msgstr "آخر تحديث في"
36 changes: 36 additions & 0 deletions html_image_url_extractor/i18n/bg.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 04:11+0000\n"
"PO-Revision-Date: 2016-12-03 04:11+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Bulgarian (https://www.transifex.com/oca/teams/23907/bg/)\n"
"Language: bg\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_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr ""

#~ msgid "Created by"
#~ msgstr "Създадено от"

#~ msgid "Created on"
#~ msgstr "Създадено на"

#~ msgid "Last Updated by"
#~ msgstr "Последно обновено от"

#~ msgid "Last Updated on"
#~ msgstr "Последно обновено на"
37 changes: 37 additions & 0 deletions html_image_url_extractor/i18n/bs.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 04:11+0000\n"
"PO-Revision-Date: 2016-12-03 04:11+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Bosnian (https://www.transifex.com/oca/teams/23907/bs/)\n"
"Language: bs\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_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr ""

#~ msgid "Created by"
#~ msgstr "Kreirao"

#~ msgid "Created on"
#~ msgstr "Kreirano"

#~ msgid "Last Updated by"
#~ msgstr "Zadnji ažurirao"

#~ msgid "Last Updated on"
#~ msgstr "Zadnje ažurirano"
24 changes: 24 additions & 0 deletions html_image_url_extractor/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-21 02:43+0000\n"
"PO-Revision-Date: 2017-07-21 02:43+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: html_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr "ir.fields.converter"
36 changes: 36 additions & 0 deletions html_image_url_extractor/i18n/cs.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 04:11+0000\n"
"PO-Revision-Date: 2016-12-03 04:11+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Czech (https://www.transifex.com/oca/teams/23907/cs/)\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"

#. module: html_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr ""

#~ msgid "Created by"
#~ msgstr "Vytvořil(a)"

#~ msgid "Created on"
#~ msgstr "Vytvořeno"

#~ msgid "Last Updated by"
#~ msgstr "Naposled upraveno"

#~ msgid "Last Updated on"
#~ msgstr "Naposled upraveno"
25 changes: 25 additions & 0 deletions html_image_url_extractor/i18n/cs_CZ.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# Lukáš Spurný <lukasspurny8@gmail.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-03 10:08+0000\n"
"PO-Revision-Date: 2018-03-03 10:08+0000\n"
"Last-Translator: Lukáš Spurný <lukasspurny8@gmail.com>, 2018\n"
"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/"
"teams/23907/cs_CZ/)\n"
"Language: cs_CZ\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"

#. module: html_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr "ir.fields.converter"
36 changes: 36 additions & 0 deletions html_image_url_extractor/i18n/da.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * html_image_url_extractor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-03 04:11+0000\n"
"PO-Revision-Date: 2016-12-03 04:11+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Danish (https://www.transifex.com/oca/teams/23907/da/)\n"
"Language: da\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_image_url_extractor
#: model:ir.model,name:html_image_url_extractor.model_ir_fields_converter
msgid "ir.fields.converter"
msgstr ""

#~ msgid "Created by"
#~ msgstr "Oprettet af"

#~ msgid "Created on"
#~ msgstr "Oprettet den"

#~ msgid "Last Updated by"
#~ msgstr "Sidst opdateret af"

#~ msgid "Last Updated on"
#~ msgstr "Sidst opdateret den"
Loading