textoutpc.misc – Miscellaneous utilities#

textoutpc.misc.html_escape(text: str, /) str#

Escape HTML entities in the given text.

Parameters:

text – Text to escape.

Returns:

Text with escaped HTML entities.

textoutpc.misc.html_start_tag(name: str, /, *, cls: str | Sequence[str] | None = None, **kwargs: str | None) str#

Get an HTML start tag.

Parameters:
  • name – Name of the start tag.

  • cls – CSS classes for the tag.

Returns:

Rendered start tag.

textoutpc.misc.get_url_with_params(url: str, **kwargs: str | None) str#

Get an URL with additional or without some query parameters.

Parameters:

url – The URL to modify.

textoutpc.misc.get_url_param(url: str, name: str, /) str#

Get a specific query parameter from an URL.

Parameters:
  • url – The URL to get the parameter from.

  • name – The name of the query parameter to get.

Returns:

Value, or empty string if the parameter was not present.