version 1.239, 2018/08/16 13:54:06 |
version 1.243, 2018/11/23 19:17:05 |
|
|
#include "config.h" |
#include "config.h" |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/stat.h> |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
Line 128 html_alloc(const struct manoutput *outopts) |
|
Line 129 html_alloc(const struct manoutput *outopts) |
|
|
|
h->tag = NULL; |
h->tag = NULL; |
h->style = outopts->style; |
h->style = outopts->style; |
h->base_man = outopts->man; |
if ((h->base_man1 = outopts->man) == NULL) |
|
h->base_man2 = NULL; |
|
else if ((h->base_man2 = strchr(h->base_man1, ';')) != NULL) |
|
*h->base_man2++ = '\0'; |
h->base_includes = outopts->includes; |
h->base_includes = outopts->includes; |
if (outopts->fragment) |
if (outopts->fragment) |
h->oflags |= HTML_FRAGMENT; |
h->oflags |= HTML_FRAGMENT; |
|
if (outopts->toc) |
|
h->oflags |= HTML_TOC; |
|
|
mandoc_ohash_init(&id_unique, 4, 0); |
mandoc_ohash_init(&id_unique, 4, 0); |
|
|
Line 222 print_metaf(struct html *h, enum mandoc_esc deco) |
|
Line 228 print_metaf(struct html *h, enum mandoc_esc deco) |
|
case ESCAPE_FONTBI: |
case ESCAPE_FONTBI: |
font = HTMLFONT_BI; |
font = HTMLFONT_BI; |
break; |
break; |
|
case ESCAPE_FONTCW: |
|
font = HTMLFONT_CW; |
|
break; |
case ESCAPE_FONT: |
case ESCAPE_FONT: |
case ESCAPE_FONTROMAN: |
case ESCAPE_FONTROMAN: |
font = HTMLFONT_NONE; |
font = HTMLFONT_NONE; |
Line 249 print_metaf(struct html *h, enum mandoc_esc deco) |
|
Line 258 print_metaf(struct html *h, enum mandoc_esc deco) |
|
h->metaf = print_otag(h, TAG_B, ""); |
h->metaf = print_otag(h, TAG_B, ""); |
print_otag(h, TAG_I, ""); |
print_otag(h, TAG_I, ""); |
break; |
break; |
|
case HTMLFONT_CW: |
|
h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); |
|
break; |
default: |
default: |
break; |
break; |
} |
} |
Line 402 print_encode(struct html *h, const char *p, const char |
|
Line 414 print_encode(struct html *h, const char *p, const char |
|
case ESCAPE_FONTBOLD: |
case ESCAPE_FONTBOLD: |
case ESCAPE_FONTITALIC: |
case ESCAPE_FONTITALIC: |
case ESCAPE_FONTBI: |
case ESCAPE_FONTBI: |
|
case ESCAPE_FONTCW: |
case ESCAPE_FONTROMAN: |
case ESCAPE_FONTROMAN: |
if (0 == norecurse) |
if (0 == norecurse) { |
|
h->flags |= HTML_NOSPACE; |
print_metaf(h, esc); |
print_metaf(h, esc); |
|
h->flags &= ~HTML_NOSPACE; |
|
} |
continue; |
continue; |
case ESCAPE_SKIPCHAR: |
case ESCAPE_SKIPCHAR: |
h->flags |= HTML_SKIPCHAR; |
h->flags |= HTML_SKIPCHAR; |
Line 467 print_encode(struct html *h, const char *p, const char |
|
Line 483 print_encode(struct html *h, const char *p, const char |
|
static void |
static void |
print_href(struct html *h, const char *name, const char *sec, int man) |
print_href(struct html *h, const char *name, const char *sec, int man) |
{ |
{ |
|
struct stat sb; |
const char *p, *pp; |
const char *p, *pp; |
|
char *filename; |
|
|
pp = man ? h->base_man : h->base_includes; |
if (man) { |
|
pp = h->base_man1; |
|
if (h->base_man2 != NULL) { |
|
mandoc_asprintf(&filename, "%s.%s", name, sec); |
|
if (stat(filename, &sb) == -1) |
|
pp = h->base_man2; |
|
free(filename); |
|
} |
|
} else |
|
pp = h->base_includes; |
|
|
while ((p = strchr(pp, '%')) != NULL) { |
while ((p = strchr(pp, '%')) != NULL) { |
print_encode(h, pp, p, 1); |
print_encode(h, pp, p, 1); |
if (man && p[1] == 'S') { |
if (man && p[1] == 'S') { |
Line 719 print_text(struct html *h, const char *word) |
|
Line 747 print_text(struct html *h, const char *word) |
|
case HTMLFONT_BI: |
case HTMLFONT_BI: |
h->metaf = print_otag(h, TAG_B, ""); |
h->metaf = print_otag(h, TAG_B, ""); |
print_otag(h, TAG_I, ""); |
print_otag(h, TAG_I, ""); |
|
break; |
|
case HTMLFONT_CW: |
|
h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); |
break; |
break; |
default: |
default: |
print_indent(h); |
print_indent(h); |