- Replace generic UI with dedicated Heroprompt web interface - Implement new Heroprompt-specific backend APIs - Develop client-side logic for file browsing and selection - Enhance workspace configuration and management capabilities - Remove deprecated generic UI modules and code
29 lines
619 B
V
29 lines
619 B
V
module heroprompt
|
|
|
|
import strings
|
|
|
|
// Very small template renderer using {{.var}} replacement
|
|
pub fn render_template(tpl string, data map[string]string) string {
|
|
mut out := tpl
|
|
for k, v in data {
|
|
out = out.replace('{{.' + k + '}}', v)
|
|
}
|
|
return out
|
|
}
|
|
|
|
// Minimal HTML escape
|
|
pub fn html_escape(s string) string {
|
|
mut b := strings.new_builder(s.len)
|
|
for ch in s {
|
|
match ch {
|
|
`&` { b.write_string('&') }
|
|
`<` { b.write_string('<') }
|
|
`>` { b.write_string('>') }
|
|
`"` { b.write_string('"') }
|
|
`'` { b.write_string(''') }
|
|
else { b.write_string(ch.str()) }
|
|
}
|
|
}
|
|
return b.str()
|
|
}
|