=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.120 retrieving revision 1.125 diff -u -p -r1.120 -r1.125 --- mandoc/mdoc_term.c 2010/05/10 08:05:17 1.120 +++ mandoc/mdoc_term.c 2010/05/17 22:11:42 1.125 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.120 2010/05/10 08:05:17 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.125 2010/05/17 22:11:42 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -27,6 +27,7 @@ #include #include +#include "mandoc.h" #include "out.h" #include "term.h" #include "mdoc.h" @@ -273,7 +274,7 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc) p = (struct termp *)arg; p->overstep = 0; - p->maxrmargin = 78; + p->maxrmargin = p->defrmargin; if (NULL == p->symtab) switch (p->enc) { @@ -337,6 +338,9 @@ print_mdoc_node(DECL_ARGS) if (termacts[n->tok].post) (*termacts[n->tok].post)(p, &npair, m, n); + if (MDOC_EOS & n->flags) + p->flags |= TERMP_SENTENCE; + p->offset = offset; p->rmargin = rmargin; } @@ -422,7 +426,7 @@ print_mdoc_head(DECL_ARGS) strlcat(buf, ")", BUFSIZ); } - snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); + snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; @@ -1082,13 +1086,16 @@ static int termp_nm_pre(DECL_ARGS) { - if (SEC_SYNOPSIS == n->sec) + if (NULL == n->child && NULL == m->name) + + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) term_newln(p); term_fontpush(p, TERMFONT_BOLD); if (NULL == n->child) term_word(p, m->name); + return(1); } @@ -1213,7 +1220,7 @@ termp_rv_pre(DECL_ARGS) term_word(p, "()"); } - if (n->child->next) + if (n->child && n->child->next) term_word(p, "functions return"); else term_word(p, "function returns"); @@ -1252,7 +1259,7 @@ termp_ex_pre(DECL_ARGS) p->flags &= ~TERMP_NOSPACE; } - if (n->child->next) + if (n->child && n->child->next) term_word(p, "utilities exit"); else term_word(p, "utility exits"); @@ -1381,7 +1388,7 @@ static void termp_fd_post(DECL_ARGS) { - if (n->sec != SEC_SYNOPSIS) + if (n->sec != SEC_SYNOPSIS || ! (MDOC_LINE & n->flags)) return; term_newln(p); @@ -1468,7 +1475,7 @@ static void termp_lb_post(DECL_ARGS) { - if (SEC_LIBRARY == n->sec) + if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags) term_newln(p); } @@ -1537,7 +1544,7 @@ static int termp_ft_pre(DECL_ARGS) { - if (SEC_SYNOPSIS == n->sec) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) if (n->prev && MDOC_Fo == n->prev->tok) term_vspace(p); @@ -1551,7 +1558,7 @@ static void termp_ft_post(DECL_ARGS) { - if (SEC_SYNOPSIS == n->sec) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) term_newln(p); } @@ -1592,7 +1599,7 @@ static void termp_fn_post(DECL_ARGS) { - if (n->sec == SEC_SYNOPSIS && n->next) + if (n->sec == SEC_SYNOPSIS && n->next && MDOC_LINE & n->flags) term_vspace(p); } @@ -1891,7 +1898,7 @@ termp_in_post(DECL_ARGS) term_word(p, ">"); term_fontpop(p); - if (SEC_SYNOPSIS != n->sec) + if (SEC_SYNOPSIS != n->sec && ! (MDOC_LINE & n->flags)) return; term_newln(p);