version 1.3, 2008/11/22 20:15:34 |
version 1.4, 2008/11/23 11:05:25 |
Line 73 static int md_run_leave(const struct md_args *, |
|
Line 73 static int md_run_leave(const struct md_args *, |
|
static ssize_t md_buf_fill(struct md_rbuf *); |
static ssize_t md_buf_fill(struct md_rbuf *); |
static int md_buf_flush(struct md_mbuf *); |
static int md_buf_flush(struct md_mbuf *); |
static int md_buf_putchar(struct md_mbuf *, char); |
static int md_buf_putchar(struct md_mbuf *, char); |
|
static int md_buf_putstring(struct md_mbuf *, |
|
const char *); |
static int md_buf_puts(struct md_mbuf *, |
static int md_buf_puts(struct md_mbuf *, |
const char *, size_t); |
const char *, size_t); |
|
|
Line 129 md_buf_putchar(struct md_mbuf *buf, char c) |
|
Line 131 md_buf_putchar(struct md_mbuf *buf, char c) |
|
|
|
|
|
static int |
static int |
|
md_buf_putstring(struct md_mbuf *buf, const char *p) |
|
{ |
|
return(md_buf_puts(buf, p, strlen(p))); |
|
} |
|
|
|
|
|
static int |
md_buf_puts(struct md_mbuf *buf, const char *p, size_t sz) |
md_buf_puts(struct md_mbuf *buf, const char *p, size_t sz) |
{ |
{ |
size_t ssz; |
size_t ssz; |
Line 299 md_line_dummy(const struct md_args *args, struct md_mb |
|
Line 308 md_line_dummy(const struct md_args *args, struct md_mb |
|
|
|
|
|
static int |
static int |
md_exit_html4_strict(const struct md_args *args, struct md_mbuf *p) |
md_exit_html4_strict(const struct md_args *args, struct md_mbuf *out) |
{ |
{ |
|
char *tail; |
|
|
assert(p); |
assert(out); |
assert(args); |
assert(args); |
|
|
|
tail = " </pre>\n" |
|
" </body>\n" |
|
"</html>\n"; |
|
|
|
if ( ! md_buf_putstring(out, tail)) |
|
return(0); |
|
|
return(1); |
return(1); |
} |
} |
|
|
|
|
static int |
static int |
md_init_html4_strict(const struct md_args *args, struct md_mbuf *p) |
md_init_html4_strict(const struct md_args *args, struct md_mbuf *out) |
{ |
{ |
|
char *head; |
|
|
assert(p); |
assert(out); |
assert(args); |
assert(args); |
|
|
|
head = "<html>\n" |
|
" <head>\n" |
|
" <title>Manual Page</title>\n" |
|
" </head>\n" |
|
" <body>\n" |
|
" <pre>\n"; |
|
|
|
if ( ! md_buf_putstring(out, head)) |
|
return(0); |
|
|
return(1); |
return(1); |
} |
} |
|
|
|
|
|
struct md_roff_macro { |
|
char name[2]; |
|
int flags; |
|
#define MD_PARSED (1 << 0) |
|
#define MD_CALLABLE (1 << 1) |
|
#define MD_TITLE (1 << 2) |
|
}; |
|
|
|
struct md_roff_macro[] = { |
|
{ "Dd", MD_TITLE }, |
|
{ "Dt", MD_TITLE }, |
|
{ "Os", MD_TITLE }, |
|
{ "Sh", MD_PARSED }, |
|
}; |
|
|
|
|
static int |
static int |
|
md_roff(struct md_mbuf *out, const struct md_rbuf *in, |
|
const char *buf, size_t sz) |
|
{ |
|
|
|
assert(out); |
|
assert(in); |
|
assert(buf); |
|
assert(sz >= 1); |
|
} |
|
|
|
|
|
static int |
md_line_html4_strict(const struct md_args *args, struct md_mbuf *out, |
md_line_html4_strict(const struct md_args *args, struct md_mbuf *out, |
const struct md_rbuf *in, const char *buf, size_t sz) |
const struct md_rbuf *in, const char *buf, size_t sz) |
{ |
{ |
|
|
assert(args); |
assert(args); |
assert(buf); |
|
assert(out); |
|
assert(in); |
assert(in); |
(void)sz; |
|
|
|
return(1); |
if (0 == sz) { |
|
warnx("%s: blank line (line %zu)", in->name, in->line); |
|
return(0); |
|
} |
|
|
|
if ('.' == *buf) { |
|
return(1); |
|
} |
|
|
|
return(md_buf_puts(out, buf, sz)); |
} |
} |