Spaces:
Running
Running
File size: 921 Bytes
e5fc5ba f8732f2 e5fc5ba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
class HtmlRender:
def __init__(
self
) -> None:
pass
def output(
self,
html: str
) -> str:
template = "<center>{}</center>"
return template.format(html)
def error(
self,
html: str
) -> str:
template = """
<center>
<div class="alert alert-warning" role="alert">
<h6><b>{}</b></h6>
</div>
</center>
"""
return template.format(html)
def budget(
self,
text: str,
category: str,
color: str
) -> str:
html = f"""
<span type="button" title="{category}" class="btn btn-{color} btn-sm">
<b>{text}</b><br>
<span class="badge badge-pill badge-light">{category}</span>
</span>
"""
return html if text != "" else "" |