-/* $Id: man.c,v 1.183 2018/12/31 04:55:46 schwarze Exp $ */
+/* $Id: man.c,v 1.187 2019/01/05 00:36:50 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
}
if ( ! (man->flags & MAN_BLINE))
return;
- man->flags &= ~MAN_BLINE;
man_unscope(man, man->last->parent);
roff_body_alloc(man, line, offs, man->last->tok);
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
}
static int
int i;
char *ep;
- /* Literal free-form text whitespace is preserved. */
+ /* In no-fill mode, whitespace is preserved on text lines. */
- if (man->flags & MAN_LITERAL) {
+ if (man->flags & ROFF_NOFILL) {
roff_word_alloc(man, line, offs, buf + offs);
man_descope(man, line, offs, buf + offs);
return 1;
man_macro(tok)->flags & MAN_NSCOPED)
return 1;
- man->flags &= ~MAN_BLINE;
man_unscope(man, man->last->parent);
roff_body_alloc(man, ln, ppos, man->last->tok);
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
return 1;
}
*/
if (man->flags & MAN_BLINE &&
- (tok == MAN_nf || tok == MAN_fi) &&
+ (tok == ROFF_nf || tok == ROFF_fi) &&
(man->last->tok == MAN_SH || man->last->tok == MAN_SS)) {
n = man->last;
man_unscope(man, n);
roff_body_alloc(man, n->line, n->pos, n->tok);
- man->flags &= ~MAN_BLINE;
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
}
/*
* Delete the block that is being broken.
*/
- if (man->flags & MAN_BLINE && (tok < MAN_TH ||
- man_macro(tok)->flags & MAN_XSCOPE)) {
+ if (man->flags & MAN_BLINE && tok != ROFF_nf && tok != ROFF_fi &&
+ (tok < MAN_TH || man_macro(tok)->flags & MAN_XSCOPE)) {
n = man->last;
if (n->type == ROFFT_TEXT)
n = n->parent;
"%s breaks %s", roff_name[tok], roff_name[n->tok]);
roff_node_delete(man, n);
- man->flags &= ~MAN_BLINE;
+ man->flags &= ~(MAN_BLINE | ROFF_NONOFILL);
}
}
-
-void
-man_state(struct roff_man *man, struct roff_node *n)
-{
-
- switch(n->tok) {
- case MAN_nf:
- case MAN_EX:
- if (man->flags & MAN_LITERAL && ! (n->flags & NODE_VALID))
- mandoc_msg(MANDOCERR_NF_SKIP, n->line, n->pos, "nf");
- man->flags |= MAN_LITERAL;
- break;
- case MAN_fi:
- case MAN_EE:
- if ( ! (man->flags & MAN_LITERAL) &&
- ! (n->flags & NODE_VALID))
- mandoc_msg(MANDOCERR_FI_SKIP, n->line, n->pos, "fi");
- man->flags &= ~MAN_LITERAL;
- break;
- default:
- break;
- }
- man->last->flags |= NODE_VALID;
-}