-/* $Id: man_term.c,v 1.58 2010/03/23 12:42:22 kristaps Exp $ */
+/* $Id: man_term.c,v 1.67 2010/05/15 20:51:40 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
{ pre_sp, NULL, MAN_NOTEXT }, /* Sp */
{ pre_nf, NULL, 0 }, /* Vb */
{ pre_fi, NULL, 0 }, /* Ve */
+ { pre_ign, NULL, MAN_NOTEXT }, /* de */
+ { pre_ign, NULL, MAN_NOTEXT }, /* dei */
+ { pre_ign, NULL, MAN_NOTEXT }, /* am */
+ { pre_ign, NULL, MAN_NOTEXT }, /* ami */
+ { NULL, NULL, 0 }, /* . */
};
p = (struct termp *)arg;
p->overstep = 0;
- p->maxrmargin = 65;
+ p->maxrmargin = p->defrmargin;
if (NULL == p->symtab)
switch (p->enc) {
pre_fi(DECL_ARGS)
{
- p->rmargin = p->maxrmargin = 65;
mt->fl &= ~MANT_LITERAL;
return(1);
}
pre_nf(DECL_ARGS)
{
- p->rmargin = p->maxrmargin = 78;
- term_newln(p);
mt->fl |= MANT_LITERAL;
-
return(MAN_Vb != n->tok);
}
if (0 == len)
term_newln(p);
- for (i = 0; i < len; i++)
+ for (i = 0; i <= len; i++)
term_vspace(p);
return(0);
break;
case (MAN_HEAD):
p->flags |= TERMP_NOBREAK;
- p->flags |= TERMP_TWOSPACE;
break;
case (MAN_BLOCK):
print_bvspace(p, n);
case (MAN_HEAD):
term_flushln(p);
p->flags &= ~TERMP_NOBREAK;
- p->flags &= ~TERMP_TWOSPACE;
p->rmargin = p->maxrmargin;
break;
case (MAN_BODY):
if (n->prev && MAN_SH == n->prev->tok)
if (NULL == n->prev->body->child)
break;
+ /* If the first macro, no vspae. */
+ if (NULL == n->prev)
+ break;
term_vspace(p);
break;
case (MAN_HEAD):
case (MAN_BLOCK):
mt->offset = mt->lmargin = INDENT;
break;
+ case (MAN_HEAD):
+ break;
default:
term_newln(p);
p->offset = INDENT;
static void
print_man_node(DECL_ARGS)
{
+ size_t rm, rmax;
int c;
c = 1;
/* FIXME: this means that macro lines are munged! */
if (MANT_LITERAL & mt->fl) {
+ rm = p->rmargin;
+ rmax = p->maxrmargin;
+ p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
p->flags |= TERMP_NOSPACE;
term_flushln(p);
+ p->rmargin = rm;
+ p->maxrmargin = rmax;
}
break;
default:
if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
term_fontrepl(p, TERMFONT_NONE);
}
+
+ if (MAN_EOS & n->flags)
+ p->flags |= TERMP_SENTENCE;
}
char buf[BUFSIZ], title[BUFSIZ];
size_t buflen, titlen;
+ /*
+ * Note that old groff would spit out some spaces before the
+ * header. We discontinue this strange behaviour, but at one
+ * point we did so here.
+ */
+
p->rmargin = p->maxrmargin;
p->offset = 0;
strlcpy(buf, m->vol, BUFSIZ);
buflen = strlen(buf);
- snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec);
+ snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec);
titlen = strlen(title);
p->offset = 0;
p->rmargin = p->maxrmargin;
p->offset = 0;
p->flags &= ~TERMP_NOSPACE;
+
+ /*
+ * Groff likes to have some leading spaces before content. Well
+ * that's fine by me.
+ */
+
+ term_vspace(p);
+ term_vspace(p);
+ term_vspace(p);
}