version 1.46, 2013/12/26 02:43:18 |
version 1.48, 2014/03/08 04:43:54 |
|
|
.\" $Id$ |
.\" $Id$ |
.\" |
.\" |
.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> |
.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> |
.\" Copyright (c) 2010, 2011, 2013 Ingo Schwarze <schwarze@openbsd.org> |
.\" Copyright (c) 2010, 2011, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
.\" |
.\" |
.\" Permission to use, copy, modify, and distribute this software for any |
.\" Permission to use, copy, modify, and distribute this software for any |
.\" purpose with or without fee is hereby granted, provided that the above |
.\" purpose with or without fee is hereby granted, provided that the above |
Line 427 The syntax of this request is the same as that of |
|
Line 427 The syntax of this request is the same as that of |
|
It is currently ignored by |
It is currently ignored by |
.Xr mandoc 1 , |
.Xr mandoc 1 , |
as are its children. |
as are its children. |
|
.Ss \&as |
|
Append to a user-defined string. |
|
The syntax of this request is the same as that of |
|
.Sx \&ds . |
|
If a user-defined string with the specified name does not yet exist, |
|
it is set to the empty string before appending. |
.Ss \&cc |
.Ss \&cc |
Changes the control character. |
Changes the control character. |
Its syntax is as follows: |
Its syntax is as follows: |
|
|
is not specified, the control character is reset to |
is not specified, the control character is reset to |
.Sq \&. . |
.Sq \&. . |
Trailing characters are ignored. |
Trailing characters are ignored. |
|
.Ss \&ce |
|
Center some lines. |
|
This line-scoped request is intended to take one integer argument, |
|
specifying how many lines to center. |
|
Currently, it is ignored including its arguments, and the number |
|
of arguments is not checked. |
.Ss \&de |
.Ss \&de |
Define a |
Define a |
.Nm |
.Nm |
Line 665 Its syntax is equivalent to |
|
Line 677 Its syntax is equivalent to |
|
.Sx \&if . |
.Sx \&if . |
.Ss \&if |
.Ss \&if |
Begins a conditional. |
Begins a conditional. |
Right now, the conditional evaluates to true |
This request has the following syntax: |
if and only if it starts with the letter |
.Bd -literal -offset indent |
.Sy n , |
\&.if COND BODY |
indicating processing in nroff style as opposed to troff style. |
.Ed |
|
.Bd -literal -offset indent |
|
\&.if COND \e{BODY |
|
BODY...\e} |
|
.Ed |
|
.Bd -literal -offset indent |
|
\&.if COND \e{\e |
|
BODY... |
|
\&.\e} |
|
.Ed |
|
.Pp |
|
COND is a conditional statement. |
|
Currently, |
|
.Xr mandoc 1 |
|
supports the following subset of roff conditionals: |
|
.Bl -bullet |
|
.It |
|
If |
|
.Sq \&! |
|
is prefixed to COND, the condition is logically inverted. |
|
.It |
|
If the first character of COND is |
|
.Sq n |
|
.Pq nroff mode |
|
or |
|
.Sq o |
|
.Pq odd page , |
|
COND evaluates to true. |
|
.It |
|
If the first character of COND is |
|
.Sq c |
|
.Pq character available , |
|
.Sq d |
|
.Pq string defined , |
|
.Sq e |
|
.Pq even page , |
|
.Sq r |
|
.Pq register accessed , |
|
or |
|
.Sq t |
|
.Pq troff mode , |
|
COND evaluates to false. |
|
.It |
|
If COND starts with a digit, optionally prefixed by a minus sign, |
|
it is evaluated as a numerical expression of the form |
|
.Ar number operator number , |
|
where |
|
.Ar operator |
|
is one of |
|
.Sq < , |
|
.Sq <= , |
|
.Sq = , |
|
.Sq >= , |
|
or |
|
.Sq > . |
|
.It |
|
Otherwise, the first character of COND is regarded as a delimiter |
|
and COND evaluates to true if the string extending from its first |
|
to its second occurrence is equal to the string extending from its |
|
second to its third occurrence. |
|
.It |
|
If COND cannot be parsed, it evaluates to false. |
|
.El |
|
.Pp |
If a conditional is false, its children are not processed, but are |
If a conditional is false, its children are not processed, but are |
syntactically interpreted to preserve the integrity of the input |
syntactically interpreted to preserve the integrity of the input |
document. |
document. |
Line 686 will continue to syntactically interpret to the block |
|
Line 761 will continue to syntactically interpret to the block |
|
conditional. |
conditional. |
Sub-conditionals, in this case, obviously inherit the truth value of |
Sub-conditionals, in this case, obviously inherit the truth value of |
the parent. |
the parent. |
This request has the following syntax: |
|
.Bd -literal -offset indent |
|
\&.if COND \e{\e |
|
BODY... |
|
\&.\e} |
|
.Ed |
|
.Bd -literal -offset indent |
|
\&.if COND \e{ BODY |
|
BODY... \e} |
|
.Ed |
|
.Bd -literal -offset indent |
|
\&.if COND \e{ BODY |
|
BODY... |
|
\&.\e} |
|
.Ed |
|
.Bd -literal -offset indent |
|
\&.if COND \e |
|
BODY |
|
.Ed |
|
.Pp |
.Pp |
COND is a conditional statement. |
|
roff allows for complicated conditionals; mandoc is much simpler. |
|
At this time, mandoc supports only |
|
.Sq n , |
|
evaluating to true; |
|
and |
|
.Sq t , |
|
.Sq e , |
|
and |
|
.Sq o , |
|
evaluating to false. |
|
All other invocations are read up to the next end of line or space and |
|
evaluate as false. |
|
.Pp |
|
If the BODY section is begun by an escaped brace |
If the BODY section is begun by an escaped brace |
.Sq \e{ , |
.Sq \e{ , |
scope continues until a closing-brace escape sequence |
scope continues until the end of the input line containing the |
.Sq \.\e} . |
matching closing-brace escape sequence |
|
.Sq \e} . |
If the BODY is not enclosed in braces, scope continues until |
If the BODY is not enclosed in braces, scope continues until |
the end of the line. |
the end of the line. |
If the COND is followed by a BODY on the same line, whether after a |
If the COND is followed by a BODY on the same line, whether after a |