version 1.132, 2011/04/09 15:29:40 |
version 1.137, 2011/04/30 22:24:31 |
Line 122 ml_alloc(char *outopts, enum htmltype type) |
|
Line 122 ml_alloc(char *outopts, enum htmltype type) |
|
|
|
h->type = type; |
h->type = type; |
h->tags.head = NULL; |
h->tags.head = NULL; |
h->symtab = chars_init(CHARS_HTML); |
h->symtab = mchars_alloc(); |
|
|
while (outopts && *outopts) |
while (outopts && *outopts) |
switch (getsubopt(&outopts, UNCONST(toks), &v)) { |
switch (getsubopt(&outopts, UNCONST(toks), &v)) { |
Line 172 html_free(void *p) |
|
Line 172 html_free(void *p) |
|
} |
} |
|
|
if (h->symtab) |
if (h->symtab) |
chars_free(h->symtab); |
mchars_free(h->symtab); |
|
|
free(h); |
free(h); |
} |
} |
Line 212 print_gen_head(struct html *h) |
|
Line 212 print_gen_head(struct html *h) |
|
static void |
static void |
print_num(struct html *h, const char *p, size_t len) |
print_num(struct html *h, const char *p, size_t len) |
{ |
{ |
const char *rhs; |
char c; |
|
|
rhs = chars_num2char(p, len); |
if ('\0' != (c = mchars_num2char(p, len))) |
if (rhs) |
putchar((int)c); |
putchar((int)*rhs); |
|
} |
} |
|
|
static void |
static void |
Line 226 print_spec(struct html *h, const char *p, size_t len) |
|
Line 225 print_spec(struct html *h, const char *p, size_t len) |
|
const char *rhs; |
const char *rhs; |
size_t sz; |
size_t sz; |
|
|
if ((cp = chars_spec2cp(h->symtab, p, len)) > 0) { |
if ((cp = mchars_spec2cp(h->symtab, p, len)) > 0) { |
printf("&#%d;", cp); |
printf("&#%d;", cp); |
return; |
return; |
} else if (-1 == cp && 1 == len) { |
} else if (-1 == cp && 1 == len) { |
Line 235 print_spec(struct html *h, const char *p, size_t len) |
|
Line 234 print_spec(struct html *h, const char *p, size_t len) |
|
} else if (-1 == cp) |
} else if (-1 == cp) |
return; |
return; |
|
|
if (NULL != (rhs = chars_spec2str(h->symtab, p, len, &sz))) |
if (NULL != (rhs = mchars_spec2str(h->symtab, p, len, &sz))) |
fwrite(rhs, 1, sz, stdout); |
fwrite(rhs, 1, sz, stdout); |
} |
} |
|
|
Line 247 print_res(struct html *h, const char *p, size_t len) |
|
Line 246 print_res(struct html *h, const char *p, size_t len) |
|
const char *rhs; |
const char *rhs; |
size_t sz; |
size_t sz; |
|
|
if ((cp = chars_res2cp(h->symtab, p, len)) > 0) { |
if ((cp = mchars_res2cp(h->symtab, p, len)) > 0) { |
printf("&#%d;", cp); |
printf("&#%d;", cp); |
return; |
return; |
} else if (-1 == cp) |
} else if (-1 == cp) |
return; |
return; |
|
|
if (NULL != (rhs = chars_res2str(h->symtab, p, len, &sz))) |
if (NULL != (rhs = mchars_res2str(h->symtab, p, len, &sz))) |
fwrite(rhs, 1, sz, stdout); |
fwrite(rhs, 1, sz, stdout); |
} |
} |
|
|
Line 427 print_otag(struct html *h, enum htmltag tag, |
|
Line 426 print_otag(struct html *h, enum htmltag tag, |
|
print_attr(h, "lang", "en"); |
print_attr(h, "lang", "en"); |
} |
} |
|
|
/* Accomodate for XML "well-formed" singleton escaping. */ |
/* Accommodate for XML "well-formed" singleton escaping. */ |
|
|
if (HTML_AUTOCLOSE & htmltags[tag].flags) |
if (HTML_AUTOCLOSE & htmltags[tag].flags) |
switch (h->type) { |
switch (h->type) { |