3.1.12.1. waf_tools.c_codegen_template.render_template

waf_tools.c_codegen_template.render_template(template_text: str, values: dict[str, str]) → str

Render a template string with comment-style placeholders.

${name} placeholders are required and use Python string.Template substitution semantics.

Comment-style placeholders use /* @name@ */. Only header_guard_start is required. Missing optional comment placeholders render as empty text. If an optional comment placeholder appears alone on a line, the full line is removed, including its newline.

Parameters:
  • template_text – Template source string.

  • values – Mapping of placeholder names to replacement values.

Returns:

Rendered template string.

Raises:

KeyError – If a required placeholder has no matching value.