diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-03-02 00:13:58 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-03-02 00:13:58 +0000 |
commit | 56342f8fd286788a0d8a3cb303eb2e462abdce6f (patch) | |
tree | dd0d3d1a770a82d846c9fd5a661b88bd25d943dc | |
parent | 69e26d6eaf0e15c89509d539c529b0e02f715d7c (diff) |
Distinguish opening and closing delimiters, and close out block
macros after closing delimiters only, not after opening ones. Besides,
neither roff nor old nor new groff consider braces { } as delimiters.
This fixes some frequent misrenderings by mandoc,
for example ".Ql (" being rendered as "`'(" instead of "`('".
-rw-r--r-- | usr.bin/mandoc/mdoc_argv.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_strings.c | 16 |
3 files changed, 11 insertions, 15 deletions
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c index 0b4f4c7c918..c1aac1c1c86 100644 --- a/usr.bin/mandoc/mdoc_argv.c +++ b/usr.bin/mandoc/mdoc_argv.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_argv.c,v 1.19 2009/12/22 23:58:00 schwarze Exp $ */ +/* $Id: mdoc_argv.c,v 1.20 2010/03/02 00:13:57 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -397,9 +397,9 @@ args(struct mdoc *m, int line, int *pos, * follows the pattern of [[::delim::][ ]+]+. */ - if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos])) { + if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos]) > 1) { for (i = *pos; buf[i]; ) { - if ( ! mdoc_iscdelim(buf[i])) + if ( mdoc_iscdelim(buf[i]) < 2) break; i++; if (0 == buf[i] || ' ' != buf[i]) diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 210ecfd9534..b0c04c55387 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.29 2010/02/26 12:12:24 schwarze Exp $ */ +/* $Id: mdoc_macro.c,v 1.30 2010/03/02 00:13:57 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -1155,7 +1155,7 @@ blk_part_exp(MACRO_PROT_ARGS) break; } - if ( ! flushed && mdoc_isdelim(p)) { + if ( ! flushed && mdoc_isdelim(p) > 1) { if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos)) return(0); flushed = 1; diff --git a/usr.bin/mandoc/mdoc_strings.c b/usr.bin/mandoc/mdoc_strings.c index d3ac448a797..e65b648dfba 100644 --- a/usr.bin/mandoc/mdoc_strings.c +++ b/usr.bin/mandoc/mdoc_strings.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_strings.c,v 1.12 2009/12/23 22:30:17 schwarze Exp $ */ +/* $Id: mdoc_strings.c,v 1.13 2010/03/02 00:13:57 schwarze Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se> * @@ -64,6 +64,10 @@ mdoc_iscdelim(char p) switch (p) { case('|'): /* FALLTHROUGH */ + case('('): + /* FALLTHROUGH */ + case('['): + return(1); case('.'): /* FALLTHROUGH */ case(','): @@ -76,18 +80,10 @@ mdoc_iscdelim(char p) /* FALLTHROUGH */ case('!'): /* FALLTHROUGH */ - case('('): - /* FALLTHROUGH */ case(')'): /* FALLTHROUGH */ - case('['): - /* FALLTHROUGH */ case(']'): - /* FALLTHROUGH */ - case('{'): - /* FALLTHROUGH */ - case('}'): - return(1); + return(2); default: break; } |