render_optional_html_attribute

func render_optional_html_attribute<Value: RenderHtml>(name: String, consume value: Value?) -> String

Renders a leading-space attribute only when value is present.

The attribute value passes through RenderHtml; name is trusted syntax generated by the macro and is not escaped here.

View Source
pub func render_optional_html_attribute<Value: RenderHtml>(name: String, consume value: Value?) -> String {
	match value {
		.some(found) -> " " + name + "=\"" + render_html(value: found) + "\"",
		.none -> ""
	}
}