X-Git-Url: https://git.cameronkatri.com/cgit.git/blobdiff_plain/067c1804353ad9ebca702a636d8d42a288459550..52fbcf2ffac0025128cc1d50681a7ccd859ef3f0:/html.c diff --git a/html.c b/html.c index 337baeb..eb1c25d 100644 --- a/html.c +++ b/html.c @@ -95,7 +95,7 @@ void html_txt(const char *txt) while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='&') { - write(htmlfd, txt, t - txt); + html_raw(txt, t - txt); if (c=='>') html(">"); else if (c=='<') @@ -116,7 +116,7 @@ void html_ntxt(int len, const char *txt) while(t && *t && len--){ int c = *t; if (c=='<' || c=='>' || c=='&') { - write(htmlfd, txt, t - txt); + html_raw(txt, t - txt); if (c=='>') html(">"); else if (c=='<') @@ -128,7 +128,7 @@ void html_ntxt(int len, const char *txt) t++; } if (t!=txt) - write(htmlfd, txt, t - txt); + html_raw(txt, t - txt); if (len<0) html("..."); } @@ -138,8 +138,8 @@ void html_attr(const char *txt) const char *t = txt; while(t && *t){ int c = *t; - if (c=='<' || c=='>' || c=='\'' || c=='\"') { - write(htmlfd, txt, t - txt); + if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') { + html_raw(txt, t - txt); if (c=='>') html(">"); else if (c=='<') @@ -148,6 +148,8 @@ void html_attr(const char *txt) html("'"); else if (c=='"') html("""); + else if (c=='&') + html("&"); txt = t+1; } t++; @@ -162,9 +164,9 @@ void html_url_path(const char *txt) while(t && *t){ int c = *t; const char *e = url_escape_table[c]; - if (e && c!='+' && c!='&' && c!='+') { - write(htmlfd, txt, t - txt); - write(htmlfd, e, 3); + if (e && c!='+' && c!='&') { + html_raw(txt, t - txt); + html(e); txt = t+1; } t++; @@ -179,9 +181,11 @@ void html_url_arg(const char *txt) while(t && *t){ int c = *t; const char *e = url_escape_table[c]; + if (c == ' ') + e = "+"; if (e) { - write(htmlfd, txt, t - txt); - write(htmlfd, e, 3); + html_raw(txt, t - txt); + html(e); txt = t+1; } t++; @@ -211,6 +215,14 @@ void html_option(const char *value, const char *text, const char *selected_value html("\n"); } +void html_intoption(int value, const char *text, int selected_value) +{ + htmlf(""); +} + void html_link_open(const char *url, const char *title, const char *class) { html("