static void print_mdoc_nodelist(DECL_ARGS) { print_mdoc_node(p, pair, meta, n); if (n->next) print_mdoc_nodelist(p, pair, meta, n->next); }
static void print_mdoc_nodelist(MDOC_ARGS) { print_mdoc_node(m, n, h); if (n->next) print_mdoc_nodelist(m, n->next, h); }
static void print_mdoc_nodelist(DECL_ARGS) { while (n != NULL) { print_mdoc_node(p, pair, meta, n); n = n->next; } }
static void print_mdoc_nodelist(MDOC_ARGS) { while (n != NULL) { print_mdoc_node(meta, n, h); n = n->next; } }
/* ARGSUSED */ static int mdoc_bd_pre(MDOC_ARGS) { struct htmlpair tag[2]; int comp, sv; const struct mdoc_node *nn; struct roffsu su; if (MDOC_HEAD == n->type) return(0); if (MDOC_BLOCK == n->type) { comp = n->norm->Bd.comp; for (nn = n; nn && ! comp; nn = nn->parent) { if (MDOC_BLOCK != nn->type) continue; if (MDOC_Ss == nn->tok || MDOC_Sh == nn->tok) comp = 1; if (nn->prev) break; } if ( ! comp) print_otag(h, TAG_P, 0, NULL); return(1); } SCALE_HS_INIT(&su, 0); if (n->norm->Bd.offs) a2offs(n->norm->Bd.offs, &su); bufcat_su(h, "margin-left", &su); PAIR_STYLE_INIT(&tag[0], h); if (DISP_unfilled != n->norm->Bd.type && DISP_literal != n->norm->Bd.type) { PAIR_CLASS_INIT(&tag[1], "display"); print_otag(h, TAG_DIV, 2, tag); return(1); } PAIR_CLASS_INIT(&tag[1], "lit display"); print_otag(h, TAG_PRE, 2, tag); /* This can be recursive: save & set our literal state. */ sv = h->flags & HTML_LITERAL; h->flags |= HTML_LITERAL; for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(m, nn, h); /* * If the printed node flushes its own line, then we * needn't do it here as well. This is hacky, but the * notion of selective eoln whitespace is pretty dumb * anyway, so don't sweat it. */ switch (nn->tok) { case (MDOC_Sm): /* FALLTHROUGH */ case (MDOC_br): /* FALLTHROUGH */ case (MDOC_sp): /* FALLTHROUGH */ case (MDOC_Bl): /* FALLTHROUGH */ case (MDOC_D1): /* FALLTHROUGH */ case (MDOC_Dl): /* FALLTHROUGH */ case (MDOC_Lp): /* FALLTHROUGH */ case (MDOC_Pp): continue; default: break; } if (nn->next && nn->next->line == nn->line) continue; else if (nn->next) print_text(h, "\n"); h->flags |= HTML_NOSPACE; } if (0 == sv) h->flags &= ~HTML_LITERAL; return(0); }
static int termp_bd_pre(DECL_ARGS) { size_t tabwidth, lm, len, rm, rmax; struct roff_node *nn; int offset; if (n->type == ROFFT_BLOCK) { print_bvspace(p, n, n); return 1; } else if (n->type == ROFFT_HEAD) return 0; /* Handle the -offset argument. */ if (n->norm->Bd.offs == NULL || ! strcmp(n->norm->Bd.offs, "left")) /* nothing */; else if ( ! strcmp(n->norm->Bd.offs, "indent")) p->offset += term_len(p, p->defindent + 1); else if ( ! strcmp(n->norm->Bd.offs, "indent-two")) p->offset += term_len(p, (p->defindent + 1) * 2); else { offset = a2width(p, n->norm->Bd.offs); if (offset < 0 && (size_t)(-offset) > p->offset) p->offset = 0; else if (offset < SHRT_MAX) p->offset += offset; } /* * If -ragged or -filled are specified, the block does nothing * but change the indentation. If -unfilled or -literal are * specified, text is printed exactly as entered in the display: * for macro lines, a newline is appended to the line. Blank * lines are allowed. */ if (DISP_literal != n->norm->Bd.type && DISP_unfilled != n->norm->Bd.type && DISP_centered != n->norm->Bd.type) return 1; tabwidth = p->tabwidth; if (DISP_literal == n->norm->Bd.type) p->tabwidth = term_len(p, 8); lm = p->offset; rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN; for (nn = n->child; nn; nn = nn->next) { if (DISP_centered == n->norm->Bd.type) { if (nn->type == ROFFT_TEXT) { len = term_strlen(p, nn->string); p->offset = len >= rm ? 0 : lm + len >= rm ? rm - len : (lm + rm - len) / 2; } else p->offset = lm; } print_mdoc_node(p, pair, meta, nn); /* * If the printed node flushes its own line, then we * needn't do it here as well. This is hacky, but the * notion of selective eoln whitespace is pretty dumb * anyway, so don't sweat it. */ switch (nn->tok) { case MDOC_Sm: case MDOC_br: case MDOC_sp: case MDOC_Bl: case MDOC_D1: case MDOC_Dl: case MDOC_Lp: case MDOC_Pp: continue; default: break; } if (p->flags & TERMP_NONEWLINE || (nn->next && ! (nn->next->flags & MDOC_LINE))) continue; term_flushln(p); p->flags |= TERMP_NOSPACE; } p->tabwidth = tabwidth; p->rmargin = rm; p->maxrmargin = rmax; return 0; }
static int mdoc_bd_pre(MDOC_ARGS) { int comp, sv; struct roff_node *nn; if (n->type == ROFFT_HEAD) return 0; if (n->type == ROFFT_BLOCK) { comp = n->norm->Bd.comp; for (nn = n; nn && ! comp; nn = nn->parent) { if (nn->type != ROFFT_BLOCK) continue; if (MDOC_Ss == nn->tok || MDOC_Sh == nn->tok) comp = 1; if (nn->prev) break; } if ( ! comp) print_paragraph(h); return 1; } /* Handle the -offset argument. */ if (n->norm->Bd.offs == NULL || ! strcmp(n->norm->Bd.offs, "left")) print_otag(h, TAG_DIV, "c", "Bd"); else print_otag(h, TAG_DIV, "c", "Bd Bd-indent"); if (n->norm->Bd.type != DISP_unfilled && n->norm->Bd.type != DISP_literal) return 1; print_otag(h, TAG_PRE, "c", "Li"); /* This can be recursive: save & set our literal state. */ sv = h->flags & HTML_LITERAL; h->flags |= HTML_LITERAL; for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(meta, nn, h); /* * If the printed node flushes its own line, then we * needn't do it here as well. This is hacky, but the * notion of selective eoln whitespace is pretty dumb * anyway, so don't sweat it. */ switch (nn->tok) { case ROFF_br: case ROFF_sp: case MDOC_Sm: case MDOC_Bl: case MDOC_D1: case MDOC_Dl: case MDOC_Lp: case MDOC_Pp: continue; default: break; } if (h->flags & HTML_NONEWLINE || (nn->next && ! (nn->next->flags & NODE_LINE))) continue; else if (nn->next) print_text(h, "\n"); h->flags |= HTML_NOSPACE; } if (0 == sv) h->flags &= ~HTML_LITERAL; return 0; }
static int mdoc_bd_pre(MDOC_ARGS) { struct htmlpair tag[2]; int comp, sv; struct mdoc_node *nn; struct roffsu su; if (MDOC_HEAD == n->type) return(0); if (MDOC_BLOCK == n->type) { comp = n->norm->Bd.comp; for (nn = n; nn && ! comp; nn = nn->parent) { if (MDOC_BLOCK != nn->type) continue; if (MDOC_Ss == nn->tok || MDOC_Sh == nn->tok) comp = 1; if (nn->prev) break; } if ( ! comp) print_paragraph(h); return(1); } /* Handle the -offset argument. */ if (n->norm->Bd.offs == NULL || ! strcmp(n->norm->Bd.offs, "left")) SCALE_HS_INIT(&su, 0); else if ( ! strcmp(n->norm->Bd.offs, "indent")) SCALE_HS_INIT(&su, INDENT); else if ( ! strcmp(n->norm->Bd.offs, "indent-two")) SCALE_HS_INIT(&su, INDENT * 2); else a2width(n->norm->Bd.offs, &su); bufinit(h); bufcat_su(h, "margin-left", &su); PAIR_STYLE_INIT(&tag[0], h); if (DISP_unfilled != n->norm->Bd.type && DISP_literal != n->norm->Bd.type) { PAIR_CLASS_INIT(&tag[1], "display"); print_otag(h, TAG_DIV, 2, tag); return(1); } PAIR_CLASS_INIT(&tag[1], "lit display"); print_otag(h, TAG_PRE, 2, tag); /* This can be recursive: save & set our literal state. */ sv = h->flags & HTML_LITERAL; h->flags |= HTML_LITERAL; for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(meta, nn, h); /* * If the printed node flushes its own line, then we * needn't do it here as well. This is hacky, but the * notion of selective eoln whitespace is pretty dumb * anyway, so don't sweat it. */ switch (nn->tok) { case MDOC_Sm: /* FALLTHROUGH */ case MDOC_br: /* FALLTHROUGH */ case MDOC_sp: /* FALLTHROUGH */ case MDOC_Bl: /* FALLTHROUGH */ case MDOC_D1: /* FALLTHROUGH */ case MDOC_Dl: /* FALLTHROUGH */ case MDOC_Lp: /* FALLTHROUGH */ case MDOC_Pp: continue; default: break; } if (h->flags & HTML_NONEWLINE || (nn->next && ! (nn->next->flags & MDOC_LINE))) continue; else if (nn->next) print_text(h, "\n"); h->flags |= HTML_NOSPACE; } if (0 == sv) h->flags &= ~HTML_LITERAL; return(0); }
/* ARGSUSED */ static int termp_bd_pre(DECL_ARGS) { size_t tabwidth, rm, rmax; struct mdoc_node *nn; if (MDOC_BLOCK == n->type) { print_bvspace(p, n, n); return(1); } else if (MDOC_HEAD == n->type) return(0); if (n->norm->Bd.offs) p->offset += a2offs(p, n->norm->Bd.offs); /* * If -ragged or -filled are specified, the block does nothing * but change the indentation. If -unfilled or -literal are * specified, text is printed exactly as entered in the display: * for macro lines, a newline is appended to the line. Blank * lines are allowed. */ if (DISP_literal != n->norm->Bd.type && DISP_unfilled != n->norm->Bd.type) return(1); tabwidth = p->tabwidth; if (DISP_literal == n->norm->Bd.type) p->tabwidth = term_len(p, 8); rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN; for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(p, pair, meta, nn); /* * If the printed node flushes its own line, then we * needn't do it here as well. This is hacky, but the * notion of selective eoln whitespace is pretty dumb * anyway, so don't sweat it. */ switch (nn->tok) { case (MDOC_Sm): /* FALLTHROUGH */ case (MDOC_br): /* FALLTHROUGH */ case (MDOC_sp): /* FALLTHROUGH */ case (MDOC_Bl): /* FALLTHROUGH */ case (MDOC_D1): /* FALLTHROUGH */ case (MDOC_Dl): /* FALLTHROUGH */ case (MDOC_Lp): /* FALLTHROUGH */ case (MDOC_Pp): continue; default: break; } if (nn->next && nn->next->line == nn->line) continue; term_flushln(p); p->flags |= TERMP_NOSPACE; } p->tabwidth = tabwidth; p->rmargin = rm; p->maxrmargin = rmax; return(0); }