diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-28 23:26:25 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-03-28 23:26:25 +0000 |
commit | 1f5b9d128ee296272c97a8e1a191d09c75b10fd1 (patch) | |
tree | b9f54fc16573c2cb8d4c6e72a6a8d5ee41bfae15 /tbl_layout.c | |
parent | 3807ee23c5f7bfedf0aeb8a013b458325092265b (diff) | |
download | mandoc-1f5b9d128ee296272c97a8e1a191d09c75b10fd1.tar.gz |
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).
Diffstat (limited to 'tbl_layout.c')
-rw-r--r-- | tbl_layout.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tbl_layout.c b/tbl_layout.c index 835ea613..999207a4 100644 --- a/tbl_layout.c +++ b/tbl_layout.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2012, 2014 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 @@ -100,6 +100,8 @@ mod: case (','): /* FALLTHROUGH */ case ('.'): + /* FALLTHROUGH */ + case ('|'): return(1); default: break; @@ -218,6 +220,13 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, 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', ...). */ for (i = 0; i < KEYS_MAX; i++) |