diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-01-22 20:58:36 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-01-22 20:58:36 +0000 |
commit | 3351a6d53212c73f2ac46179b1feb1a8996dce7a (patch) | |
tree | f046f5290fcf75e5007f048424e1e03ec1f646b9 /usr.bin/mandoc/html.c | |
parent | c9e4c585247a34314a6295f462a612b92047bc8d (diff) |
Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual
and also supported by groff.
Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.
Diffstat (limited to 'usr.bin/mandoc/html.c')
-rw-r--r-- | usr.bin/mandoc/html.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 5b080a48dc5..ea13cca9d91 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,7 +1,7 @@ -/* $Id: html.c,v 1.32 2014/01/05 21:21:08 schwarze Exp $ */ +/* $Id: html.c,v 1.33 2014/01/22 20:58:35 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011, 2012, 2013, 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 @@ -327,7 +327,8 @@ print_encode(struct html *h, const char *p, int norecurse) int c, len, nospace; const char *seq; enum mandoc_esc esc; - static const char rejs[6] = { '\\', '<', '>', '&', ASCII_HYPH, '\0' }; + static const char rejs[8] = { '\\', '<', '>', '&', + ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' }; nospace = 0; @@ -356,8 +357,13 @@ print_encode(struct html *h, const char *p, int norecurse) case ('&'): printf("&"); continue; + case (ASCII_NBRSP): + putchar('-'); + continue; case (ASCII_HYPH): putchar('-'); + /* FALLTHROUGH */ + case (ASCII_BREAK): continue; default: break; |