Skip to main content

format_html_join

A wrapper of format_html, for the common case of a group of arguments that need to be formatted using the same format string, and then joined using 'sep'. 'sep' is also passed through conditional_escape.

def format_html_join(
sep: string,
format_string: string,
args_generator: iterable
) - > SafeString

A wrapper of format_html, for the common case of a group of arguments that need to be formatted using the same format string, and then joined using 'sep'. 'sep' is also passed through conditional_escape.

Parameters

NameTypeDescription
sepstringThe separator string used to join the formatted elements; it is automatically escaped before joining.
format_stringstringThe HTML fragment template containing placeholders to be populated by the arguments from the generator.
args_generatoriterableAn iterator that yields sequences (tuples/lists) or mappings (dicts) of arguments to be applied to the format_string.

Returns

TypeDescription
SafeStringA safe HTML string containing the joined results of the formatted arguments, where each element and the separator have been properly escaped.