pub fn template(source: &str, kotlin: bool) -> String
Templates use JSON-compatible quoted strings; Kotlin additionally needs dollar signs escaped to preserve JavaScript template literals.