X-Git-Url: https://git.cameronkatri.com/cgit.git/blobdiff_plain/d532c4d1612c94347427fa1afda6afb7c34e512a..6d2067aed3a68c692555e97a20f2998afeefab69:/html.c diff --git a/html.c b/html.c index 36e9a2f..66ba65d 100644 --- a/html.c +++ b/html.c @@ -112,14 +112,48 @@ void html_attr(char *txt) char *t = txt; while(t && *t){ int c = *t; - if (c=='<' || c=='>' || c=='\'') { + if (c=='<' || c=='>' || c=='\'' || c=='\"') { write(htmlfd, txt, t - txt); if (c=='>') html(">"); else if (c=='<') html("<"); else if (c=='\'') - html(""e;"); + html("'"); + else if (c=='"') + html("""); + txt = t+1; + } + t++; + } + if (t!=txt) + html(txt); +} + +void html_url_path(char *txt) +{ + char *t = txt; + while(t && *t){ + int c = *t; + if (c=='"' || c=='#' || c=='\'' || c=='?') { + write(htmlfd, txt, t - txt); + write(htmlfd, fmt("%%%2x", c), 3); + txt = t+1; + } + t++; + } + if (t!=txt) + html(txt); +} + +void html_url_arg(char *txt) +{ + char *t = txt; + while(t && *t){ + int c = *t; + if (c=='"' || c=='#' || c=='%' || c=='&' || c=='\'' || c=='+' || c=='?') { + write(htmlfd, txt, t - txt); + write(htmlfd, fmt("%%%2x", c), 3); txt = t+1; } t++;