diff options
-rw-r--r-- | man.7 | 29 | ||||
-rw-r--r-- | man_term.c | 64 |
2 files changed, 74 insertions, 19 deletions
@@ -262,6 +262,18 @@ and This section is a canonical reference to all macros, arranged alphabetically. For the scoping of individual macros, see .Sx MACRO SYNTAX . +.\" SUBSECTION +.Ss Terms +In this reference, a numerical width may be either a standalone natural +number (such as 3, 4, 10, etc.) or a natural number followed by a width +multiplier +.Qq n , +corresponding to the width of the formatted letter n, or +.Qq m , +corresponding to the width of the formatted letter m. The latter is the +default, if unspecified. +.\" SUBSECTION +.Ss Macro Reference .Bl -tag -width Ds .It \&B Text is rendered in bold face. @@ -296,11 +308,8 @@ Begin a paragraph with the following syntax: .Pp This follows the behaviour of the .Sq \&TP -macro except that -.Va width , -which is only considered as such if properly-formed (e.g., 24n, 4, -etc.), is used as the indentation offset instead of the default -indentation value. +except for the macro syntax (all arguments on the line, instead of +having next-line scope). .It \&IR Text is rendered alternately in italics and roman (the default font). Whitespace between arguments is omitted in output. @@ -352,6 +361,16 @@ replaces the default rendered volume as dictated by the manual section. Begin a paragraph where the head, if exceeding the indentation width, is followed by a newline; if not, the body follows on the same line after a buffer to the indentation width. Subsequent output lines are indented. +.Pp +The indentation width may be set as follows: +.Bd -literal -offset indent +\&.TP [width] +.Ed +.Pp +Where +.Va width +must be a properly-formed numeric width. If unspecified or improperly +formed, the default indentation width is used. .It \&br Breaks the current line. Consecutive invocations have no further effect. .It \&fi @@ -474,9 +474,6 @@ pre_IP(DECL_ARGS) int ival; switch (n->type) { - case (MAN_BLOCK): - fmt_block_vspace(p, n); - return(1); case (MAN_BODY): p->flags |= TERMP_NOLPAD; p->flags |= TERMP_NOSPACE; @@ -485,11 +482,14 @@ pre_IP(DECL_ARGS) p->flags |= TERMP_NOBREAK; p->flags |= TERMP_TWOSPACE; break; + case (MAN_BLOCK): + fmt_block_vspace(p, n); + /* FALLTHROUGH */ default: return(1); } - len = INDENT * 2; + len = INDENT; ival = -1; /* Calculate offset. */ @@ -503,11 +503,11 @@ pre_IP(DECL_ARGS) } switch (n->type) { - case (MAN_BODY): - p->offset = INDENT + len; - p->rmargin = p->maxrmargin; - break; case (MAN_HEAD): + /* Handle zero-width lengths. */ + if (0 == len) + len = 1; + p->offset = INDENT; p->rmargin = INDENT + len; if (ival < 0) @@ -517,6 +517,10 @@ pre_IP(DECL_ARGS) for (nn = n->child; nn->next; nn = nn->next) print_node(p, fl, nn, m); return(0); + case (MAN_BODY): + p->offset = INDENT + len; + p->rmargin = p->maxrmargin; + break; default: break; } @@ -551,21 +555,53 @@ post_IP(DECL_ARGS) static int pre_TP(DECL_ARGS) { + const struct man_node *nn; + size_t len; + int ival; switch (n->type) { - case (MAN_BLOCK): - fmt_block_vspace(p, n); - break; case (MAN_HEAD): - p->rmargin = INDENT * 2; - p->offset = INDENT; p->flags |= TERMP_NOBREAK; p->flags |= TERMP_TWOSPACE; break; case (MAN_BODY): p->flags |= TERMP_NOLPAD; p->flags |= TERMP_NOSPACE; - p->offset = INDENT * 2; + break; + case (MAN_BLOCK): + fmt_block_vspace(p, n); + /* FALLTHROUGH */ + default: + return(1); + } + + len = INDENT; + ival = -1; + + /* Calculate offset. */ + + if (NULL != (nn = n->parent->head->child)) + if (NULL != nn->next) + if ((ival = arg_width(nn)) >= 0) + len = (size_t)ival; + + switch (n->type) { + case (MAN_HEAD): + /* Handle zero-length properly. */ + if (0 == len) + len = 1; + + p->offset = INDENT; + p->rmargin = INDENT + len; + + /* Don't print same-line elements. */ + for (nn = n->child; nn; nn = nn->next) + if (nn->line > n->line) + print_node(p, fl, nn, m); + return(0); + case (MAN_BODY): + p->offset = INDENT + len; + p->rmargin = p->maxrmargin; break; default: break; |