From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s2SNQQEm018819 for ; Fri, 28 Mar 2014 19:26:26 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s2SNQPMH018082; Fri, 28 Mar 2014 19:26:25 -0400 (EDT) Date: Fri, 28 Mar 2014 19:26:25 -0400 (EDT) Message-Id: <201403282326.s2SNQPMH018082@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Allow leading and trailing vertical lines, and format them in X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-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 source+unsubscribe@mdocml.bsd.lv