mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-20 07:42:00 +02:00
Initial commit: Mail packages
This commit is contained in:
commit
4e53507711
1948 changed files with 751201 additions and 0 deletions
3
odoo-bringout-oca-ocb-sms/sms/tools/__init__.py
Normal file
3
odoo-bringout-oca-ocb-sms/sms/tools/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import sms_tools
|
||||
14
odoo-bringout-oca-ocb-sms/sms/tools/sms_tools.py
Normal file
14
odoo-bringout-oca-ocb-sms/sms/tools/sms_tools.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import re
|
||||
|
||||
from odoo.tools import TEXT_URL_REGEX, create_link, html_escape
|
||||
|
||||
|
||||
def sms_content_to_rendered_html(text):
|
||||
"""Transforms plaintext into html making urls clickable and preserving newlines"""
|
||||
urls = re.findall(TEXT_URL_REGEX, text)
|
||||
escaped_text = str(html_escape(text))
|
||||
for url in urls:
|
||||
escaped_text = escaped_text.replace(url, create_link(url, url))
|
||||
return re.sub(r'\r?\n|\r', '<br/>', escaped_text)
|
||||
Loading…
Add table
Add a link
Reference in a new issue