aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-05-27 18:02:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-05-27 18:02:49 +0000
commit649dab7767736385ee7f2c1b882372a9de74ddfb (patch)
tree25950a5591c8cde313a23b4e2ed4e8b55cc3eee8
parent20fbc591274e3bc709ff1f06d4618f8429b49096 (diff)
downloadmandoc-649dab7767736385ee7f2c1b882372a9de74ddfb.tar.gz
mandoc-649dab7767736385ee7f2c1b882372a9de74ddfb.tar.zst
mandoc-649dab7767736385ee7f2c1b882372a9de74ddfb.zip
Fix the vertical spacing around tbl(7) instances in man(7).
Groff forces the document author to manually request sufficient spacing after .TE - that is, at least .sp 1v after a table with the "box" option and at least .sp 2v after a table with the "doublebox" option - or else it clobbers the box. I consider that insane, so i'm not imitating groff in that respect. Instead, i add at least as much vertical space as groff, or more where required to avoid clobbering the box. Consequently, output will be identical for input that looks sane with groff, and mandoc will make output look better for input that looks bad with groff. "Please check them in and I'll look into them later!" kristaps@
-rw-r--r--tbl_term.c10
-rw-r--r--term.c9
-rw-r--r--term.h3
3 files changed, 15 insertions, 7 deletions
diff --git a/tbl_term.c b/tbl_term.c
index 64107fb7..9f399d0c 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_term.c,v 1.23 2012/05/27 17:59:23 schwarze Exp $ */
+/* $Id: tbl_term.c,v 1.24 2012/05/27 18:02:49 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -171,10 +171,14 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
if (TBL_SPAN_LAST & sp->flags) {
if (TBL_OPT_DBOX & sp->tbl->opts ||
- TBL_OPT_BOX & sp->tbl->opts)
+ TBL_OPT_BOX & sp->tbl->opts) {
tbl_hframe(tp, sp, 0);
- if (TBL_OPT_DBOX & sp->tbl->opts)
+ tp->skipvsp = 1;
+ }
+ if (TBL_OPT_DBOX & sp->tbl->opts) {
tbl_hframe(tp, sp, 1);
+ tp->skipvsp = 2;
+ }
assert(tp->tbl.cols);
free(tp->tbl.cols);
tp->tbl.cols = NULL;
diff --git a/term.c b/term.c
index 4ca15ed6..3dadb7e4 100644
--- a/term.c
+++ b/term.c
@@ -1,7 +1,7 @@
-/* $Id: term.c,v 1.201 2011/09/21 09:57:13 schwarze Exp $ */
+/* $Id: term.c,v 1.202 2012/05/27 18:02:49 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -316,7 +316,10 @@ term_vspace(struct termp *p)
term_newln(p);
p->viscol = 0;
- (*p->endline)(p);
+ if (0 < p->skipvsp)
+ p->skipvsp--;
+ else
+ (*p->endline)(p);
}
void
diff --git a/term.h b/term.h
index 56d076e5..1745a341 100644
--- a/term.h
+++ b/term.h
@@ -1,4 +1,4 @@
-/* $Id: term.h,v 1.90 2011/12/04 23:10:52 schwarze Exp $ */
+/* $Id: term.h,v 1.91 2012/05/27 18:02:49 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -63,6 +63,7 @@ struct termp {
int col; /* Bytes in buf. */
size_t viscol; /* Chars on current line. */
int overstep; /* See termp_flushln(). */
+ int skipvsp; /* Vertical space to skip. */
int flags;
#define TERMP_SENTENCE (1 << 1) /* Space before a sentence. */
#define TERMP_NOSPACE (1 << 2) /* No space before words. */