diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/html.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/html.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/man_html.c | 15 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 9 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/term.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/term.h | 3 |
8 files changed, 25 insertions, 26 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 14ead7751e9..a4202939bc0 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.52 2014/12/01 04:32:34 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.53 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -560,8 +560,9 @@ print_text(struct html *h, const char *word) if ( ! print_encode(h, word, 0)) { if ( ! (h->flags & HTML_NONOSPACE)) h->flags &= ~HTML_NOSPACE; + h->flags &= ~HTML_NONEWLINE; } else - h->flags |= HTML_NOSPACE; + h->flags |= HTML_NOSPACE | HTML_NONEWLINE; if (h->metaf) { print_tagq(h, h->metaf); diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h index 90a9da18de3..3a340fb805f 100644 --- a/usr.bin/mandoc/html.h +++ b/usr.bin/mandoc/html.h @@ -1,4 +1,4 @@ -/* $OpenBSD: html.h,v 1.31 2014/12/01 08:05:02 schwarze Exp $ */ +/* $OpenBSD: html.h,v 1.32 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -126,6 +126,7 @@ struct html { #define HTML_SKIPCHAR (1 << 6) /* skip the next character */ #define HTML_NOSPLIT (1 << 7) /* do not break line before .An */ #define HTML_SPLIT (1 << 8) /* break line before .An */ +#define HTML_NONEWLINE (1 << 9) /* No line break in nofill mode. */ struct tagq tags; /* stack of open tags */ struct rofftbl tbl; /* current table */ struct tag *tblt; /* current open table scope */ diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index bba6f68ebc4..cde34a999c3 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.58 2014/12/01 08:05:02 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.59 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -210,21 +210,14 @@ print_man_node(MAN_ARGS) man_root_pre(man, n, mh, h); break; case MAN_TEXT: - /* - * If we have a blank line, output a vertical space. - * If we have a space as the first character, break - * before printing the line's data. - */ if ('\0' == *n->string) { print_paragraph(h); return; } - - if (' ' == *n->string && MAN_LINE & n->flags) + if (n->flags & MAN_LINE && (*n->string == ' ' || + (n->prev != NULL && mh->fl & MANH_LITERAL && + ! (h->flags & HTML_NONEWLINE)))) print_otag(h, TAG_BR, 0, NULL); - else if (MANH_LITERAL & mh->fl && n->prev) - print_otag(h, TAG_BR, 0, NULL); - print_text(h, n->string); return; case MAN_EQN: diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 19f17b975c1..8b7ea97cb1d 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.109 2014/11/21 01:52:44 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.110 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -1016,13 +1016,14 @@ out: * -man doesn't have nested macros, we don't need to be * more specific than this. */ - if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) && - (NULL == n->next || MAN_LINE & n->next->flags)) { + if (mt->fl & MANT_LITERAL && + ! (p->flags & (TERMP_NOBREAK | TERMP_NONEWLINE)) && + (n->next == NULL || n->next->flags & MAN_LINE)) { rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN; p->flags |= TERMP_NOSPACE; - if (NULL != n->string && '\0' != *n->string) + if (n->string != NULL && *n->string != '\0') term_flushln(p); else term_newln(p); diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 037c01d0f69..1b95dc47e92 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.90 2014/12/01 08:05:02 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.91 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -1199,7 +1199,8 @@ mdoc_bd_pre(MDOC_ARGS) default: break; } - if (nn->next && nn->next->line == nn->line) + if (h->flags & HTML_NONEWLINE || + (nn->next && ! (nn->next->flags & MDOC_LINE))) continue; else if (nn->next) print_text(h, "\n"); diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 57ac0f5522f..29f604d89f5 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.197 2014/11/30 05:28:00 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.198 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -1630,7 +1630,8 @@ termp_bd_pre(DECL_ARGS) default: break; } - if (nn->next && nn->next->line == nn->line) + if (p->flags & TERMP_NONEWLINE || + (nn->next && ! (nn->next->flags & MDOC_LINE))) continue; term_flushln(p); p->flags |= TERMP_NOSPACE; diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index 39d5e8ebd62..5172d4b84ca 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term.c,v 1.96 2014/11/21 01:52:45 schwarze Exp $ */ +/* $OpenBSD: term.c,v 1.97 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -415,7 +415,7 @@ term_word(struct termp *p, const char *word) else p->flags |= TERMP_NOSPACE; - p->flags &= ~TERMP_SENTENCE; + p->flags &= ~(TERMP_SENTENCE | TERMP_NONEWLINE); while ('\0' != *word) { if ('\\' != *word) { @@ -485,7 +485,7 @@ term_word(struct termp *p, const char *word) if (TERMP_SKIPCHAR & p->flags) p->flags &= ~TERMP_SKIPCHAR; else if ('\0' == *word) - p->flags |= TERMP_NOSPACE; + p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE); continue; case ESCAPE_SKIPCHAR: p->flags |= TERMP_SKIPCHAR; diff --git a/usr.bin/mandoc/term.h b/usr.bin/mandoc/term.h index add887697c3..3c09886acbe 100644 --- a/usr.bin/mandoc/term.h +++ b/usr.bin/mandoc/term.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term.h,v 1.51 2014/12/01 08:05:02 schwarze Exp $ */ +/* $OpenBSD: term.h,v 1.52 2014/12/02 10:07:17 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -79,6 +79,7 @@ struct termp { #define TERMP_HANG (1 << 11) /* See term_flushln(). */ #define TERMP_NOSPLIT (1 << 12) /* Do not break line before .An. */ #define TERMP_SPLIT (1 << 13) /* Break line before .An. */ +#define TERMP_NONEWLINE (1 << 14) /* No line break in nofill mode. */ int *buf; /* Output buffer. */ enum termenc enc; /* Type of encoding. */ const struct mchars *symtab; /* Character table. */ |