+ i = 0;
+
+ if (MAN_ROOT == n->parent->tok) {
+ SCALE_HS_INIT(&su, INDENT);
+ bufcat_su(h, "margin-left", &su);
+ i++;
+ }
+ if (n->next && n->next->child) {
+ SCALE_VS_INIT(&su, 1);
+ bufcat_su(h, "margin-bottom", &su);
+ i++;
+ }
+
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, i ? 1 : 0, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+man_IP_pre(MAN_ARGS)
+{
+ struct roffsu su;
+ struct htmlpair tag;
+ const struct man_node *nn;
+ int width;
+
+ /*
+ * This scattering of 1-BU margins and pads is to make sure that
+ * when text overruns its box, the subsequent text isn't flush
+ * up against it. However, the rest of the right-hand box must
+ * also be adjusted in consideration of this 1-BU space.
+ */
+
+ if (MAN_BODY == n->type) {
+ SCALE_HS_INIT(&su, INDENT);
+ bufcat_su(h, "margin-left", &su);
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, 1, &tag);
+ return(1);
+ }
+
+ nn = MAN_BLOCK == n->type ?
+ n->head->child : n->parent->head->child;
+
+ SCALE_HS_INIT(&su, INDENT);
+ width = 0;
+
+ if (MAN_IP == n->tok && NULL != nn)
+ if (NULL != (nn = nn->next)) {
+ for ( ; nn->next; nn = nn->next)
+ /* Do nothing. */ ;
+ width = a2width(nn, &su);
+ }
+
+ if (MAN_TP == n->tok && NULL != nn)
+ width = a2width(nn, &su);
+
+ if (MAN_BLOCK == n->type) {
+ bufcat_su(h, "margin-left", &su);
+ SCALE_VS_INIT(&su, 1);
+ bufcat_su(h, "margin-top", &su);
+ bufcat_style(h, "clear", "both");
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, 1, &tag);
+ return(1);
+ }
+
+ bufcat_su(h, "min-width", &su);
+ SCALE_INVERT(&su);
+ bufcat_su(h, "margin-left", &su);
+ SCALE_HS_INIT(&su, 1);
+ bufcat_su(h, "margin-right", &su);
+ bufcat_style(h, "clear", "left");
+
+ if (n->next && n->next->child)
+ bufcat_style(h, "float", "left");
+
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, 1, &tag);
+
+ /* With a length string, manually omit the last child. */
+
+ if ( ! width)
+ return(1);
+
+ if (MAN_IP == n->tok)
+ for (nn = n->child; nn->next; nn = nn->next)
+ print_man_node(m, nn, h);
+ if (MAN_TP == n->tok)
+ for (nn = n->child->next; nn; nn = nn->next)
+ print_man_node(m, nn, h);
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+man_HP_pre(MAN_ARGS)
+{
+ const struct man_node *nn;
+ struct htmlpair tag;
+ struct roffsu su;
+
+ if (MAN_HEAD == n->type)
+ return(0);
+
+ nn = MAN_BLOCK == n->type ?
+ n->head->child : n->parent->head->child;
+
+ SCALE_HS_INIT(&su, INDENT);
+
+ if (NULL != nn)
+ (void)a2width(nn, &su);
+
+ if (MAN_BLOCK == n->type) {
+ bufcat_su(h, "margin-left", &su);
+ SCALE_VS_INIT(&su, 1);
+ bufcat_su(h, "margin-top", &su);
+ bufcat_style(h, "clear", "both");
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, 1, &tag);
+ return(1);
+ }
+
+ bufcat_su(h, "margin-left", &su);
+ SCALE_INVERT(&su);
+ bufcat_su(h, "text-indent", &su);
+
+ PAIR_STYLE_INIT(&tag, h);
+ print_otag(h, TAG_DIV, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+man_B_pre(MAN_ARGS)
+{
+ struct htmlpair tag;
+
+ PAIR_CLASS_INIT(&tag, "bold");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+man_I_pre(MAN_ARGS)
+{
+ struct htmlpair tag;
+
+ PAIR_CLASS_INIT(&tag, "italic");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+man_ign_pre(MAN_ARGS)
+{
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+man_RS_pre(MAN_ARGS)
+{
+ struct htmlpair tag;
+ struct roffsu su;
+
+ if (MAN_HEAD == n->type)
+ return(0);
+ else if (MAN_BODY == n->type)
+ return(1);
+
+ SCALE_HS_INIT(&su, INDENT);
+ bufcat_su(h, "margin-left", &su);
+
+ if (n->head->child) {
+ SCALE_VS_INIT(&su, 1);
+ a2width(n->head->child, &su);
+ bufcat_su(h, "margin-top", &su);
+ }