From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout.scc.kit.edu (mailout.scc.kit.edu [129.13.185.202]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s2SNbZdm030777 for ; Fri, 28 Mar 2014 19:37:35 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by scc-mailout-02.scc.kit.edu with esmtp (Exim 4.72 #1) id 1WTgL7-0008Ih-Av; Sat, 29 Mar 2014 00:37:33 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1WTgL7-0003TQ-7h; Sat, 29 Mar 2014 00:37:33 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1WTgL7-0005Ir-9o; Sat, 29 Mar 2014 00:37:33 +0100 Received: from schwarze by usta.de with local (Exim 4.77) (envelope-from ) id 1WTgL7-0003MY-3i; Sat, 29 Mar 2014 00:37:33 +0100 Date: Sat, 29 Mar 2014 00:37:32 +0100 From: Ingo Schwarze To: "Anthony J. Bentley" Cc: discuss@mdocml.bsd.lv Subject: Re: tbl(7) text blocks Message-ID: <20140328233732.GC10236@iris.usta.de> References: <20314.1395991264@cathet.us> <20140328213059.GB10236@iris.usta.de> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140328213059.GB10236@iris.usta.de> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Anthony, Ingo Schwarze wrote on Fri, Mar 28, 2014 at 10:30:59PM +0100: > Anthony J. Bentley wrote on Fri, Mar 28, 2014 at 01:21:04AM -0600: >> .TS >> center; >> |l|l|. > Hum. What mandoc doesn't seem to support is leading vertical lines > (ignored, see tbl_term.c, term_tbl(), > if (NULL != hp->prev) tbl_vrule(tp, hp); ) > and trailing vertical lines > (errors out, see tbl_layout.c, cell() handles '|' at the beginning, > but not at the end). That was easier than i thought. I have committed the following patch to both OpenBSD and bsd.lv. It would be nice if you could cd /usr/src/usr.bin/mandoc; cvs up -dP; make obj; make depend; make; sudo make install and look whether the page now formats better for you. Yours, Ingo ----- 8< ----- schnipp ----- >8 ----- 8< ----- schnapp ----- >8 ----- Log Message: ----------- Allow leading and trailing vertical lines, and format them in the same way as groff. While here, do not require whitespace before vertical lines in layout specifications. Issues found by bentley@ in mpv(1). Modified Files: -------------- mdocml: mandoc.h tbl_layout.c tbl_term.c Revision Data ------------- Index: tbl_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_term.c,v retrieving revision 1.25 retrieving revision 1.26 diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.25 -r1.26 --- tbl_term.c +++ tbl_term.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons - * Copyright (c) 2011, 2012 Ingo Schwarze + * Copyright (c) 2011, 2012, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -105,7 +105,8 @@ term_tbl(struct termp *tp, const struct /* Vertical frame at the start of each row. */ - if (TBL_OPT_BOX & sp->opts->opts || TBL_OPT_DBOX & sp->opts->opts) + if ((TBL_OPT_BOX | TBL_OPT_DBOX) & sp->opts->opts || + sp->head->vert) term_word(tp, TBL_SPAN_HORIZ == sp->pos || TBL_SPAN_DHORIZ == sp->pos ? "+" : "|"); @@ -159,7 +160,8 @@ term_tbl(struct termp *tp, const struct /* Vertical frame at the end of each row. */ - if (TBL_OPT_BOX & sp->opts->opts || TBL_OPT_DBOX & sp->opts->opts) + if ((TBL_OPT_BOX | TBL_OPT_DBOX) & sp->opts->opts || + sp->layout->vert) term_word(tp, TBL_SPAN_HORIZ == sp->pos || TBL_SPAN_DHORIZ == sp->pos ? "+" : " |"); term_flushln(tp); Index: tbl_layout.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_layout.c,v retrieving revision 1.24 retrieving revision 1.25 diff -Ltbl_layout.c -Ltbl_layout.c -u -p -r1.24 -r1.25 --- tbl_layout.c +++ tbl_layout.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2012 Ingo Schwarze + * Copyright (c) 2012, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -100,6 +100,8 @@ mod: case (','): /* FALLTHROUGH */ case ('.'): + /* FALLTHROUGH */ + case ('|'): return(1); default: break; @@ -217,6 +219,13 @@ cell(struct tbl_node *tbl, struct tbl_ro vert++; while (' ' == p[*pos]) (*pos)++; + + /* Handle trailing vertical lines */ + + if ('.' == p[*pos] || '\0' == p[*pos]) { + rp->vert = vert; + return(1); + } /* Parse the column position (`c', `l', `r', ...). */ Index: mandoc.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v retrieving revision 1.118 retrieving revision 1.119 diff -Lmandoc.h -Lmandoc.h -u -p -r1.118 -r1.119 --- mandoc.h +++ mandoc.h @@ -240,6 +240,7 @@ struct tbl_row { struct tbl_row *next; struct tbl_cell *first; struct tbl_cell *last; + int vert; /* trailing vertical line */ }; enum tbl_datt { -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv