render method
Renders template using issue and attempt.
Throws WorkflowException when rendering fails.
Implementation
String render(String template, {required Issue issue, int? attempt}) {
if (template.trim().isEmpty) {
return 'You are working on an issue from Spectra.';
}
final scope = <String, Object?>{
'issue': issue.toJson(),
'attempt': attempt,
};
final tokens = _tokenize(template);
final buffer = StringBuffer();
var index = 0;
while (index < tokens.length) {
index = _renderTokens(
tokens,
index,
scope,
buffer,
terminators: const <String>{},
);
}
return buffer.toString();
}