=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.4 retrieving revision 1.8 diff -u -p -r1.4 -r1.8 --- mandoc/html.c 2008/12/04 11:25:29 1.4 +++ mandoc/html.c 2008/12/05 17:43:14 1.8 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.4 2008/12/04 11:25:29 kristaps Exp $ */ +/* $Id: html.c,v 1.8 2008/12/05 17:43:14 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -32,12 +32,32 @@ #include "ml.h" +/* TODO: allow head/tail-less invocations (just "div" start). */ +/* FIXME: free htmlq. */ + +struct htmlnode { + int tok; + enum md_ns ns; + int *argc[ROFF_MAXLINEARG]; + char *argv[ROFF_MAXLINEARG]; + struct htmlnode *parent; +}; + + +struct htmlq { + struct htmlnode *last; +}; + + +static void htmlnode_free(struct htmlnode *); +static void htmlnode_free(struct htmlnode *); + static int html_loadcss(struct md_mbuf *, const char *); -static ssize_t html_endtag(struct md_mbuf *, +static ssize_t html_endtag(struct md_mbuf *, void *, const struct md_args *, enum md_ns, int); -static ssize_t html_begintag(struct md_mbuf *, +static ssize_t html_begintag(struct md_mbuf *, void *, const struct md_args *, enum md_ns, int, const int *, const char **); @@ -46,28 +66,31 @@ static int html_begin(struct md_mbuf *, const struct tm *, const char *, const char *, const char *, const char *); +static int html_printargs(struct md_mbuf *, int, + const char *, const int *, + const char **, size_t *); static int html_end(struct md_mbuf *, const struct md_args *); -static ssize_t html_blocktagname(struct md_mbuf *, - const struct md_args *, int); -static ssize_t html_blocktagargs(struct md_mbuf *, +static int html_blocktagname(struct md_mbuf *, + const struct md_args *, int, size_t *); +static int html_blocktagargs(struct md_mbuf *, const struct md_args *, int, - const int *, const char **); -static ssize_t html_blockheadtagname(struct md_mbuf *, - const struct md_args *, int); -static ssize_t html_blockheadtagargs(struct md_mbuf *, + const int *, const char **, size_t *); +static int html_blockheadtagname(struct md_mbuf *, + const struct md_args *, int, size_t *); +static int html_blockheadtagargs(struct md_mbuf *, const struct md_args *, int, - const int *, const char **); -static ssize_t html_blockbodytagname(struct md_mbuf *, - const struct md_args *, int); -static ssize_t html_blockbodytagargs(struct md_mbuf *, + const int *, const char **, size_t *); +static int html_blockbodytagname(struct md_mbuf *, + const struct md_args *, int, size_t *); +static int html_blockbodytagargs(struct md_mbuf *, const struct md_args *, int, - const int *, const char **); -static ssize_t html_inlinetagname(struct md_mbuf *, - const struct md_args *, int); -static ssize_t html_inlinetagargs(struct md_mbuf *, + const int *, const char **, size_t *); +static int html_inlinetagname(struct md_mbuf *, + const struct md_args *, int, size_t *); +static int html_inlinetagargs(struct md_mbuf *, const struct md_args *, int, - const int *, const char **); + const int *, const char **, size_t *); static int @@ -163,7 +186,7 @@ html_begin(struct md_mbuf *mbuf, const struct md_args assert(args->params.html.css); if (HTML_CSS_EMBED & args->params.html.flags) { - if ( ! ml_puts(mbuf, "