summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 16:23:22 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 16:23:22 +0000
commitbd329dd8fae21fc03372e563b33ef77a421e7ea9 (patch)
tree33fe05e6ba7ea5759d5c284f383db7440fc2f362
parent463a2b842f830d918f58b4a9f04bdc8af8421a18 (diff)
downloadmandoc-bd329dd8fae21fc03372e563b33ef77a421e7ea9.tar.gz
mandoc-bd329dd8fae21fc03372e563b33ef77a421e7ea9.tar.zst
mandoc-bd329dd8fae21fc03372e563b33ef77a421e7ea9.zip
All macro-invocations, for consistency, begin with `.' in documentation.
Fixed \\ -> \e in manual documentation. All preliminary -man macros in place.
-rw-r--r--Makefile2
-rw-r--r--main.c6
-rw-r--r--man.793
-rw-r--r--man_term.c85
-rw-r--r--mandoc.123
-rw-r--r--mdoc.318
-rw-r--r--mdoc.7474
-rw-r--r--mdoc_term.c40
8 files changed, 408 insertions, 333 deletions
diff --git a/Makefile b/Makefile
index cfa6400c..ef534bb5 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ INSTALL_DATA = install -m 0444
INSTALL_LIB = install -m 0644
INSTALL_MAN = $(INSTALL_DATA)
-VERSION = 1.7.5
+VERSION = 1.7.6
VDATE = 26 March 2009
VFLAGS = -DVERSION=\"$(VERSION)\"
diff --git a/main.c b/main.c
index b0b5561a..046c2a55 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.16 2009/03/25 21:46:24 kristaps Exp $ */
+/* $Id: main.c,v 1.17 2009/03/26 16:23:22 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -401,9 +401,9 @@ static int
moptions(enum intt *tflags, char *arg)
{
- if (0 == strcmp(arg, "mdoc"))
+ if (0 == strcmp(arg, "doc"))
*tflags = INTT_MDOC;
- else if (0 == strcmp(arg, "man"))
+ else if (0 == strcmp(arg, "an"))
*tflags = INTT_MAN;
else {
warnx("bad argument: -m%s", arg);
diff --git a/man.7 b/man.7
index f85d690c..6ce607ca 100644
--- a/man.7
+++ b/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.3 2009/03/26 14:38:11 kristaps Exp $
+.\" $Id: man.7,v 1.4 2009/03/26 16:23:22 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -34,7 +34,7 @@ structure of the
.Nm
language.
.Pp
-.Em \&Do not
+.Em \&Do not ever
use
.Nm
to write your manuals. Use the
@@ -49,7 +49,7 @@ character
.Sq \&.
are parsed for macros. Other lines are interpreted within the scope of
prior macros:
-.Bd -literal -offset XXX
+.Bd -literal -offset indent
\&.SH Macro lines change control state.
Other lines are interpreted within the current state.
.Ed
@@ -69,6 +69,13 @@ line termination.
.Pp
Blank lines are acceptable; where found, the output will also assert a
vertical space.
+.Pp
+The
+.Sq \ec
+escape is common in historical
+.Nm
+documents; if encountered at the end of a word, it ensures that the
+subsequent word isn't off-set by whitespace.
.\" SUB-SECTION
.Ss Special Characters
Special character sequences begin with the escape character
@@ -91,41 +98,89 @@ contains a table of all available escapes.
.\" SECTION
.Sh STRUCTURE
Macros are one to three three characters in length and begin with a
-control character
-.Sq \&.
+control character ,
+.Sq \&. ,
at the beginning of the line. An arbitrary amount of whitespace may
sit between the control character and the macro name. Thus,
-.Sq \&PP
+.Sq \&.PP
and
.Sq \&.\ \ \ \&PP
are equivalent.
.Pp
-All follow the same
-structural rules:
-.Bd -literal -offset XXXX
-\&.Yo \(lBbody...\(rB
+All
+.Nm
+macros follow the same structural rules:
+.Bd -literal -offset indent
+\&.YO \(lBbody...\(rB
.Ed
.Pp
The
.Dq body
consists of zero or more arguments to the macro.
+.Pp
+.Nm
+has a primitive notion of multi-line scope for the following macros:
+.Sq \&.TM ,
+.Sq \&.SM ,
+.Sq \&.SB ,
+.Sq \&.BI ,
+.Sq \&.IB ,
+.Sq \&.BR ,
+.Sq \&.RB ,
+.Sq \&.R ,
+.Sq \&.B ,
+.Sq \&.I ,
+.Sq \&.IR
+and
+.Sq \&.RI .
+When these macros are invoked without arguments, the subsequent line is
+considered a continuation of the macro. Thus:
+.Bd -literal -offset indent
+\&.RI foo
+.Ed
+.Pp
+and
+.Bd -literal -offset indent
+\&.RI
+foo
+.Ed
+.Pp
+are equivalent. If two consecutive lines exhibit the latter behaviour,
+an error is raised. Thus, the following is acceptable:
+.Bd -literal -offset indent
+\&.RI
+\&.I Hello, world.
+foo
+.Ed
+.Pp
+The following, however, is not:
+.Bd -literal -offset indent
+\&.RI
+\&.I
+Hello, world.
+.Ed
+.Pp
+The
+.Sq \&.TP
+macro has similar behaviour, but does not need an empty argument line in
+order to trigger scope.
.\" PARAGRAPH
.Sh MACROS
This section contains a complete list of all
.Nm
macros, arranged alphabetically, with the number of arguments.
.Pp
-.Bl -column "MacroX" "Arguments" -compact -offset XXXX
+.Bl -column "MacroX" "Arguments" -compact -offset indent
.It Em Macro Ta Em Arguments
-.It \&.TH Ta >0
-.It \&.SH Ta n
-.It \&.SS Ta n
+.It \&.TH Ta >1, <6
+.It \&.SH Ta >0
+.It \&.SS Ta >0
.It \&.TP Ta n
-.It \&.LP Ta n
-.It \&.PP Ta n
-.It \&.P Ta n
-.It \&.IP Ta n
-.It \&.HP Ta n
+.It \&.LP Ta 0
+.It \&.PP Ta 0
+.It \&.P Ta 0
+.It \&.IP Ta <3
+.It \&.HP Ta <2
.It \&.SM Ta n
.It \&.SB Ta n
.It \&.BI Ta n
diff --git a/man_term.c b/man_term.c
index 5e517038..58fcee0d 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.3 2009/03/26 15:19:44 kristaps Exp $ */
+/* $Id: man_term.c,v 1.4 2009/03/26 16:23:22 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -44,6 +44,7 @@ static int pre_BI(DECL_ARGS);
static int pre_BR(DECL_ARGS);
static int pre_I(DECL_ARGS);
static int pre_IB(DECL_ARGS);
+static int pre_IP(DECL_ARGS);
static int pre_IR(DECL_ARGS);
static int pre_PP(DECL_ARGS);
static int pre_RB(DECL_ARGS);
@@ -66,8 +67,8 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_PP, NULL }, /* LP */
{ pre_PP, NULL }, /* PP */
{ pre_PP, NULL }, /* P */
- { NULL, NULL }, /* IP */
- { pre_PP, NULL }, /* HP */ /* XXX */
+ { pre_IP, NULL }, /* IP */
+ { pre_PP, NULL }, /* HP */ /* FIXME */
{ NULL, NULL }, /* SM */
{ pre_B, post_B }, /* SB */
{ pre_BI, NULL }, /* BI */
@@ -131,6 +132,8 @@ pre_IR(DECL_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
if ( ! (i % 2))
p->flags |= TERMP_UNDER;
+ if (i > 0)
+ p->flags |= TERMP_NOSPACE;
print_node(p, nn, m);
if ( ! (i % 2))
p->flags &= ~TERMP_UNDER;
@@ -148,6 +151,8 @@ pre_IB(DECL_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
p->flags |= i % 2 ? TERMP_BOLD : TERMP_UNDER;
+ if (i > 0)
+ p->flags |= TERMP_NOSPACE;
print_node(p, nn, m);
p->flags &= i % 2 ? ~TERMP_BOLD : ~TERMP_UNDER;
}
@@ -165,6 +170,8 @@ pre_RB(DECL_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
if (i % 2)
p->flags |= TERMP_BOLD;
+ if (i > 0)
+ p->flags |= TERMP_NOSPACE;
print_node(p, nn, m);
if (i % 2)
p->flags &= ~TERMP_BOLD;
@@ -183,6 +190,8 @@ pre_RI(DECL_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
if ( ! (i % 2))
p->flags |= TERMP_UNDER;
+ if (i > 0)
+ p->flags |= TERMP_NOSPACE;
print_node(p, nn, m);
if ( ! (i % 2))
p->flags &= ~TERMP_UNDER;
@@ -201,6 +210,8 @@ pre_BR(DECL_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
if ( ! (i % 2))
p->flags |= TERMP_BOLD;
+ if (i > 0)
+ p->flags |= TERMP_NOSPACE;
print_node(p, nn, m);
if ( ! (i % 2))
p->flags &= ~TERMP_BOLD;
@@ -218,6 +229,8 @@ pre_BI(DECL_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
p->flags |= i % 2 ? TERMP_UNDER : TERMP_BOLD;
+ if (i > 0)
+ p->flags |= TERMP_NOSPACE;
print_node(p, nn, m);
p->flags &= i % 2 ? ~TERMP_UNDER : ~TERMP_BOLD;
}
@@ -257,6 +270,34 @@ pre_PP(DECL_ARGS)
/* ARGSUSED */
static int
+pre_IP(DECL_ARGS)
+{
+ const struct man_node *nn;
+ size_t offs;
+
+ term_vspace(p);
+ p->offset = INDENT;
+
+ if (NULL == (nn = n->child))
+ return(1);
+
+ /* FIXME - ignore the designator. */
+ nn = nn->next;
+
+ if (MAN_TEXT != nn->type)
+ errx(1, "expected text line argument");
+
+ offs = (size_t)atoi(nn->string);
+ nn = nn->next;
+
+ p->flags |= TERMP_NOSPACE;
+ p->offset += offs;
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
pre_TP(DECL_ARGS)
{
const struct man_node *nn;
@@ -335,7 +376,7 @@ post_SH(DECL_ARGS)
static void
print_node(DECL_ARGS)
{
- int c;
+ int c, sz;
c = 1;
@@ -345,11 +386,21 @@ print_node(DECL_ARGS)
c = (*termacts[n->tok].pre)(p, n, m);
break;
case(MAN_TEXT):
- if (*n->string) {
- term_word(p, n->string);
+ if (0 == *n->string) {
+ term_vspace(p);
break;
}
- term_vspace(p);
+ /*
+ * Note! This is hacky. Here, we recognise the `\c'
+ * escape embedded in so many -man pages. It's supposed
+ * to remove the subsequent space, so we mark NOSPACE if
+ * it's encountered in the string.
+ */
+ sz = (int)strlen(n->string);
+ term_word(p, n->string);
+ if (sz >= 2 && n->string[sz - 1] == 'c' &&
+ n->string[sz - 2] == '\\')
+ p->flags |= TERMP_NOSPACE;
break;
default:
break;
@@ -397,13 +448,6 @@ print_foot(struct termp *p, const struct man_meta *meta)
#endif
err(1, "strftime");
- /*
- * This is /slightly/ different from regular groff output
- * because we don't have page numbers. Print the following:
- *
- * OS MDOCDATE
- */
-
term_vspace(p);
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
@@ -441,19 +485,6 @@ print_head(struct termp *p, const struct man_meta *meta)
if (NULL == (title = malloc(p->rmargin)))
err(1, "malloc");
- /*
- * The header is strange. It has three components, which are
- * really two with the first duplicated. It goes like this:
- *
- * IDENTIFIER TITLE IDENTIFIER
- *
- * The IDENTIFIER is NAME(SECTION), which is the command-name
- * (if given, or "unknown" if not) followed by the manual page
- * section. These are given in `Dt'. The TITLE is a free-form
- * string depending on the manual volume. If not specified, it
- * switches on the manual section.
- */
-
if (meta->vol)
(void)strlcpy(buf, meta->vol, p->rmargin);
else
diff --git a/mandoc.1 b/mandoc.1
index 9a5d52f1..807d4045 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.1,v 1.9 2009/03/23 16:02:56 kristaps Exp $
+.\" $Id: mandoc.1,v 1.10 2009/03/26 16:23:22 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -16,7 +16,7 @@
.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 23 2009 $
+.Dd $Mdocdate: March 26 2009 $
.Dt mandoc 1
.Os
.\" SECTION
@@ -50,7 +50,7 @@ for details.
Input format. See
.Sx Input Formats
for available formats. Defaults to
-.Fl m Ns Ar mdoc .
+.Fl m Ns Ar doc .
.\" ITEM
.It Fl T
Output format. See
@@ -150,9 +150,9 @@ utility accepts
and
.Xr man 7
input with
-.Fl m Ns Ar mdoc
+.Fl m Ns Ar doc
and
-.Fl m Ns Ar man ,
+.Fl m Ns Ar an ,
respectively. The
.Xr mdoc 7
format is
@@ -160,11 +160,6 @@ format is
recommended;
.Xr man 7
should only be used for legacy manuals.
-.Pp
-Note that the
-.Fl m Ns Ar man
-option is experimental and only works with
-.Fl T Ns Ar tree .
.\" SUB-SECTION
.Ss Output Formats
The
@@ -232,7 +227,7 @@ mode doesn't yet know how to display the following:
.Bl -bullet -compact
.It
The \-hang
-.Sq \&Bl
+.Sq \&.Bl
list is not yet supported.
.El
.Pp
@@ -248,14 +243,14 @@ output and
.Bl -bullet -compact
.It
A list of display following
-.Sq \&Ss
+.Sq \&.Ss
does not assert a prior vertical break, just as it doesn't with
-.Sq \&Sh .
+.Sq \&.Sh .
.It
Special characters don't follow the current font style.
.\" LIST-ITEM
.It
The \-literal and \-unfilled
-.Sq \&Bd
+.Sq \&.Bd
displays types are synonyms, as are \-filled and \-ragged.
.El
diff --git a/mdoc.3 b/mdoc.3
index 31e86791..633a1fbf 100644
--- a/mdoc.3
+++ b/mdoc.3
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.3,v 1.23 2009/03/23 09:42:43 kristaps Exp $
+.\" $Id: mdoc.3,v 1.24 2009/03/26 16:23:22 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -16,7 +16,7 @@
.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 23 2009 $
+.Dd $Mdocdate: March 26 2009 $
.Dt mdoc 3
.Os
.\" SECTION
@@ -314,23 +314,23 @@ utility was written by
.\" LIST-ITEM
.It
The
-.Sq \&Xc
+.Sq \&.Xc
and
-.Sq \&Xo
+.Sq \&.Xo
macros aren't handled when used to span lines for the
-.Sq \&It
+.Sq \&.It
macro.
.\" LIST-ITEM
.It
The
-.Sq \&Bsx
+.Sq \&.Bsx
macro family doesn't yet understand version arguments.
.\" LIST-ITEM
.It
If not given a value, the \-offset argument to
-.Sq \&Bd
+.Sq \&.Bd
and
-.Sq \&Bl
+.Sq \&.Bl
should be the width of
.Qq <string> ;
instead, a value of
@@ -339,7 +339,7 @@ is provided.
.\" LIST-ITEM
.It
Columns widths in
-.Sq \&Bl \-column
+.Sq \&.Bl \-column
should default to width
.Qq <stringx>
if not included.
diff --git a/mdoc.7 b/mdoc.7
index 186a92af..11af24ad 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.15 2009/03/23 16:02:56 kristaps Exp $
+.\" $Id: mdoc.7,v 1.16 2009/03/26 16:23:22 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
.\"
@@ -16,7 +16,7 @@
.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 23 2009 $
+.Dd $Mdocdate: March 26 2009 $
.Dt mdoc 7
.Os
.\" SECTION
@@ -66,18 +66,18 @@ line termination.
.Pp
The only time a blank line is acceptable is within
the context of
-.Sq \&Bd \-literal
+.Sq \&.Bd \-literal
or
-.Sq \&Bd \-unfilled .
+.Sq \&.Bd \-unfilled .
.Pp
Tab characters
.Pq \et
are only acceptable when delimiting
-.Sq \&Bl \-column
+.Sq \&.Bl \-column
and in
-.Sq \&Bd \-literal
+.Sq \&.Bd \-literal
or
-.Sq \&Bd \-unfilled
+.Sq \&.Bd \-unfilled
contexts.
.\" SUB-SECTION
.Ss Reserved Characters
@@ -115,7 +115,7 @@ or, if applicable, an appropriate escape-sequence used.
.\" SUB-SECTION
.Ss Special Characters
Special character sequences begin with the escape character
-.Sq \\
+.Sq \e
followed by either an open-parenthesis
.Sq \&(
for two-character sequences; an open-bracket
@@ -125,421 +125,421 @@ for n-character sequences (terminated at a close-bracket
or a single one-character sequence.
.Pp
Characters may alternatively be escaped by a slash-asterisk,
-.Sq \\* ,
+.Sq \e* ,
with the same combinations as described above. This form is deprecated.
.Pp
The following is a table of all available escapes.
.Pp
Grammatic:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(em
+.It \e(em
.Pq em-dash
-.It \\(en
+.It \e(en
.Pq en-dash
.It \e-
.Pq hyphen
-.It \\\\
+.It \e\e
.Pq back-slash
.It \e'
.Pq apostrophe
.It \e`
.Pq back-tick
-.It \\
+.It \e
.Pq space
-.It \\.
+.It \e.
.Pq period
-.It \\(r!
+.It \e(r!
.Pq upside-down exclamation
-.It \\(r?
+.It \e(r?
.Pq upside-down question
.El
.\" PARAGRAPH
.Pp
Enclosures:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(lh
+.It \e(lh
.Pq left hand
-.It \\(rh
+.It \e(rh
.Pq right hand
-.It \\(Fo
+.It \e(Fo
.Pq left guillemet
-.It \\(Fc
+.It \e(Fc
.Pq right guillemet
-.It \\(fo
+.It \e(fo
.Pq left guilsing
-.It \\(fc
+.It \e(fc
.Pq right guilsing
-.It \\(rC
+.It \e(rC
.Pq right brace
-.It \\(lC
+.It \e(lC
.Pq left brace
-.It \\(ra
+.It \e(ra
.Pq right angle
-.It \\(la
+.It \e(la
.Pq left angle
-.It \\(rB
+.It \e(rB
.Pq right bracket
-.It \\(lB
+.It \e(lB
.Pq left bracket
-.It \\q
+.It \eq
.Pq double-quote
-.It \\(lq
+.It \e(lq
.Pq left double-quote
-.It \\(Lq
+.It \e(Lq
.Pq left double-quote, deprecated
-.It \\(rq
+.It \e(rq
.Pq right double-quote
-.It \\(Rq
+.It \e(Rq
.Pq right double-quote, deprecated
-.It \\(oq
+.It \e(oq
.Pq left single-quote
-.It \\(aq
+.It \e(aq
.Pq right single-quote
-.It \\(Bq
+.It \e(Bq
.Pq right low double-quote
-.It \\(bq
+.It \e(bq
.Pq right low single-quote
.El
.\" PARAGRAPH
.Pp
Indicatives:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(<-
+.It \e(<-
.Pq left arrow
-.It \\(->
+.It \e(->
.Pq right arrow
-.It \\(ua
+.It \e(ua
.Pq up arrow
-.It \\(da
+.It \e(da
.Pq down arrow
-.It \\(<>
+.It \e(<>
.Pq left-right arrow
-.It \\(lA
+.It \e(lA
.Pq left double-arrow
-.It \\(rA
+.It \e(rA
.Pq right double-arrow
-.It \\(uA
+.It \e(uA
.Pq up double-arrow
-.It \\(dA
+.It \e(dA
.Pq down double-arrow
-.It \\(hA
+.It \e(hA
.Pq left-right double-arrow
.El
.\" PARAGRAPH
.Pp
Mathematical:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(es
+.It \e(es
.Pq empty set
-.It \\(ca
+.It \e(ca
.Pq intersection
-.It \\(cu
+.It \e(cu
.Pq union
-.It \\(gr
+.It \e(gr
.Pq gradient
-.It \\(pd
+.It \e(pd
.Pq partial differential
-.It \\(ap
+.It \e(ap
.Pq similarity
-.It \\(=)
+.It \e(=)
.Pq proper superset
-.It \\((=
+.It \e((=
.Pq proper subset
-.It \\(eq
+.It \e(eq
.Pq equals
-.It \\(di
+.It \e(di
.Pq division
-.It \\(mu
+.It \e(mu
.Pq multiplication
-.It \\(pl
+.It \e(pl
.Pq addition
-.It \\(nm
+.It \e(nm
.Pq not element
-.It \\(mo
+.It \e(mo
.Pq element
-.It \\(Im
+.It \e(Im
.Pq imaginary
-.It \\(Re
+.It \e(Re
.Pq real
-.It \\(Ah
+.It \e(Ah
.Pq aleph
-.It \\(te
+.It \e(te
.Pq existential quantifier
-.It \\(fa
+.It \e(fa
.Pq universal quantifier
-.It \\(AN
+.It \e(AN
.Pq logical AND
-.It \\(OR
+.It \e(OR
.Pq logical OR
-.It \\(no
+.It \e(no
.Pq logical NOT
-.It \\(st
+.It \e(st
.Pq such that
-.It \\(tf
+.It \e(tf
.Pq therefore
-.It \\(~~
+.It \e(~~
.Pq approximate
-.It \\(~=
+.It \e(~=
.Pq approximately equals
-.It \\(=~
+.It \e(=~
.Pq congruent
-.It \\(Gt
+.It \e(Gt
.Pq greater-than, deprecated
-.It \\(Lt
+.It \e(Lt
.Pq less-than, deprecated
-.It \\(<=
+.It \e(<=
.Pq less-than-equal
-.It \\(Le
+.It \e(Le
.Pq less-than-equal, deprecated
-.It \\(>=
+.It \e(>=
.Pq greater-than-equal
-.It \\(Ge
+.It \e(Ge
.Pq greater-than-equal
-.It \\(==
+.It \e(==
.Pq equal
-.It \\(!=
+.It \e(!=
.Pq not equal
-.It \\(Ne
+.It \e(Ne
.Pq not equal, deprecated
-.It \\(if
+.It \e(if
.Pq infinity
-.It \\(If
+.It \e(If
.Pq infinity, deprecated
-.It \\(na
+.It \e(na
.Pq NaN , an extension
-.It \\(Na
+.It \e(Na
.Pq NaN, deprecated
-.It \\(+-
+.It \e(+-
.Pq plus-minus
-.It \\(Pm
+.It \e(Pm
.Pq plus-minus, deprecated
-.It \\(**
+.It \e(**
.Pq asterisk
.El
.\" PARAGRAPH
.Pp
Ligatures:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(ss
+.It \e(ss
.Pq German eszett
-.It \\(AE
+.It \e(AE
.Pq upper-case AE
-.It \\(ae
+.It \e(ae
.Pq lower-case AE
-.It \\(OE
+.It \e(OE
.Pq upper-case OE
-.It \\(oe
+.It \e(oe
.Pq lower-case OE
-.It \\(ff
+.It \e(ff
.Pq ff ligature
-.It \\(fi
+.It \e(fi
.Pq fi ligature
-.It \\(fl
+.It \e(fl
.Pq fl ligature
-.It \\(Fi
+.It \e(Fi
.Pq ffi ligature
-.It \\(Fl
+.It \e(Fl
.Pq ffl ligature
.El
.\" PARAGRAPH
.Pp
Diacritics and letters:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(ga
+.It \e(ga
.Pq grave accent
-.It \\(aa
+.It \e(aa
.Pq accute accent
-.It \\(a"
+.It \e(a"
.Pq umlaut accent
-.It \\(ad
+.It \e(ad
.Pq dieresis accent
-.It \\(a~
+.It \e(a~
.Pq tilde accent
-.It \\(a^
+.It \e(a^
.Pq circumflex accent
-.It \\(ac
+.It \e(ac
.Pq cedilla accent
-.It \\(ad
+.It \e(ad
.Pq dieresis accent
-.It \\(ah
+.It \e(ah
.Pq caron accent
-.It \\(ao
+.It \e(ao
.Pq ring accent
-.It \\(ho
+.It \e(ho
.Pq hook accent
-.It \\(ab
+.It \e(ab
.Pq breve accent
-.It \\(a-
+.It \e(a-
.Pq macron accent
-.It \\(-D
+.It \e(-D
.Pq upper-case eth
-.It \\(Sd
+.It \e(Sd
.Pq lower-case eth
-.It \\(TP
+.It \e(TP
.Pq upper-case thorn
-.It \\(Tp
+.It \e(Tp
.Pq lower-case thorn
-.It \\('A
+.It \e('A
.Pq upper-case acute A
-.It \\('E
+.It \e('E
.Pq upper-case acute E
-.It \\('I
+.It \e('I
.Pq upper-case acute I
-.It \\('O
+.It \e('O
.Pq upper-case acute O
-.It \\('U
+.It \e('U
.Pq upper-case acute U
-.It \\('a
+.It \e('a
.Pq lower-case acute a
-.It \\('e
+.It \e('e
.Pq lower-case acute e
-.It \\('i
+.It \e('i
.Pq lower-case acute i
-.It \\('o
+.It \e('o
.Pq lower-case acute o
-.It \\('u
+.It \e('u
.Pq lower-case acute u
-.It \\(`A
+.It \e(`A
.Pq upper-case grave A
-.It \\(`E
+.It \e(`E
.Pq upper-case grave E
-.It \\(`I
+.It \e(`I
.Pq upper-case grave I
-.It \\(`O
+.It \e(`O
.Pq upper-case grave O
-.It \\(`U
+.It \e(`U
.Pq upper-case grave U
-.It \\(`a
+.It \e(`a
.Pq lower-case grave a
-.It \\(`e
+.It \e(`e
.Pq lower-case grave e
-.It \\(`i
+.It \e(`i
.Pq lower-case grave i
-.It \\(`o
+.It \e(`o
.Pq lower-case grave o
-.It \\(`u
+.It \e(`u
.Pq lower-case grave u
-.It \\(~A
+.It \e(~A
.Pq upper-case tilde A
-.It \\(~N
+.It \e(~N
.Pq upper-case tilde N
-.It \\(~O
+.It \e(~O
.Pq upper-case tilde O
-.It \\(~a
+.It \e(~a
.Pq lower-case tilde a
-.It \\(~n
+.It \e(~n
.Pq lower-case tilde n
-.It \\(~o
+.It \e(~o
.Pq lower-case tilde o
-.It \\(:A
+.It \e(:A
.Pq upper-case dieresis A
-.It \\(:E
+.It \e(:E
.Pq upper-case dieresis E
-.It \\(:I
+.It \e(:I
.Pq upper-case dieresis I
-.It \\(:O
+.It \e(:O
.Pq upper-case dieresis O
-.It \\(:U
+.It \e(:U
.Pq upper-case dieresis U
-.It \\(:a
+.It \e(:a
.Pq lower-case dieresis a
-.It \\(:e
+.It \e(:e
.Pq lower-case dieresis e
-.It \\(:i
+.It \e(:i
.Pq lower-case dieresis i
-.It \\(:o
+.It \e(:o
.Pq lower-case dieresis o
-.It \\(:u
+.It \e(:u
.Pq lower-case dieresis u
-.It \\(:y
+.It \e(:y
.Pq lower-case dieresis y
-.It \\(^A
+.It \e(^A
.Pq upper-case circumflex A
-.It \\(^E
+.It \e(^E
.Pq upper-case circumflex E
-.It \\(^I
+.It \e(^I
.Pq upper-case circumflex I
-.It \\(^O
+.It \e(^O
.Pq upper-case circumflex O
-.It \\(^U
+.It \e(^U
.Pq upper-case circumflex U
-.It \\(^a
+.It \e(^a
.Pq lower-case circumflex a
-.It \\(^e
+.It \e(^e
.Pq lower-case circumflex e
-.It \\(^i
+.It \e(^i
.Pq lower-case circumflex i
-.It \\(^o
+.It \e(^o
.Pq lower-case circumflex o
-.It \\(^u
+.It \e(^u
.Pq lower-case circumflex u
-.It \\(,C
+.It \e(,C
.Pq upper-case cedilla C
-.It \\(,c
+.It \e(,c
.Pq lower-case cedilla c
-.It \\(/L
+.It \e(/L
.Pq upper-case stroke L
-.It \\(/l
+.It \e(/l
.Pq lower-case stroke l
-.It \\(/O
+.It \e(/O
.Pq upper-case stroke O
-.It \\(/o
+.It \e(/o
.Pq lower-case stroke o
-.It \\(oA
+.It \e(oA
.Pq upper-case ring A
-.It \\(oa
+.It \e(oa
.Pq lower-case ring a
.El
.\" PARAGRAPH
.Pp
Monetary:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(Cs
+.It \e(Cs
.Pq Scandinavian
-.It \\(Do
+.It \e(Do
.Pq dollar
-.It \\(Po
+.It \e(Po
.Pq pound
-.It \\(Ye
+.It \e(Ye
.Pq yen
-.It \\(Fn
+.It \e(Fn
.Pq florin
-.It \\(ct
+.It \e(ct
.Pq cent
.El
.\" PARAGRAPH
.Pp
Special symbols:
.Bl -tag -width 12n -offset "XXXX" -compact
-.It \\(de
+.It \e(de
.Pq degree
-.It \\(ps
+.It \e(ps
.Pq paragraph
-.It \\(sc
+.It \e(sc
.Pq section
-.It \\(dg
+.It \e(dg
.Pq dagger
-.It \\(dd
+.It \e(dd
.Pq double dagger
-.It \\(ci
+.It \e(ci
.Pq circle
-.It \\(ba
+.It \e(ba
.Pq bar
-.It \\(bb
+.It \e(bb
.Pq broken bar
-.It \\(Ba
+.It \e(Ba
.Pq bar, deprecated
-.It \\(co
+.It \e(co
.Pq copyright
-.It \\(rg
+.It \e(rg
.Pq registered
-.It \\(tm
+.It \e(tm
.Pq trademarked
-.It \\&
+.It \e&
.Pq non-breaking space
-.It \\e
+.It \ee
.Pq escape
-.It \\(Am
+.It \e(Am
.Pq ampersand, deprecated
.El
.\" SECTION
@@ -698,7 +698,7 @@ The head of these macros follows invocation; the body is the content of
subsequent lines prior to closure. None of these macros have tails;
some
.Po
-.Sq \&It \-bullet ,
+.Sq \&.It \-bullet ,
.Sq \-hyphen ,
.Sq \-dash ,
.Sq \-enum ,
@@ -751,26 +751,28 @@ close at the invocation's end-of-line.
.\" PARAGRAPH
.Pp
The
-.Sq \&Op
-may be broken by \&Oc as in the following example:
+.Sq \&.Op
+may be broken by
+.Sq \&.Oc
+as in the following example:
.Bd -literal -offset XXXX
\&.Oo
\&.Op Fl a Oc
.Ed
.Pp
In the above example, the scope of
-.Sq \&Op
+.Sq \&.Op
is technically broken by
-.Sq \&Oc ,
+.Sq \&.Oc ,
however, due to the overwhelming existence of this sequence, it's
allowed.
.\" SUB-SECTION
.Ss Block partial-explicit
Each of these contains at least a body and, in limited circumstances, a
head
-.Pq So \&Fo Sc , So \&Eo Sc
+.Pq So \&.Fo Sc , So \&.Eo Sc
and/or tail
-.Pq So \&Ec Sc .
+.Pq So \&.Ec Sc .
.Pp
.Bl -column "MacroX" "CallableX" "ParsableX" "closed by XXXX" -compact -offset XXXX
.It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
@@ -882,11 +884,11 @@ then the macro accepts an arbitrary number of arguments.
.El
.Pp
The
-.Sq \&Ot ,
-.Sq \&Fr ,
-.Sq \&Es
+.Sq \&.Ot ,
+.Sq \&.Fr ,
+.Sq \&.Es
and
-.Sq \&En ,
+.Sq \&.En ,
macros are obsolete.
.\" SECTION
.Sh COMPATIBILITY
@@ -899,47 +901,47 @@ compatibility with these systems.
.Bl -dash -compact
.\" LIST-ITEM
.It
-.Sq \&Fo
+.Sq \&.Fo
and
-.Sq \&St
+.Sq \&.St
historically weren't always callable. Both are now correctly callable.
.\" LIST-ITEM
.It
-.Sq \&It \-nested
+.Sq \&.It \-nested
is assumed for all lists: any list may be nested and
.Sq \-enum
lists will restart the sequence only for the sub-list.
.\" LIST-ITEM
.It
-.Sq \&It \-column
+.Sq \&.It \-column
syntax where column widths may be preceeded by other arguments (instead
of proceeded) is not supported.
.\" LIST-ITEM
.It
The
-.Sq \&At
+.Sq \&.At
macro only accepts a single parameter.
.\" LIST-ITEM
.It
The system-name macros (
-.Ns Sq \&At ,
-.Sq \&Bsx ,
-.Sq \&Bx ,
-.Sq \&Fx ,
-.Sq \&Nx ,
-.Sq \&Ox ,
+.Ns Sq \&.At ,
+.Sq \&.Bsx ,
+.Sq \&.Bx ,
+.Sq \&.Fx ,
+.Sq \&.Nx ,
+.Sq \&.Ox ,
and
-.Sq \&Ux )
+.Sq \&.Ux )
are callable.
.\" LIST-ITEM
.It
Some manuals use
-.Sq \&Li
+.Sq \&.Li
incorrectly by following it with a reserved character and expecting the
delimiter to render. This is not supported.
.\" LIST-ITEM
.It
-.Sq \&Cd
+.Sq \&.Cd
is callable.
.El
.\" SECTION
@@ -958,64 +960,64 @@ There are several ambiguous parts of mdoc.
.Bl -dash -compact
.\" LIST-ITEM
.It
-.Sq \&Fa
+.Sq \&.Fa
should be
-.Sq \&Va
+.Sq \&.Va
as function arguments are variables.
.\" LIST-ITEM
.It
-.Sq \&Ft
+.Sq \&.Ft
should be
-.Sq \&Vt
+.Sq \&.Vt
as function return types are still types. Furthermore, the
-.Sq \&Ft
+.Sq \&.Ft
should be removed and
-.Sq \&Fo ,
+.Sq \&.Fo ,
which ostensibly follows it, should follow the same convention as
-.Sq \&Va .
+.Sq \&.Va .
.\" LIST-ITEM
.It
-.Sq \&Va
+.Sq \&.Va
should formalise that only one or two arguments are acceptable: a
variable name and optional, preceeding type.
.\" LIST-ITEM
.It
-.Sq \&Fd
+.Sq \&.Fd
is ambiguous. It's commonly used to indicate an include file in the
synopsis section.
-.Sq \&In
+.Sq \&.In
should be used, instead.
.\" LIST-ITEM
.It
Only the
.Sq \-literal
argument to
-.Sq \&Bd
+.Sq \&.Bd
makes sense. The remaining ones should be removed.
.\" LIST-ITEM
.It
The
-.Sq \&Xo
+.Sq \&.Xo
and
-.Sq \&Xc
+.Sq \&.Xc
macros should be deprecated.
.\" LIST-ITEM
.It
The
-.Sq \&Dt
+.Sq \&.Dt
macro lacks clarity. It should be absolutely clear which title will
render when formatting the manual page.
.\" LIST-ITEM
.It
A
-.Sq \&Lx
+.Sq \&.Lx
should be provided for Linux (\(`a la
-.Sq \&Ox ,
-.Sq \&Nx
+.Sq \&.Ox ,
+.Sq \&.Nx
etc.).
.\" LIST-ITEM
.It
There's no way to refer to references in
-.Sq \&Rs/Re
+.Sq \&.Rs/.Re
blocks.
.El
diff --git a/mdoc_term.c b/mdoc_term.c
index ad0e3b2f..9b40a4ca 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.2 2009/03/26 14:44:41 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.3 2009/03/26 16:23:22 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@openbsd.org>
*
@@ -321,11 +321,11 @@ static int arg_listtype(const struct mdoc_node *);
static int fmt_block_vspace(struct termp *,
const struct mdoc_node *,
const struct mdoc_node *);
-static int print_node(DECL_ARGS);
-static int print_head(struct termp *,
+static void print_node(DECL_ARGS);
+static void print_head(struct termp *,
const struct mdoc_meta *);
-static int print_body(DECL_ARGS);
-static int print_foot(struct termp *,
+static void print_body(DECL_ARGS);
+static void print_foot(struct termp *,
const struct mdoc_meta *);
static void sanity(const struct mdoc_node *);
@@ -334,27 +334,25 @@ int
mdoc_run(struct termp *p, const struct mdoc *m)
{
- if ( ! print_head(p, mdoc_meta(m)))
- return(0);
- if ( ! print_body(p, NULL, mdoc_meta(m), mdoc_node(m)))
- return(0);
- return(print_foot(p, mdoc_meta(m)));
+ print_head(p, mdoc_meta(m));
+ print_body(p, NULL, mdoc_meta(m), mdoc_node(m));
+ print_foot(p, mdoc_meta(m));
+ return(1);
}
-static int
+static void
print_body(DECL_ARGS)
{
- if ( ! print_node(p, pair, meta, node))
- return(0);
+ print_node(p, pair, meta, node);
if ( ! node->next)
- return(1);
- return(print_body(p, pair, meta, node->next));
+ return;
+ print_body(p, pair, meta, node->next);
}
-static int
+static void
print_node(DECL_ARGS)
{
int dochild;
@@ -396,12 +394,10 @@ print_node(DECL_ARGS)
if (MDOC_TEXT != node->type)
if (termacts[node->tok].post)
(*termacts[node->tok].post)(p, &npair, meta, node);
-
- return(1);
}
-static int
+static void
print_foot(struct termp *p, const struct mdoc_meta *meta)
{
struct tm *tm;
@@ -449,12 +445,10 @@ print_foot(struct termp *p, const struct mdoc_meta *meta)
free(buf);
free(os);
-
- return(1);
}
-static int
+static void
print_head(struct termp *p, const struct mdoc_meta *meta)
{
char *buf, *title;
@@ -520,8 +514,6 @@ print_head(struct termp *p, const struct mdoc_meta *meta)
free(title);
free(buf);
-
- return(1);
}