* mdocml: Fix to make horizontal spanners in the layout be properly
@ 2011-01-04 12:06 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-01-04 12:06 UTC (permalink / raw)
To: source
Log Message:
-----------
Fix to make horizontal spanners in the layout be properly printed.
mandoc also now warns (so does tbl(1)) if a horizontal spanner is
specified along with data.
While here, fix up some documentation and uncomment the tbl reference.
Modified Files:
--------------
mdocml:
main.c
mandoc.h
roff.7
tbl_data.c
tbl_term.c
Revision Data
-------------
Index: tbl_data.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_data.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.9 -r1.10
--- tbl_data.c
+++ tbl_data.c
@@ -82,6 +82,11 @@ data(struct tbl_node *tbl, struct tbl_sp
dat->pos = TBL_DATA_NDHORIZ;
else
dat->pos = TBL_DATA_DATA;
+
+ if (TBL_CELL_HORIZ == dat->layout->pos ||
+ TBL_CELL_DHORIZ == dat->layout->pos)
+ if (TBL_DATA_DATA == dat->pos && '\0' != *dat->string)
+ TBL_MSG(tbl, MANDOCERR_TBLIGNDATA, ln, sv);
}
int
Index: roff.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.7,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lroff.7 -Lroff.7 -u -p -r1.20 -r1.21
--- roff.7
+++ roff.7
@@ -681,34 +681,61 @@ This option is not supported by
This option is not supported by
.Xr mandoc 1 .
.It Cm \-
+Replace the data cell (its contents will be lost) with a single
+horizontal line.
This may also be invoked with
.Cm _ .
.It Cm =
+Replace the data cell (its contents will be lost) with a double
+horizontal line.
.It Cm \(ba
Emit a vertical bar instead of data.
.It Cm \(ba\(ba
Emit a double-vertical bar instead of data.
.El
.Pp
+For example, following layout specifies a centre-justified column of
+minimum width 10, followed by vertical bar, followed by a left-justified
+column of minimum width 10, another vertical bar, then a column
+justified about the decimal point in numbers:
+.Pp
+.Dl c10 | l10 | n
+.Pp
Keys may be followed by a set of modifiers.
A modifier is either a modifier key or a natural number for specifying
spacing.
The following case-insensitive modifier keys are available:
-.Bl -tag -width Ds
-.It Cm z
-.It Cm u
-.It Cm e
-.It Cm t
-.It Cm d
-.It Cm f
-Must be followed by a case-insensitive font style:
-.Cm b
-for bold or
-.Cm i
-for italic.
-.It Cm b
-.It Cm i
-.El
+.Cm z ,
+.Cm u ,
+.Cm e ,
+.Cm t ,
+.Cm d ,
+.Cm f ,
+.Cm b ,
+.Cm i ,
+.Cm b ,
+and
+.Cm i .
+All of these are ignored by
+.Xr mandoc 1 .
+.Pp
+The data section follows the last layout row.
+By default, cells in a data section are delimited by a tab.
+This behaviour may be changed with the
+.Cm tab
+option.
+If
+.Cm _
+or
+.Cm =
+is specified, a single or double line, respectively, is drawn across the
+data field.
+If
+.Cm \e-
+or
+.Cm \e=
+is specified, a line is drawn within the data field (i.e., terminating
+within the cell and not draw to the border).
.Sh COMPATIBILITY
This section documents compatibility between mandoc and other other
.Nm
@@ -740,12 +767,12 @@ using the next-line syntax.
.Xr man 7 ,
.Xr mandoc_char 7 ,
.Xr mdoc 7
-.\" .Rs
-.\" .%A M. E. Lesk
-.\" .%T Tbl\(emA Program to Format Tables
-.\" .%D June 11, 1976
-.\" .%U http://www.kohala.com/start/troff/v7/man/tbl/tbl.ps
-.\" .Re
+.Rs
+.%A M. E. Lesk
+.%T Tbl\(emA Program to Format Tables
+.%D June 11, 1976
+.%U http://www.kohala.com/start/troff/v7/man/tbl/tbl.ps
+.Re
.Rs
.%A Joseph F. Ossanna
.%A Brian W. Kernighan
Index: tbl_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_term.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.6 -r1.7
--- tbl_term.c
+++ tbl_term.c
@@ -40,9 +40,6 @@ static void tbl_data_number(struct ter
static void tbl_data_literal(struct termp *,
const struct tbl_dat *,
const struct termp_tbl *);
-static void tbl_data_spanner(struct termp *,
- const struct tbl_dat *,
- const struct termp_tbl *);
static void tbl_data(struct termp *, const struct tbl *,
const struct tbl_dat *,
const struct termp_tbl *);
@@ -261,8 +258,13 @@ tbl_data(struct termp *tp, const struct
switch (dp->pos) {
case (TBL_DATA_HORIZ):
/* FALLTHROUGH */
+ case (TBL_DATA_NHORIZ):
+ tbl_char(tp, '-', tbp->width);
+ return;
+ case (TBL_DATA_NDHORIZ):
+ /* FALLTHROUGH */
case (TBL_DATA_DHORIZ):
- tbl_data_spanner(tp, dp, tbp);
+ tbl_char(tp, '=', tbp->width);
return;
default:
break;
@@ -272,10 +274,10 @@ tbl_data(struct termp *tp, const struct
switch (pos) {
case (TBL_CELL_HORIZ):
- /* FALLTHROUGH */
+ tbl_char(tp, '-', tbp->width);
+ break;
case (TBL_CELL_DHORIZ):
- /* FIXME: THIS IS WRONG. */
- tbl_data_spanner(tp, dp, tbp);
+ tbl_char(tp, '=', tbp->width);
break;
case (TBL_CELL_LONG):
/* FALLTHROUGH */
@@ -319,7 +321,6 @@ tbl_vframe(struct termp *tp, const struc
term_word(tp, "|");
}
-
static inline void
tbl_char(struct termp *tp, char c, int len)
{
@@ -333,26 +334,6 @@ tbl_char(struct termp *tp, char c, int l
for (i = 0; i < len; i += sz)
term_word(tp, cp);
-}
-
-static void
-tbl_data_spanner(struct termp *tp,
- const struct tbl_dat *dp,
- const struct termp_tbl *tblp)
-{
-
- switch (dp->pos) {
- case (TBL_DATA_HORIZ):
- case (TBL_DATA_NHORIZ):
- tbl_char(tp, '-', tblp->width);
- break;
- case (TBL_DATA_DHORIZ):
- case (TBL_DATA_NDHORIZ):
- tbl_char(tp, '=', tblp->width);
- break;
- default:
- break;
- }
}
static void
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -Lmandoc.h -Lmandoc.h -u -p -r1.46 -r1.47
--- mandoc.h
+++ mandoc.h
@@ -111,6 +111,7 @@ enum mandocerr {
MANDOCERR_TBLLAYOUT, /* bad table layout */
MANDOCERR_TBLNOLAYOUT, /* no table layout cells specified */
MANDOCERR_TBLNODATA, /* no table data cells specified */
+ MANDOCERR_TBLIGNDATA, /* ignore data in cell */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
MANDOCERR_BADCHAR, /* skipping bad character */
Index: main.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -Lmain.c -Lmain.c -u -p -r1.133 -r1.134
--- main.c
+++ main.c
@@ -189,6 +189,8 @@ static const char * const mandocerrs[MAN
"bad table layout",
"no table layout cells specified",
"no table data cells specified",
+ "ignore data in cell",
+
"input stack limit exceeded, infinite loop?",
"skipping bad character",
"skipping text before the first section header",
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-04 12:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-04 12:06 mdocml: Fix to make horizontal spanners in the layout be properly kristaps
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).