Lines Matching refs:h

139 	struct html	*h;  in html_alloc()  local
141 h = mandoc_calloc(1, sizeof(struct html)); in html_alloc()
143 h->tag = NULL; in html_alloc()
144 h->metac = h->metal = ESCAPE_FONTROMAN; in html_alloc()
145 h->style = outopts->style; in html_alloc()
146 if ((h->base_man1 = outopts->man) == NULL) in html_alloc()
147 h->base_man2 = NULL; in html_alloc()
148 else if ((h->base_man2 = strchr(h->base_man1, ';')) != NULL) in html_alloc()
149 *h->base_man2++ = '\0'; in html_alloc()
150 h->base_includes = outopts->includes; in html_alloc()
152 h->oflags |= HTML_FRAGMENT; in html_alloc()
154 h->oflags |= HTML_TOC; in html_alloc()
158 return h; in html_alloc()
162 html_reset_internal(struct html *h) in html_reset_internal() argument
168 while ((tag = h->tag) != NULL) { in html_reset_internal()
169 h->tag = tag->next; in html_reset_internal()
195 print_gen_head(struct html *h) in print_gen_head() argument
199 print_otag(h, TAG_META, "?", "charset", "utf-8"); in print_gen_head()
200 print_otag(h, TAG_META, "??", "name", "viewport", in print_gen_head()
202 if (h->style != NULL) { in print_gen_head()
203 print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet", in print_gen_head()
204 h->style, "type", "text/css", "media", "all"); in print_gen_head()
212 t = print_otag(h, TAG_STYLE, ""); in print_gen_head()
213 print_text(h, "table.head, table.foot { width: 100%; }"); in print_gen_head()
214 print_endline(h); in print_gen_head()
215 print_text(h, "td.head-rtitle, td.foot-os { text-align: right; }"); in print_gen_head()
216 print_endline(h); in print_gen_head()
217 print_text(h, "td.head-vol { text-align: center; }"); in print_gen_head()
218 print_endline(h); in print_gen_head()
219 print_text(h, ".Nd, .Bf, .Op { display: inline; }"); in print_gen_head()
220 print_endline(h); in print_gen_head()
221 print_text(h, ".Pa, .Ad { font-style: italic; }"); in print_gen_head()
222 print_endline(h); in print_gen_head()
223 print_text(h, ".Ms { font-weight: bold; }"); in print_gen_head()
224 print_endline(h); in print_gen_head()
225 print_text(h, ".Bl-diag "); in print_gen_head()
226 print_byte(h, '>'); in print_gen_head()
227 print_text(h, " dt { font-weight: bold; }"); in print_gen_head()
228 print_endline(h); in print_gen_head()
229 print_text(h, "code.Nm, .Fl, .Cm, .Ic, code.In, .Fd, .Fn, .Cd " in print_gen_head()
231 print_tagq(h, t); in print_gen_head()
235 html_setfont(struct html *h, enum mandoc_esc font) in html_setfont() argument
239 font = h->metal; in html_setfont()
255 h->metal = h->metac; in html_setfont()
256 h->metac = font; in html_setfont()
261 print_metaf(struct html *h) in print_metaf() argument
263 if (h->metaf) { in print_metaf()
264 print_tagq(h, h->metaf); in print_metaf()
265 h->metaf = NULL; in print_metaf()
267 switch (h->metac) { in print_metaf()
269 h->metaf = print_otag(h, TAG_I, ""); in print_metaf()
272 h->metaf = print_otag(h, TAG_B, ""); in print_metaf()
275 h->metaf = print_otag(h, TAG_B, ""); in print_metaf()
276 print_otag(h, TAG_I, ""); in print_metaf()
279 h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); in print_metaf()
282 h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); in print_metaf()
283 print_otag(h, TAG_B, ""); in print_metaf()
286 h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); in print_metaf()
287 print_otag(h, TAG_I, ""); in print_metaf()
295 html_close_paragraph(struct html *h) in html_close_paragraph() argument
300 this = h->tag; in html_close_paragraph()
305 print_ctag(h, this); in html_close_paragraph()
317 html_fillmode(struct html *h, enum roff_tok want) in html_fillmode() argument
322 for (t = h->tag; t != NULL; t = t->next) in html_fillmode()
331 print_tagq(h, t); in html_fillmode()
334 html_close_paragraph(h); in html_fillmode()
335 print_otag(h, TAG_PRE, ""); in html_fillmode()
432 print_escape(struct html *h, char c) in print_escape() argument
437 print_word(h, "<"); in print_escape()
440 print_word(h, ">"); in print_escape()
443 print_word(h, "&"); in print_escape()
446 print_word(h, """); in print_escape()
449 print_word(h, " "); in print_escape()
452 print_byte(h, '-'); in print_escape()
463 print_encode(struct html *h, const char *p, const char *pend, int norecurse) in print_encode() argument
480 if (HTML_SKIPCHAR & h->flags && '\\' != *p) { in print_encode()
481 h->flags &= ~HTML_SKIPCHAR; in print_encode()
487 print_byte(h, *p); in print_encode()
491 print_otag(h, TAG_BR, ""); in print_encode()
502 print_endword(h); in print_encode()
507 if (print_escape(h, *p++)) in print_encode()
522 h->flags |= HTML_NOSPACE; in print_encode()
523 if (html_setfont(h, esc)) in print_encode()
524 print_metaf(h); in print_encode()
525 h->flags &= ~HTML_NOSPACE; in print_encode()
529 h->flags |= HTML_SKIPCHAR; in print_encode()
537 if (h->flags & HTML_SKIPCHAR) { in print_encode()
538 h->flags &= ~HTML_SKIPCHAR; in print_encode()
561 print_word(h, "html"); in print_encode()
583 print_word(h, numbuf); in print_encode()
584 } else if (print_escape(h, c) == 0) in print_encode()
585 print_byte(h, c); in print_encode()
592 print_href(struct html *h, const char *name, const char *sec, int man) in print_href() argument
599 pp = h->base_man1; in print_href()
600 if (h->base_man2 != NULL) { in print_href()
603 pp = h->base_man2; in print_href()
607 pp = h->base_includes; in print_href()
610 print_encode(h, pp, p, 1); in print_href()
613 print_byte(h, '1'); in print_href()
615 print_encode(h, sec, NULL, 1); in print_href()
618 print_encode(h, name, NULL, 1); in print_href()
620 print_encode(h, p, p + 2, 1); in print_href()
624 print_encode(h, pp, NULL, 1); in print_href()
628 print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) in print_otag() argument
641 for (t = h->tag; t != NULL; t = t->next) { in print_otag()
654 } else if (tflags & HTML_TOPHRASE && h->tag->tag == TAG_SECTION) in print_otag()
655 print_otag(h, TAG_P, "c", "Pp"); in print_otag()
662 t->next = h->tag; in print_otag()
665 h->tag = t; in print_otag()
670 print_endline(h); in print_otag()
671 if (h->col == 0) in print_otag()
672 print_indent(h); in print_otag()
673 else if ((h->flags & HTML_NOSPACE) == 0) { in print_otag()
674 if (h->flags & HTML_KEEP) in print_otag()
675 print_word(h, " "); in print_otag()
677 if (h->flags & HTML_PREKEEP) in print_otag()
678 h->flags |= HTML_KEEP; in print_otag()
679 print_endword(h); in print_otag()
683 if ( ! (h->flags & HTML_NONOSPACE)) in print_otag()
684 h->flags &= ~HTML_NOSPACE; in print_otag()
686 h->flags |= HTML_NOSPACE; in print_otag()
690 print_byte(h, '<'); in print_otag()
691 print_word(h, htmltags[tag].name); in print_otag()
725 print_byte(h, ' '); in print_otag()
726 print_word(h, attr); in print_otag()
727 print_byte(h, '='); in print_otag()
728 print_byte(h, '"'); in print_otag()
731 print_href(h, arg1, NULL, 0); in print_otag()
735 print_href(h, arg1, arg2, 1); in print_otag()
739 print_byte(h, '#'); in print_otag()
740 print_encode(h, arg1, NULL, 1); in print_otag()
744 print_encode(h, arg1, NULL, 1); in print_otag()
747 print_byte(h, '"'); in print_otag()
756 print_byte(h, ' '); in print_otag()
758 print_word(h, "style=\""); in print_otag()
761 print_word(h, arg1); in print_otag()
762 print_byte(h, ':'); in print_otag()
763 print_byte(h, ' '); in print_otag()
764 print_word(h, arg2); in print_otag()
765 print_byte(h, ';'); in print_otag()
768 print_byte(h, '"'); in print_otag()
775 print_byte(h, '/'); in print_otag()
777 print_byte(h, '>'); in print_otag()
780 print_endline(h); in print_otag()
782 h->flags |= HTML_NOSPACE; in print_otag()
785 h->indent++; in print_otag()
787 h->noindent++; in print_otag()
799 print_otag_id(struct html *h, enum htmltag elemtype, const char *cattr, in print_otag_id() argument
813 ret = print_otag(h, TAG_A, "chR", "permalink", href); in print_otag_id()
814 t = print_otag(h, elemtype, "ci", cattr, id); in print_otag_id()
826 print_otag(h, TAG_A, "chR", "permalink", href); in print_otag_id()
836 print_ctag(struct html *h, struct tag *tag) in print_ctag() argument
842 if (tag == h->metaf) in print_ctag()
843 h->metaf = NULL; in print_ctag()
844 if (tag == h->tblt) in print_ctag()
845 h->tblt = NULL; in print_ctag()
849 h->indent--; in print_ctag()
851 h->noindent--; in print_ctag()
853 print_endline(h); in print_ctag()
854 print_indent(h); in print_ctag()
855 print_byte(h, '<'); in print_ctag()
856 print_byte(h, '/'); in print_ctag()
857 print_word(h, htmltags[tag->tag].name); in print_ctag()
858 print_byte(h, '>'); in print_ctag()
860 print_endline(h); in print_ctag()
863 h->tag = tag->next; in print_ctag()
869 print_gen_decls(struct html *h) in print_gen_decls() argument
871 print_word(h, "<!DOCTYPE html>"); in print_gen_decls()
872 print_endline(h); in print_gen_decls()
876 print_gen_comment(struct html *h, struct roff_node *n) in print_gen_comment() argument
880 print_word(h, "<!-- This is an automatically generated file." in print_gen_comment()
882 h->indent = 1; in print_gen_comment()
887 print_endline(h); in print_gen_comment()
888 print_indent(h); in print_gen_comment()
889 print_word(h, n->string); in print_gen_comment()
895 print_endline(h); in print_gen_comment()
896 print_word(h, " -->"); in print_gen_comment()
897 print_endline(h); in print_gen_comment()
898 h->indent = 0; in print_gen_comment()
902 print_text(struct html *h, const char *word) in print_text() argument
904 print_tagged_text(h, word, NULL); in print_text()
908 print_tagged_text(struct html *h, const char *word, struct roff_node *n) in print_tagged_text() argument
918 if (h->tag->tag == TAG_SECTION) in print_tagged_text()
919 print_otag(h, TAG_P, "c", "Pp"); in print_tagged_text()
923 if (h->col && (h->flags & HTML_NOSPACE) == 0) { in print_tagged_text()
924 if ( ! (HTML_KEEP & h->flags)) { in print_tagged_text()
925 if (HTML_PREKEEP & h->flags) in print_tagged_text()
926 h->flags |= HTML_KEEP; in print_tagged_text()
927 print_endword(h); in print_tagged_text()
929 print_word(h, "&#x00A0;"); in print_tagged_text()
937 assert(h->metaf == NULL); in print_tagged_text()
938 print_metaf(h); in print_tagged_text()
939 print_indent(h); in print_tagged_text()
942 t = print_otag(h, TAG_A, "chR", "permalink", href); in print_tagged_text()
947 if ( ! print_encode(h, word, NULL, 0)) { in print_tagged_text()
948 if ( ! (h->flags & HTML_NONOSPACE)) in print_tagged_text()
949 h->flags &= ~HTML_NOSPACE; in print_tagged_text()
950 h->flags &= ~HTML_NONEWLINE; in print_tagged_text()
952 h->flags |= HTML_NOSPACE | HTML_NONEWLINE; in print_tagged_text()
954 if (h->metaf != NULL) { in print_tagged_text()
955 print_tagq(h, h->metaf); in print_tagged_text()
956 h->metaf = NULL; in print_tagged_text()
958 print_tagq(h, t); in print_tagged_text()
960 h->flags &= ~HTML_IGNDELIM; in print_tagged_text()
964 print_tagq(struct html *h, const struct tag *until) in print_tagq() argument
968 for (this = h->tag; this != NULL; this = next) { in print_tagq()
970 print_ctag(h, this); in print_tagq()
980 print_stagq(struct html *h, const struct tag *suntil) in print_stagq() argument
984 for (this = h->tag; this != NULL; this = next) { in print_stagq()
989 print_ctag(h, this); in print_stagq()
1005 print_byte(struct html *h, char c) in print_byte() argument
1007 if ((h->flags & HTML_BUFFER) == 0) { in print_byte()
1009 h->col++; in print_byte()
1013 if (h->col + h->bufcol < sizeof(h->buf)) { in print_byte()
1014 h->buf[h->bufcol++] = c; in print_byte()
1019 h->col = 0; in print_byte()
1020 print_indent(h); in print_byte()
1023 fwrite(h->buf, h->bufcol, 1, stdout); in print_byte()
1025 h->col = (h->indent + 1) * 2 + h->bufcol + 1; in print_byte()
1026 h->bufcol = 0; in print_byte()
1027 h->flags &= ~HTML_BUFFER; in print_byte()
1035 print_endline(struct html *h) in print_endline() argument
1037 if (h->col == 0) in print_endline()
1040 if (h->bufcol) { in print_endline()
1042 fwrite(h->buf, h->bufcol, 1, stdout); in print_endline()
1043 h->bufcol = 0; in print_endline()
1046 h->col = 0; in print_endline()
1047 h->flags |= HTML_NOSPACE; in print_endline()
1048 h->flags &= ~HTML_BUFFER; in print_endline()
1056 print_endword(struct html *h) in print_endword() argument
1058 if (h->noindent) { in print_endword()
1059 print_byte(h, ' '); in print_endword()
1063 if ((h->flags & HTML_BUFFER) == 0) { in print_endword()
1064 h->col++; in print_endword()
1065 h->flags |= HTML_BUFFER; in print_endword()
1066 } else if (h->bufcol) { in print_endword()
1068 fwrite(h->buf, h->bufcol, 1, stdout); in print_endword()
1069 h->col += h->bufcol + 1; in print_endword()
1071 h->bufcol = 0; in print_endword()
1081 print_indent(struct html *h) in print_indent() argument
1085 if (h->col || h->noindent) in print_indent()
1088 h->col = h->indent * 2; in print_indent()
1089 for (i = 0; i < h->col; i++) in print_indent()
1098 print_word(struct html *h, const char *cp) in print_word() argument
1101 print_byte(h, *cp++); in print_word()