Files
herolib/lib/web/heroprompt/utils.v
Mahmoud-Emad 854eb9972b feat: integrate Heroprompt UI and backend
- 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
2025-08-21 10:49:02 +03:00

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('&lt;') }
`>` { b.write_string('&gt;') }
`"` { b.write_string('&quot;') }
`'` { b.write_string('&#39;') }
else { b.write_string(ch.str()) }
}
}
return b.str()
}