mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
encoding.html: add escape() function (#16666)
This commit is contained in:
@@ -10,6 +10,7 @@ import net.http
|
||||
import net.urllib
|
||||
import time
|
||||
import json
|
||||
import encoding.html
|
||||
|
||||
// A type which don't get filtered inside templates
|
||||
pub type RawHtml = string
|
||||
@@ -725,12 +726,5 @@ fn send_string(mut conn net.TcpConn, s string) ! {
|
||||
// It used by `vlib/v/gen/c/str_intp.v:130` for string interpolation inside vweb templates
|
||||
// TODO: move it to template render
|
||||
fn filter(s string) string {
|
||||
return s.replace_each([
|
||||
'<',
|
||||
'<',
|
||||
'"',
|
||||
'"',
|
||||
'&',
|
||||
'&',
|
||||
])
|
||||
return html.escape(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user