![]() |
![]()
| ![]() |
![]()
NAME
LIBRARYlibrary “libkcgihtml” SYNOPSIS
DESCRIPTIONProduce output of XML-formed HTML5 content in a kcgi(3) context allocated with khttp_parse(3). To compile and link, use pkg-config(1) as follows: % cc `pkg-config --cflags kcgi-html` -c sample.c % cc -o sample sample.o `pkg-config --libs kcgi-html` All of the EXAMPLESThe following outputs a simple HTML page. It assumes r is a struct kreq pointer. For completeness, this restricts all future writes to HTML. khttp_head(r, kresps[KRESP_STATUS], "%s", khttps[KHTTP_200]); khttp_head(r, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[KMIME_TEXT_HTML]); khttp_body(r); khtml_open(&req, r, 0); kcgi_writer_disable(r); khtml_elem(&req, KELEM_DOCTYPE); khtml_elem(&req, KELEM_HTML); khtml_elem(&req, KELEM_HEAD); khtml_elem(&req, KELEM_TITLE); khtml_puts(&req, "Hello, world"); khtml_closeelem(&req, 1); /* title */ khtml_attr(&req, KELEM_LINK, KATTR_REL, "stylesheet", KATTR_HREF, "/style.css", KATTR__MAX); khtml_closeelem(&req, 1); /* head */ khtml_elem(&req, KELEM_BODY); khtml_elem(&req, KELEM_P); khtml_puts(&req, "Hello, world"); khtml_entity(&req, KENTITY_mdash); khtml_printf(&req, "%s", "how are you?"); khtml_putc(&req, ' '); khtml_ncr(&req, 0x1F601); /* smiley */ khtml_close(&req); /* close all scopes */ The element name comment alongside
SEE ALSOkhtml_attr(3), khtml_close(3), khtml_closeelem(3), khtml_closeto(3), khtml_double(3), khtml_elem(3), khtml_elemat(3), khtml_entity(3), khtml_int(3), khtml_ncr(3), khtml_open(3), khtml_printf(3), khtml_putc(3), khtml_puts(3), khtml_write(3) STANDARDSThe referenced HTML5 standard is HTML5.2. AUTHORSWritten by Kristaps Dzonsons <kristaps@bsd.lv>.
|