Lines Matching refs:h

120 	struct html	*h;  in ml_alloc()  local
130 h = mandoc_calloc(1, sizeof(struct html)); in ml_alloc()
132 h->type = type; in ml_alloc()
133 h->tags.head = NULL; in ml_alloc()
134 h->symtab = mchars_alloc(); in ml_alloc()
139 h->style = v; in ml_alloc()
142 h->base_man = v; in ml_alloc()
145 h->base_includes = v; in ml_alloc()
148 h->oflags |= HTML_FRAGMENT; in ml_alloc()
154 return(h); in ml_alloc()
177 struct html *h; in html_free() local
179 h = (struct html *)p; in html_free()
181 while ((tag = h->tags.head) != NULL) { in html_free()
182 h->tags.head = tag->next; in html_free()
186 if (h->symtab) in html_free()
187 mchars_free(h->symtab); in html_free()
189 free(h); in html_free()
194 print_gen_head(struct html *h) in print_gen_head() argument
202 print_otag(h, TAG_META, 2, tag); in print_gen_head()
208 print_otag(h, TAG_META, 2, tag); in print_gen_head()
210 if (h->style) { in print_gen_head()
214 tag[1].val = h->style; in print_gen_head()
219 print_otag(h, TAG_LINK, 4, tag); in print_gen_head()
224 print_metaf(struct html *h, enum mandoc_esc deco) in print_metaf() argument
230 font = h->metal; in print_metaf()
251 if (h->metaf) { in print_metaf()
252 print_tagq(h, h->metaf); in print_metaf()
253 h->metaf = NULL; in print_metaf()
256 h->metal = h->metac; in print_metaf()
257 h->metac = font; in print_metaf()
261 h->metaf = print_otag(h, TAG_I, 0, NULL); in print_metaf()
264 h->metaf = print_otag(h, TAG_B, 0, NULL); in print_metaf()
267 h->metaf = print_otag(h, TAG_B, 0, NULL); in print_metaf()
268 print_otag(h, TAG_I, 0, NULL); in print_metaf()
328 print_encode(struct html *h, const char *p, int norecurse) in print_encode() argument
339 if (HTML_SKIPCHAR & h->flags && '\\' != *p) { in print_encode()
340 h->flags &= ~HTML_SKIPCHAR; in print_encode()
387 print_metaf(h, esc); in print_encode()
390 h->flags |= HTML_SKIPCHAR; in print_encode()
396 if (h->flags & HTML_SKIPCHAR) { in print_encode()
397 h->flags &= ~HTML_SKIPCHAR; in print_encode()
414 c = mchars_spec2cp(h->symtab, seq, len); in print_encode()
434 print_attr(struct html *h, const char *key, const char *val) in print_attr() argument
437 (void)print_encode(h, val, 1); in print_attr()
443 print_otag(struct html *h, enum htmltag tag, in print_otag() argument
454 t->next = h->tags.head; in print_otag()
455 h->tags.head = t; in print_otag()
459 if ( ! (HTML_NOSPACE & h->flags)) in print_otag()
462 if ( ! (HTML_KEEP & h->flags)) { in print_otag()
463 if (HTML_PREKEEP & h->flags) in print_otag()
464 h->flags |= HTML_KEEP; in print_otag()
470 if ( ! (h->flags & HTML_NONOSPACE)) in print_otag()
471 h->flags &= ~HTML_NOSPACE; in print_otag()
473 h->flags |= HTML_NOSPACE; in print_otag()
479 print_attr(h, htmlattrs[p[i].key], p[i].val); in print_otag()
483 if (TAG_HTML == tag && HTML_XHTML_1_0_STRICT == h->type) { in print_otag()
484 print_attr(h, "xmlns", "http://www.w3.org/1999/xhtml"); in print_otag()
485 print_attr(h, "xml:lang", "en"); in print_otag()
486 print_attr(h, "lang", "en"); in print_otag()
492 switch (h->type) { in print_otag()
502 h->flags |= HTML_NOSPACE; in print_otag()
512 print_ctag(struct html *h, enum htmltag tag) in print_ctag() argument
517 h->flags |= HTML_NOSPACE; in print_ctag()
523 print_gen_decls(struct html *h) in print_gen_decls() argument
529 switch (h->type) { in print_gen_decls()
548 print_text(struct html *h, const char *word) in print_text() argument
551 if ( ! (HTML_NOSPACE & h->flags)) { in print_text()
553 if ( ! (HTML_KEEP & h->flags)) { in print_text()
554 if (HTML_PREKEEP & h->flags) in print_text()
555 h->flags |= HTML_KEEP; in print_text()
561 assert(NULL == h->metaf); in print_text()
562 switch (h->metac) { in print_text()
564 h->metaf = print_otag(h, TAG_I, 0, NULL); in print_text()
567 h->metaf = print_otag(h, TAG_B, 0, NULL); in print_text()
570 h->metaf = print_otag(h, TAG_B, 0, NULL); in print_text()
571 print_otag(h, TAG_I, 0, NULL); in print_text()
578 if ( ! print_encode(h, word, 0)) { in print_text()
579 if ( ! (h->flags & HTML_NONOSPACE)) in print_text()
580 h->flags &= ~HTML_NOSPACE; in print_text()
582 h->flags |= HTML_NOSPACE; in print_text()
584 if (h->metaf) { in print_text()
585 print_tagq(h, h->metaf); in print_text()
586 h->metaf = NULL; in print_text()
589 h->flags &= ~HTML_IGNDELIM; in print_text()
594 print_tagq(struct html *h, const struct tag *until) in print_tagq() argument
598 while ((tag = h->tags.head) != NULL) { in print_tagq()
603 if (tag == h->metaf) in print_tagq()
604 h->metaf = NULL; in print_tagq()
605 if (tag == h->tblt) in print_tagq()
606 h->tblt = NULL; in print_tagq()
607 print_ctag(h, tag->tag); in print_tagq()
608 h->tags.head = tag->next; in print_tagq()
617 print_stagq(struct html *h, const struct tag *suntil) in print_stagq() argument
621 while ((tag = h->tags.head) != NULL) { in print_stagq()
628 if (tag == h->metaf) in print_stagq()
629 h->metaf = NULL; in print_stagq()
630 if (tag == h->tblt) in print_stagq()
631 h->tblt = NULL; in print_stagq()
632 print_ctag(h, tag->tag); in print_stagq()
633 h->tags.head = tag->next; in print_stagq()
639 bufinit(struct html *h) in bufinit() argument
642 h->buf[0] = '\0'; in bufinit()
643 h->buflen = 0; in bufinit()
647 bufcat_style(struct html *h, const char *key, const char *val) in bufcat_style() argument
650 bufcat(h, key); in bufcat_style()
651 bufcat(h, ":"); in bufcat_style()
652 bufcat(h, val); in bufcat_style()
653 bufcat(h, ";"); in bufcat_style()
657 bufcat(struct html *h, const char *p) in bufcat() argument
660 h->buflen = strlcat(h->buf, p, BUFSIZ); in bufcat()
661 assert(h->buflen < BUFSIZ); in bufcat()
665 bufcat_fmt(struct html *h, const char *fmt, ...) in bufcat_fmt() argument
670 (void)vsnprintf(h->buf + (int)h->buflen, in bufcat_fmt()
671 BUFSIZ - h->buflen - 1, fmt, ap); in bufcat_fmt()
673 h->buflen = strlen(h->buf); in bufcat_fmt()
677 bufncat(struct html *h, const char *p, size_t sz) in bufncat() argument
680 assert(h->buflen + sz + 1 < BUFSIZ); in bufncat()
681 strncat(h->buf, p, sz); in bufncat()
682 h->buflen += sz; in bufncat()
686 buffmt_includes(struct html *h, const char *name) in buffmt_includes() argument
690 pp = h->base_includes; in buffmt_includes()
692 bufinit(h); in buffmt_includes()
694 bufncat(h, pp, (size_t)(p - pp)); in buffmt_includes()
697 bufcat(h, name); in buffmt_includes()
700 bufncat(h, p, 2); in buffmt_includes()
706 bufcat(h, pp); in buffmt_includes()
710 buffmt_man(struct html *h, in buffmt_man() argument
715 pp = h->base_man; in buffmt_man()
717 bufinit(h); in buffmt_man()
719 bufncat(h, pp, (size_t)(p - pp)); in buffmt_man()
722 bufcat(h, sec ? sec : "1"); in buffmt_man()
725 bufcat_fmt(h, name); in buffmt_man()
728 bufncat(h, p, 2); in buffmt_man()
734 bufcat(h, pp); in buffmt_man()
738 bufcat_su(struct html *h, const char *p, const struct roffsu *su) in bufcat_su() argument
746 bufcat_fmt(h, "%s: %.2f%s;", p, v, roffscales[su->unit]); in bufcat_su()
750 bufcat_id(struct html *h, const char *src) in bufcat_id() argument
756 bufcat_fmt(h, "%.2x", *src++); in bufcat_id()