11 lines
355 B
Python
11 lines
355 B
Python
import html as html_lib
|
|
|
|
|
|
def _attr_string(attrs, extra_style):
|
|
parts = [f'style="{html_lib.escape(extra_style)}"']
|
|
for k, v in attrs.items():
|
|
if v in (None, "", False):
|
|
continue
|
|
parts.append(html_lib.escape(str(k)) if v is True else f'{html_lib.escape(str(k))}="{html_lib.escape(str(v))}"')
|
|
return " ".join(parts)
|