Lines Matching refs:h
142 struct html *h; in html_alloc() local
144 h = mandoc_calloc(1, sizeof(struct html)); in html_alloc()
146 h->tag = NULL; in html_alloc()
147 h->metac = h->metal = ESCAPE_FONTROMAN; in html_alloc()
148 h->style = outopts->style; in html_alloc()
149 if ((h->base_man1 = outopts->man) == NULL) in html_alloc()
150 h->base_man2 = NULL; in html_alloc()
151 else if ((h->base_man2 = strchr(h->base_man1, ';')) != NULL) in html_alloc()
152 *h->base_man2++ = '\0'; in html_alloc()
153 h->base_includes = outopts->includes; in html_alloc()
155 h->oflags |= HTML_FRAGMENT; in html_alloc()
157 h->oflags |= HTML_TOC; in html_alloc()
161 return h; in html_alloc()
165 html_reset_internal(struct html *h) in html_reset_internal() argument
171 while ((tag = h->tag) != NULL) { in html_reset_internal()
172 h->tag = tag->next; in html_reset_internal()
198 print_gen_head(struct html *h) in print_gen_head() argument
202 print_otag(h, TAG_META, "?", "charset", "utf-8"); in print_gen_head()
203 print_otag(h, TAG_META, "??", "name", "viewport", in print_gen_head()
205 if (h->style != NULL) { in print_gen_head()
206 print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet", in print_gen_head()
207 h->style, "type", "text/css", "media", "all"); in print_gen_head()
215 t = print_otag(h, TAG_STYLE, ""); in print_gen_head()
216 print_text(h, "table.head, table.foot { width: 100%; }"); in print_gen_head()
217 print_endline(h); in print_gen_head()
218 print_text(h, "td.head-rtitle, td.foot-os { text-align: right; }"); in print_gen_head()
219 print_endline(h); in print_gen_head()
220 print_text(h, "td.head-vol { text-align: center; }"); in print_gen_head()
221 print_endline(h); in print_gen_head()
222 print_text(h, ".Nd, .Bf, .Op { display: inline; }"); in print_gen_head()
223 print_endline(h); in print_gen_head()
224 print_text(h, ".Pa, .Ad { font-style: italic; }"); in print_gen_head()
225 print_endline(h); in print_gen_head()
226 print_text(h, ".Ms { font-weight: bold; }"); in print_gen_head()
227 print_endline(h); in print_gen_head()
228 print_text(h, ".Bl-diag "); in print_gen_head()
229 print_byte(h, '>'); in print_gen_head()
230 print_text(h, " dt { font-weight: bold; }"); in print_gen_head()
231 print_endline(h); in print_gen_head()
232 print_text(h, "code.Nm, .Fl, .Cm, .Ic, code.In, .Fd, .Fn, .Cd " in print_gen_head()
234 print_tagq(h, t); in print_gen_head()
238 html_setfont(struct html *h, enum mandoc_esc font) in html_setfont() argument
242 font = h->metal; in html_setfont()
258 h->metal = h->metac; in html_setfont()
259 h->metac = font; in html_setfont()
264 print_metaf(struct html *h) in print_metaf() argument
266 if (h->metaf) { in print_metaf()
267 print_tagq(h, h->metaf); in print_metaf()
268 h->metaf = NULL; in print_metaf()
270 switch (h->metac) { in print_metaf()
272 h->metaf = print_otag(h, TAG_I, ""); in print_metaf()
275 h->metaf = print_otag(h, TAG_B, ""); in print_metaf()
278 h->metaf = print_otag(h, TAG_B, ""); in print_metaf()
279 print_otag(h, TAG_I, ""); in print_metaf()
282 h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); in print_metaf()
285 h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); in print_metaf()
286 print_otag(h, TAG_B, ""); in print_metaf()
289 h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); in print_metaf()
290 print_otag(h, TAG_I, ""); in print_metaf()
298 html_close_paragraph(struct html *h) in html_close_paragraph() argument
303 this = h->tag; in html_close_paragraph()
308 print_ctag(h, this); in html_close_paragraph()
320 html_fillmode(struct html *h, enum roff_tok want) in html_fillmode() argument
325 for (t = h->tag; t != NULL; t = t->next) in html_fillmode()
334 print_tagq(h, t); in html_fillmode()
337 html_close_paragraph(h); in html_fillmode()
338 print_otag(h, TAG_PRE, ""); in html_fillmode()
438 print_escape(struct html *h, char c) in print_escape() argument
443 print_word(h, "<"); in print_escape()
446 print_word(h, ">"); in print_escape()
449 print_word(h, "&"); in print_escape()
452 print_word(h, """); in print_escape()
455 print_word(h, " "); in print_escape()
458 print_byte(h, '-'); in print_escape()
469 print_encode(struct html *h, const char *p, const char *pend, int norecurse) in print_encode() argument
486 if (HTML_SKIPCHAR & h->flags && '\\' != *p) { in print_encode()
487 h->flags &= ~HTML_SKIPCHAR; in print_encode()
493 print_byte(h, *p); in print_encode()
497 print_otag(h, TAG_BR, ""); in print_encode()
508 print_endword(h); in print_encode()
513 if (print_escape(h, *p++)) in print_encode()
528 h->flags |= HTML_NOSPACE; in print_encode()
529 if (html_setfont(h, esc)) in print_encode()
530 print_metaf(h); in print_encode()
531 h->flags &= ~HTML_NOSPACE; in print_encode()
535 h->flags |= HTML_SKIPCHAR; in print_encode()
543 if (h->flags & HTML_SKIPCHAR) { in print_encode()
544 h->flags &= ~HTML_SKIPCHAR; in print_encode()
567 print_word(h, "html"); in print_encode()
589 print_word(h, numbuf); in print_encode()
590 } else if (print_escape(h, c) == 0) in print_encode()
591 print_byte(h, c); in print_encode()
598 print_href(struct html *h, const char *name, const char *sec, int man) in print_href() argument
605 pp = h->base_man1; in print_href()
606 if (h->base_man2 != NULL) { in print_href()
609 pp = h->base_man2; in print_href()
613 pp = h->base_includes; in print_href()
616 print_encode(h, pp, p, 1); in print_href()
619 print_byte(h, '1'); in print_href()
621 print_encode(h, sec, NULL, 1); in print_href()
624 print_encode(h, name, NULL, 1); in print_href()
626 print_encode(h, p, p + 2, 1); in print_href()
630 print_encode(h, pp, NULL, 1); in print_href()
634 print_otag(struct html *h, enum htmltag tag, const char *fmt, ...) in print_otag() argument
647 for (t = h->tag; t != NULL; t = t->next) { in print_otag()
660 } else if (tflags & HTML_TOPHRASE && h->tag->tag == TAG_SECTION) in print_otag()
661 print_otag(h, TAG_P, "c", "Pp"); in print_otag()
668 t->next = h->tag; in print_otag()
671 h->tag = t; in print_otag()
676 print_endline(h); in print_otag()
677 if (h->col == 0) in print_otag()
678 print_indent(h); in print_otag()
679 else if ((h->flags & HTML_NOSPACE) == 0) { in print_otag()
680 if (h->flags & HTML_KEEP) in print_otag()
681 print_word(h, " "); in print_otag()
683 if (h->flags & HTML_PREKEEP) in print_otag()
684 h->flags |= HTML_KEEP; in print_otag()
685 print_endword(h); in print_otag()
689 if ( ! (h->flags & HTML_NONOSPACE)) in print_otag()
690 h->flags &= ~HTML_NOSPACE; in print_otag()
692 h->flags |= HTML_NOSPACE; in print_otag()
696 print_byte(h, '<'); in print_otag()
697 print_word(h, htmltags[tag].name); in print_otag()
734 print_byte(h, ' '); in print_otag()
735 print_word(h, attr); in print_otag()
736 print_byte(h, '='); in print_otag()
737 print_byte(h, '"'); in print_otag()
740 print_href(h, arg1, NULL, 0); in print_otag()
744 print_href(h, arg1, arg2, 1); in print_otag()
748 print_byte(h, '#'); in print_otag()
749 print_encode(h, arg1, NULL, 1); in print_otag()
753 print_encode(h, arg1, NULL, 1); in print_otag()
756 print_byte(h, '"'); in print_otag()
765 print_byte(h, ' '); in print_otag()
767 print_word(h, "style=\""); in print_otag()
770 print_word(h, arg1); in print_otag()
771 print_byte(h, ':'); in print_otag()
772 print_byte(h, ' '); in print_otag()
773 print_word(h, arg2); in print_otag()
774 print_byte(h, ';'); in print_otag()
777 print_byte(h, '"'); in print_otag()
784 print_byte(h, '/'); in print_otag()
786 print_byte(h, '>'); in print_otag()
789 print_endline(h); in print_otag()
791 h->flags |= HTML_NOSPACE; in print_otag()
794 h->indent++; in print_otag()
796 h->noindent++; in print_otag()
808 print_otag_id(struct html *h, enum htmltag elemtype, const char *cattr, in print_otag_id() argument
822 ret = print_otag(h, TAG_A, "chR", "permalink", href); in print_otag_id()
823 t = print_otag(h, elemtype, "ci", cattr, id); in print_otag_id()
835 print_otag(h, TAG_A, "chR", "permalink", href); in print_otag_id()
845 print_ctag(struct html *h, struct tag *tag) in print_ctag() argument
851 if (tag == h->metaf) in print_ctag()
852 h->metaf = NULL; in print_ctag()
853 if (tag == h->tblt) in print_ctag()
854 h->tblt = NULL; in print_ctag()
858 h->indent--; in print_ctag()
860 h->noindent--; in print_ctag()
862 print_endline(h); in print_ctag()
863 print_indent(h); in print_ctag()
864 print_byte(h, '<'); in print_ctag()
865 print_byte(h, '/'); in print_ctag()
866 print_word(h, htmltags[tag->tag].name); in print_ctag()
867 print_byte(h, '>'); in print_ctag()
869 print_endline(h); in print_ctag()
872 h->tag = tag->next; in print_ctag()
878 print_gen_decls(struct html *h) in print_gen_decls() argument
880 print_word(h, "<!DOCTYPE html>"); in print_gen_decls()
881 print_endline(h); in print_gen_decls()
885 print_gen_comment(struct html *h, struct roff_node *n) in print_gen_comment() argument
889 print_word(h, "<!-- This is an automatically generated file." in print_gen_comment()
891 h->indent = 1; in print_gen_comment()
896 print_endline(h); in print_gen_comment()
897 print_indent(h); in print_gen_comment()
898 print_word(h, n->string); in print_gen_comment()
904 print_endline(h); in print_gen_comment()
905 print_word(h, " -->"); in print_gen_comment()
906 print_endline(h); in print_gen_comment()
907 h->indent = 0; in print_gen_comment()
911 print_text(struct html *h, const char *word) in print_text() argument
913 print_tagged_text(h, word, NULL); in print_text()
917 print_tagged_text(struct html *h, const char *word, struct roff_node *n) in print_tagged_text() argument
927 if (h->tag->tag == TAG_SECTION) in print_tagged_text()
928 print_otag(h, TAG_P, "c", "Pp"); in print_tagged_text()
932 if (h->col && (h->flags & HTML_NOSPACE) == 0) { in print_tagged_text()
933 if ( ! (HTML_KEEP & h->flags)) { in print_tagged_text()
934 if (HTML_PREKEEP & h->flags) in print_tagged_text()
935 h->flags |= HTML_KEEP; in print_tagged_text()
936 print_endword(h); in print_tagged_text()
938 print_word(h, " "); in print_tagged_text()
946 assert(h->metaf == NULL); in print_tagged_text()
947 print_metaf(h); in print_tagged_text()
948 print_indent(h); in print_tagged_text()
951 t = print_otag(h, TAG_A, "chR", "permalink", href); in print_tagged_text()
956 if ( ! print_encode(h, word, NULL, 0)) { in print_tagged_text()
957 if ( ! (h->flags & HTML_NONOSPACE)) in print_tagged_text()
958 h->flags &= ~HTML_NOSPACE; in print_tagged_text()
959 h->flags &= ~HTML_NONEWLINE; in print_tagged_text()
961 h->flags |= HTML_NOSPACE | HTML_NONEWLINE; in print_tagged_text()
963 if (h->metaf != NULL) { in print_tagged_text()
964 print_tagq(h, h->metaf); in print_tagged_text()
965 h->metaf = NULL; in print_tagged_text()
967 print_tagq(h, t); in print_tagged_text()
969 h->flags &= ~HTML_IGNDELIM; in print_tagged_text()
973 print_tagq(struct html *h, const struct tag *until) in print_tagq() argument
977 for (this = h->tag; this != NULL; this = next) { in print_tagq()
979 print_ctag(h, this); in print_tagq()
989 print_stagq(struct html *h, const struct tag *suntil) in print_stagq() argument
993 for (this = h->tag; this != NULL; this = next) { in print_stagq()
998 print_ctag(h, this); in print_stagq()
1014 print_byte(struct html *h, char c) in print_byte() argument
1016 if ((h->flags & HTML_BUFFER) == 0) { in print_byte()
1018 h->col++; in print_byte()
1022 if (h->col + h->bufcol < sizeof(h->buf)) { in print_byte()
1023 h->buf[h->bufcol++] = c; in print_byte()
1028 h->col = 0; in print_byte()
1029 print_indent(h); in print_byte()
1032 fwrite(h->buf, h->bufcol, 1, stdout); in print_byte()
1034 h->col = (h->indent + 1) * 2 + h->bufcol + 1; in print_byte()
1035 h->bufcol = 0; in print_byte()
1036 h->flags &= ~HTML_BUFFER; in print_byte()
1044 print_endline(struct html *h) in print_endline() argument
1046 if (h->col == 0) in print_endline()
1049 if (h->bufcol) { in print_endline()
1051 fwrite(h->buf, h->bufcol, 1, stdout); in print_endline()
1052 h->bufcol = 0; in print_endline()
1055 h->col = 0; in print_endline()
1056 h->flags |= HTML_NOSPACE; in print_endline()
1057 h->flags &= ~HTML_BUFFER; in print_endline()
1065 print_endword(struct html *h) in print_endword() argument
1067 if (h->noindent) { in print_endword()
1068 print_byte(h, ' '); in print_endword()
1072 if ((h->flags & HTML_BUFFER) == 0) { in print_endword()
1073 h->col++; in print_endword()
1074 h->flags |= HTML_BUFFER; in print_endword()
1075 } else if (h->bufcol) { in print_endword()
1077 fwrite(h->buf, h->bufcol, 1, stdout); in print_endword()
1078 h->col += h->bufcol + 1; in print_endword()
1080 h->bufcol = 0; in print_endword()
1090 print_indent(struct html *h) in print_indent() argument
1094 if (h->col || h->noindent) in print_indent()
1097 h->col = h->indent * 2; in print_indent()
1098 for (i = 0; i < h->col; i++) in print_indent()
1107 print_word(struct html *h, const char *cp) in print_word() argument
1110 print_byte(h, *cp++); in print_word()