version 1.2, 2008/12/03 19:21:58 |
version 1.3, 2008/12/03 21:27:56 |
Line 41 static ssize_t html_blocktagname(struct md_mbuf *, |
|
Line 41 static ssize_t html_blocktagname(struct md_mbuf *, |
|
static ssize_t html_blocktagargs(struct md_mbuf *, |
static ssize_t html_blocktagargs(struct md_mbuf *, |
const struct md_args *, int, |
const struct md_args *, int, |
const int *, const char **); |
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 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 struct md_args *, int, |
|
const int *, const char **); |
static ssize_t html_inlinetagname(struct md_mbuf *, |
static ssize_t html_inlinetagname(struct md_mbuf *, |
const struct md_args *, int); |
const struct md_args *, int); |
static ssize_t html_inlinetagargs(struct md_mbuf *, |
static ssize_t html_inlinetagargs(struct md_mbuf *, |
Line 48 static ssize_t html_inlinetagargs(struct md_mbuf *, |
|
Line 58 static ssize_t html_inlinetagargs(struct md_mbuf *, |
|
const int *, const char **); |
const int *, const char **); |
|
|
|
|
|
/* ARGSUSED */ |
static int |
static int |
html_begin(struct md_mbuf *mbuf, const struct md_args *args) |
html_begin(struct md_mbuf *mbuf, const struct md_args *args) |
{ |
{ |
Line 80 html_begin(struct md_mbuf *mbuf, const struct md_args |
|
Line 91 html_begin(struct md_mbuf *mbuf, const struct md_args |
|
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
static int |
static int |
html_end(struct md_mbuf *mbuf, const struct md_args *args) |
html_end(struct md_mbuf *mbuf, const struct md_args *args) |
{ |
{ |
Line 93 html_end(struct md_mbuf *mbuf, const struct md_args *a |
|
Line 105 html_end(struct md_mbuf *mbuf, const struct md_args *a |
|
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
static ssize_t |
static ssize_t |
html_blocktagname(struct md_mbuf *mbuf, |
html_blockbodytagname(struct md_mbuf *mbuf, |
const struct md_args *args, int tok) |
const struct md_args *args, int tok) |
{ |
{ |
size_t res; |
size_t res; |
Line 106 html_blocktagname(struct md_mbuf *mbuf, |
|
Line 119 html_blocktagname(struct md_mbuf *mbuf, |
|
if ( ! ml_puts(mbuf, "blockquote", &res)) |
if ( ! ml_puts(mbuf, "blockquote", &res)) |
return(-1); |
return(-1); |
break; |
break; |
|
default: |
|
if ( ! ml_puts(mbuf, "div", &res)) |
|
return(-1); |
|
break; |
|
} |
|
|
|
return((ssize_t)res); |
|
} |
|
|
|
|
|
|
|
|
|
/* ARGSUSED */ |
|
static ssize_t |
|
html_blockheadtagname(struct md_mbuf *mbuf, |
|
const struct md_args *args, int tok) |
|
{ |
|
size_t res; |
|
|
|
res = 0; |
|
|
|
switch (tok) { |
|
case (ROFF_Sh): |
|
if ( ! ml_puts(mbuf, "h1", &res)) |
|
return(-1); |
|
break; |
|
case (ROFF_Ss): |
|
if ( ! ml_puts(mbuf, "h2", &res)) |
|
return(-1); |
|
break; |
|
default: |
|
if ( ! ml_puts(mbuf, "div", &res)) |
|
return(-1); |
|
break; |
|
} |
|
|
|
return((ssize_t)res); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static ssize_t |
|
html_blocktagname(struct md_mbuf *mbuf, |
|
const struct md_args *args, int tok) |
|
{ |
|
size_t res; |
|
|
|
res = 0; |
|
|
|
switch (tok) { |
case (ROFF_Bd): |
case (ROFF_Bd): |
if ( ! ml_puts(mbuf, "pre", &res)) |
if ( ! ml_puts(mbuf, "pre", &res)) |
return(-1); |
return(-1); |
Line 124 html_blocktagname(struct md_mbuf *mbuf, |
|
Line 187 html_blocktagname(struct md_mbuf *mbuf, |
|
break; |
break; |
} |
} |
|
|
return((size_t)res); |
return((ssize_t)res); |
} |
} |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static ssize_t |
static ssize_t |
html_blocktagargs(struct md_mbuf *mbuf, const struct md_args *args, |
html_blockheadtagargs(struct md_mbuf *mbuf, const struct md_args *args, |
int tok, const int *argc, const char **argv) |
int tok, const int *argc, const char **argv) |
{ |
{ |
|
size_t res; |
|
|
|
res = 0; |
|
|
|
if ( ! ml_puts(mbuf, " class=\"head:", &res)) |
|
return(0); |
|
if ( ! ml_puts(mbuf, toknames[tok], &res)) |
|
return(0); |
|
if ( ! ml_puts(mbuf, "\"", &res)) |
|
return(0); |
|
|
switch (tok) { |
switch (tok) { |
default: |
default: |
|
break; |
|
} |
|
|
|
return(0); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static ssize_t |
|
html_blockbodytagargs(struct md_mbuf *mbuf, const struct md_args *args, |
|
int tok, const int *argc, const char **argv) |
|
{ |
|
size_t res; |
|
|
|
res = 0; |
|
|
|
if ( ! ml_puts(mbuf, " class=\"body:", &res)) |
return(0); |
return(0); |
|
if ( ! ml_puts(mbuf, toknames[tok], &res)) |
|
return(0); |
|
if ( ! ml_puts(mbuf, "\"", &res)) |
|
return(0); |
|
|
|
switch (tok) { |
|
default: |
|
break; |
} |
} |
|
|
return(-1); |
return(res); |
} |
} |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static ssize_t |
static ssize_t |
html_inlinetagargs(struct md_mbuf *mbuf, const struct md_args *args, |
html_blocktagargs(struct md_mbuf *mbuf, const struct md_args *args, |
int tok, const int *argc, const char **argv) |
int tok, const int *argc, const char **argv) |
{ |
{ |
|
size_t res; |
|
|
|
res = 0; |
|
|
|
if ( ! ml_puts(mbuf, " class=\"block:", &res)) |
|
return(0); |
|
if ( ! ml_puts(mbuf, toknames[tok], &res)) |
|
return(0); |
|
if ( ! ml_puts(mbuf, "\"", &res)) |
|
return(0); |
|
|
switch (tok) { |
switch (tok) { |
default: |
default: |
|
break; |
|
} |
|
|
|
return(0); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static ssize_t |
|
html_inlinetagargs(struct md_mbuf *mbuf, const struct md_args *args, |
|
int tok, const int *argc, const char **argv) |
|
{ |
|
size_t res; |
|
|
|
res = 0; |
|
|
|
if ( ! ml_puts(mbuf, " class=\"inline:", &res)) |
return(0); |
return(0); |
|
if ( ! ml_puts(mbuf, toknames[tok], &res)) |
|
return(0); |
|
if ( ! ml_puts(mbuf, "\"", &res)) |
|
return(0); |
|
|
|
|
|
switch (tok) { |
|
default: |
|
break; |
} |
} |
|
|
return(-1); |
return(0); |
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
static ssize_t |
static ssize_t |
html_inlinetagname(struct md_mbuf *mbuf, |
html_inlinetagname(struct md_mbuf *mbuf, |
const struct md_args *args, int tok) |
const struct md_args *args, int tok) |
Line 167 html_inlinetagname(struct md_mbuf *mbuf, |
|
Line 302 html_inlinetagname(struct md_mbuf *mbuf, |
|
res = 0; |
res = 0; |
|
|
switch (tok) { |
switch (tok) { |
case (ROFF_Sh): |
|
if ( ! ml_puts(mbuf, "h1", &res)) |
|
return(-1); |
|
break; |
|
case (ROFF_Ss): |
|
if ( ! ml_puts(mbuf, "h2", &res)) |
|
return(-1); |
|
break; |
|
default: |
default: |
if ( ! ml_puts(mbuf, "span", &res)) |
if ( ! ml_puts(mbuf, "span", &res)) |
return(-1); |
return(-1); |
Line 192 html_begintag(struct md_mbuf *mbuf, const struct md_ar |
|
Line 319 html_begintag(struct md_mbuf *mbuf, const struct md_ar |
|
{ |
{ |
|
|
assert(ns != MD_NS_DEFAULT); |
assert(ns != MD_NS_DEFAULT); |
if (MD_NS_BLOCK == ns) { |
switch (ns) { |
|
case (MD_NS_BLOCK): |
if ( ! html_blocktagname(mbuf, args, tok)) |
if ( ! html_blocktagname(mbuf, args, tok)) |
return(0); |
return(0); |
return(html_blocktagargs(mbuf, args, |
return(html_blocktagargs(mbuf, args, |
tok, argc, argv)); |
tok, argc, argv)); |
|
case (MD_NS_BODY): |
|
if ( ! html_blockbodytagname(mbuf, args, tok)) |
|
return(0); |
|
return(html_blockbodytagargs(mbuf, args, |
|
tok, argc, argv)); |
|
case (MD_NS_HEAD): |
|
if ( ! html_blockheadtagname(mbuf, args, tok)) |
|
return(0); |
|
return(html_blockheadtagargs(mbuf, args, |
|
tok, argc, argv)); |
|
default: |
|
break; |
} |
} |
|
|
if ( ! html_inlinetagname(mbuf, args, tok)) |
if ( ! html_inlinetagname(mbuf, args, tok)) |
Line 211 html_endtag(struct md_mbuf *mbuf, const struct md_args |
|
Line 351 html_endtag(struct md_mbuf *mbuf, const struct md_args |
|
{ |
{ |
|
|
assert(ns != MD_NS_DEFAULT); |
assert(ns != MD_NS_DEFAULT); |
if (MD_NS_BLOCK == ns) |
switch (ns) { |
|
case (MD_NS_BLOCK): |
return(html_blocktagname(mbuf, args, tok)); |
return(html_blocktagname(mbuf, args, tok)); |
|
case (MD_NS_BODY): |
|
return(html_blockbodytagname(mbuf, args, tok)); |
|
case (MD_NS_HEAD): |
|
return(html_blockheadtagname(mbuf, args, tok)); |
|
default: |
|
break; |
|
} |
|
|
return(html_inlinetagname(mbuf, args, tok)); |
return(html_inlinetagname(mbuf, args, tok)); |
} |
} |