version 1.270, 2020/04/20 13:07:24 |
version 1.277, 2022/07/03 14:29:44 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> |
|
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
|
* Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org> |
|
* Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 67 static const struct htmldata htmltags[TAG_MAX] = { |
|
Line 68 static const struct htmldata htmltags[TAG_MAX] = { |
|
{"style", HTML_NLALL | HTML_INDENT}, |
{"style", HTML_NLALL | HTML_INDENT}, |
{"title", HTML_NLAROUND}, |
{"title", HTML_NLAROUND}, |
{"body", HTML_NLALL}, |
{"body", HTML_NLALL}, |
|
{"main", HTML_NLALL}, |
{"div", HTML_NLAROUND}, |
{"div", HTML_NLAROUND}, |
{"section", HTML_NLALL}, |
{"section", HTML_NLALL}, |
|
{"nav", HTML_NLALL}, |
{"table", HTML_NLALL | HTML_INDENT}, |
{"table", HTML_NLALL | HTML_INDENT}, |
{"tr", HTML_NLALL | HTML_INDENT}, |
{"tr", HTML_NLALL | HTML_INDENT}, |
{"td", HTML_NLAROUND}, |
{"td", HTML_NLAROUND}, |
Line 81 static const struct htmldata htmltags[TAG_MAX] = { |
|
Line 84 static const struct htmldata htmltags[TAG_MAX] = { |
|
{"h1", HTML_TOPHRASE | HTML_NLAROUND}, |
{"h1", HTML_TOPHRASE | HTML_NLAROUND}, |
{"h2", HTML_TOPHRASE | HTML_NLAROUND}, |
{"h2", HTML_TOPHRASE | HTML_NLAROUND}, |
{"p", HTML_TOPHRASE | HTML_NLAROUND | HTML_INDENT}, |
{"p", HTML_TOPHRASE | HTML_NLAROUND | HTML_INDENT}, |
{"pre", HTML_TOPHRASE | HTML_NLALL | HTML_NOINDENT}, |
{"pre", HTML_TOPHRASE | HTML_NLAROUND | HTML_NOINDENT}, |
{"a", HTML_INPHRASE | HTML_TOPHRASE}, |
{"a", HTML_INPHRASE | HTML_TOPHRASE}, |
{"b", HTML_INPHRASE | HTML_TOPHRASE}, |
{"b", HTML_INPHRASE | HTML_TOPHRASE}, |
{"cite", HTML_INPHRASE | HTML_TOPHRASE}, |
{"cite", HTML_INPHRASE | HTML_TOPHRASE}, |
Line 91 static const struct htmldata htmltags[TAG_MAX] = { |
|
Line 94 static const struct htmldata htmltags[TAG_MAX] = { |
|
{"span", HTML_INPHRASE | HTML_TOPHRASE}, |
{"span", HTML_INPHRASE | HTML_TOPHRASE}, |
{"var", HTML_INPHRASE | HTML_TOPHRASE}, |
{"var", HTML_INPHRASE | HTML_TOPHRASE}, |
{"br", HTML_INPHRASE | HTML_NOSTACK | HTML_NLALL}, |
{"br", HTML_INPHRASE | HTML_NOSTACK | HTML_NLALL}, |
|
{"hr", HTML_INPHRASE | HTML_NOSTACK}, |
{"mark", HTML_INPHRASE }, |
{"mark", HTML_INPHRASE }, |
{"math", HTML_INPHRASE | HTML_NLALL | HTML_INDENT}, |
{"math", HTML_INPHRASE | HTML_NLALL | HTML_INDENT}, |
{"mrow", 0}, |
{"mrow", 0}, |
Line 140 html_alloc(const struct manoutput *outopts) |
|
Line 144 html_alloc(const struct manoutput *outopts) |
|
h = mandoc_calloc(1, sizeof(struct html)); |
h = mandoc_calloc(1, sizeof(struct html)); |
|
|
h->tag = NULL; |
h->tag = NULL; |
|
h->metac = h->metal = ESCAPE_FONTROMAN; |
h->style = outopts->style; |
h->style = outopts->style; |
if ((h->base_man1 = outopts->man) == NULL) |
if ((h->base_man1 = outopts->man) == NULL) |
h->base_man2 = NULL; |
h->base_man2 = NULL; |
Line 195 print_gen_head(struct html *h) |
|
Line 200 print_gen_head(struct html *h) |
|
struct tag *t; |
struct tag *t; |
|
|
print_otag(h, TAG_META, "?", "charset", "utf-8"); |
print_otag(h, TAG_META, "?", "charset", "utf-8"); |
|
print_otag(h, TAG_META, "??", "name", "viewport", |
|
"content", "width=device-width, initial-scale=1.0"); |
if (h->style != NULL) { |
if (h->style != NULL) { |
print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet", |
print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet", |
h->style, "type", "text/css", "media", "all"); |
h->style, "type", "text/css", "media", "all"); |
Line 237 html_setfont(struct html *h, enum mandoc_esc font) |
|
Line 244 html_setfont(struct html *h, enum mandoc_esc font) |
|
case ESCAPE_FONTITALIC: |
case ESCAPE_FONTITALIC: |
case ESCAPE_FONTBOLD: |
case ESCAPE_FONTBOLD: |
case ESCAPE_FONTBI: |
case ESCAPE_FONTBI: |
case ESCAPE_FONTCW: |
|
case ESCAPE_FONTROMAN: |
case ESCAPE_FONTROMAN: |
|
case ESCAPE_FONTCR: |
|
case ESCAPE_FONTCB: |
|
case ESCAPE_FONTCI: |
break; |
break; |
case ESCAPE_FONT: |
case ESCAPE_FONT: |
font = ESCAPE_FONTROMAN; |
font = ESCAPE_FONTROMAN; |
Line 269 print_metaf(struct html *h) |
|
Line 278 print_metaf(struct html *h) |
|
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 ESCAPE_FONTCW: |
case ESCAPE_FONTCR: |
h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); |
h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); |
break; |
break; |
|
case ESCAPE_FONTCB: |
|
h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); |
|
print_otag(h, TAG_B, ""); |
|
break; |
|
case ESCAPE_FONTCI: |
|
h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); |
|
print_otag(h, TAG_I, ""); |
|
break; |
default: |
default: |
break; |
break; |
} |
} |
Line 500 print_encode(struct html *h, const char *p, const char |
|
Line 517 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: |
|
case ESCAPE_FONTCR: |
|
case ESCAPE_FONTCB: |
|
case ESCAPE_FONTCI: |
if (0 == norecurse) { |
if (0 == norecurse) { |
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
if (html_setfont(h, esc)) |
if (html_setfont(h, esc)) |
Line 691 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 710 print_otag(struct html *h, enum htmltag tag, const cha |
|
break; |
break; |
case 'i': |
case 'i': |
attr = "id"; |
attr = "id"; |
|
break; |
|
case 'r': |
|
attr = "role"; |
break; |
break; |
case '?': |
case '?': |
attr = arg1; |
attr = arg1; |