linkify game, edition, purchase, session references
Some checks failed
Django CI/CD / test (push) Successful in 1m0s
Django CI/CD / build-and-push (push) Has been cancelled

also add link styles for links in a table row
This commit is contained in:
2024-09-02 20:04:21 +02:00
parent b8258e2937
commit e067e65bce
7 changed files with 174 additions and 85 deletions

View File

@ -27,6 +27,20 @@ def Popover(
return result
HTMLAttribute = tuple[str, str]
HTMLTag = str
def A(attributes: list[HTMLAttribute], children: list[HTMLTag] | HTMLTag) -> HTMLTag:
if isinstance(children, str):
children = [children]
childrenBlob = "\n".join(children)
attributesList = [f'{name} = "{value}"' for name, value in attributes]
attributesBlob = " ".join(attributesList)
tag: str = f"<a {attributesBlob}>{childrenBlob}</a>"
return mark_safe(tag)
def safe_division(numerator: int | float, denominator: int | float) -> int | float:
"""
Divides without triggering division by zero exception.