Coverage for pyquickhelper/texthelper/html_helper.py: 100%
5 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
1# -*- coding: utf-8 -*-
2"""
3@file
4@brief Some functions about HTML
5"""
6import base64
9def html_in_frame(htext, style="width:100%;height:100%;"):
10 """
11 Inserts :epkg:`HTML` text into a frame in binary format.
13 @param htext string to clean
14 @param style HTML style
15 @return HTML string
16 """
17 html = "data:text/html;base64," + base64.b64encode(htext.encode('utf8')).decode('utf8') # noqa
18 return f'<iframe src="{html}" style="{style}"></iframe>'