-# $OpenBSD: Makefile,v 1.26 2014/11/10 21:54:29 schwarze Exp $
+# $OpenBSD: Makefile,v 1.27 2014/12/20 02:26:42 schwarze Exp $
REGRESS_TARGETS = item inset diag ohang bullet dash enum hang tag
REGRESS_TARGETS += column extend nested offset secstart
REGRESS_TARGETS += notype multitype badargs
REGRESS_TARGETS += empty noIt emptyhead emptytag emptyitem multitag
-REGRESS_TARGETS += bareIt bareTa unclosed break broken
+REGRESS_TARGETS += bareIt bareTa unclosed break breakingIt broken
LINT_TARGETS = column notype badargs
LINT_TARGETS += noIt emptyhead emptytag emptyitem
-LINT_TARGETS += bareIt bareTa break broken
+LINT_TARGETS += bareIt bareTa break breakingIt broken
-# groff-1.22.2 defects:
+# groff-1.22.3 defects:
# - lists with missing or late type ruin indentation
# - empty lists ruin indentation and sometimes cause empty lines
# - breaking lists continue indefinitely
+# - breaking items sometimes ruin indentation, sometimes abort processing
# - breaking a list aborts processing
# - empty -tag item heads lose the blank line and the indentation
-SKIP_GROFF ?= notype empty break broken emptytag
+SKIP_GROFF ?= notype empty break breakingIt broken emptytag
SKIP_TMAN ?= column multitype multitag bareTa break broken
--- /dev/null
+.Dd December 19, 2014
+.Dt BL-BREAKINGIT 1
+.Os OpenBSD
+.Sh NAME
+.Nm Bl-breakingIt
+.Nd items breaking other blocks
+.Sh DESCRIPTION
+.Ss Breaking partial explicit macros
+.Bl -tag -width Ds
+Stray text.
+.Ao
+More stray text.
+.It tag
+Tagged text.
+.El
+.Bl -bullet
+Stray text.
+.Ao
+More stray text.
+.It
+Bullet point.
+.El
+.Ss Breaking full explicit macros
+.Bl -tag -width Ds
+Stray text.
+.Bd -ragged -offset indent
+More stray text.
+.It tag
+Tagged text.
+.El
+.Bl -bullet
+Stray text.
+.Bd -ragged -offset indent
+More stray text.
+.It
+Bullet point.
+.El
--- /dev/null
+BL-BREAKINGIT(1) General Commands Manual BL-BREAKINGIT(1)
+
+N\bNA\bAM\bME\bE
+ B\bBl\bl-\b-b\bbr\bre\bea\bak\bki\bin\bng\bgI\bIt\bt - items breaking other blocks
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ B\bBr\bre\bea\bak\bki\bin\bng\bg p\bpa\bar\brt\bti\bia\bal\bl e\bex\bxp\bpl\bli\bic\bci\bit\bt m\bma\bac\bcr\bro\bos\bs
+ Stray text. <More stray text.>
+
+ tag Tagged text.
+ Stray text. <More stray text.>
+
+ +\b+\bo\bo Bullet point.
+
+ B\bBr\bre\bea\bak\bki\bin\bng\bg f\bfu\bul\bll\bl e\bex\bxp\bpl\bli\bic\bci\bit\bt m\bma\bac\bcr\bro\bos\bs
+ Stray text.
+
+ More stray text.
+
+ tag Tagged text.
+ Stray text.
+
+ More stray text.
+
+ +\b+\bo\bo Bullet point.
+
+OpenBSD December 19, 2014 OpenBSD
--- /dev/null
+mandoc: breakingIt.in:13:2: ERROR: inserting missing end of block: It breaks Ao
+mandoc: breakingIt.in:10:1: WARNING: moving content out of list: text
+mandoc: breakingIt.in:11:2: WARNING: moving content out of list: Ao
+mandoc: breakingIt.in:20:2: ERROR: inserting missing end of block: It breaks Ao
+mandoc: breakingIt.in:17:1: WARNING: moving content out of list: text
+mandoc: breakingIt.in:18:2: WARNING: moving content out of list: Ao
+mandoc: breakingIt.in:28:2: ERROR: inserting missing end of block: It breaks Bd
+mandoc: breakingIt.in:25:1: WARNING: moving content out of list: text
+mandoc: breakingIt.in:26:2: WARNING: moving content out of list: Bd
+mandoc: breakingIt.in:35:2: ERROR: inserting missing end of block: It breaks Bd
+mandoc: breakingIt.in:32:1: WARNING: moving content out of list: text
+mandoc: breakingIt.in:33:2: WARNING: moving content out of list: Bd
-/* $OpenBSD: mdoc_macro.c,v 1.115 2014/12/18 20:58:00 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.116 2014/12/20 02:26:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
rew_sub(enum mdoc_type t, struct mdoc *mdoc,
enum mdoct tok, int line, int ppos)
{
- struct mdoc_node *n;
+ struct mdoc_node *n, *to;
+ to = NULL;
n = mdoc->last;
while (n) {
switch (rew_dohalt(tok, t, n)) {
case REWIND_NONE:
- return;
+ if (to == NULL)
+ return;
+ n = to;
+ break;
case REWIND_THIS:
n->lastline = line -
(mdoc->flags & MDOC_NEWLINE &&
case REWIND_MORE:
n->lastline = line -
(mdoc->flags & MDOC_NEWLINE ? 1 : 0);
+ to = n;
n = n->parent;
continue;
case REWIND_LATER:
struct mdoc_node *later; /* A sub-block starting later. */
struct mdoc_node *n; /* For searching backwards. */
- int j, lastarg, maxargs, flushed, nl;
+ int flushed, have_it, j, lastarg, maxargs, nl;
enum margserr ac;
enum mdoct atok, ntok;
char *p;
* both of our own and of pending sub-blocks.
*/
+ have_it = 0;
atok = rew_alt(tok);
body = endbody = later = NULL;
for (n = mdoc->last; n; n = n->parent) {
if (n->type != MDOC_BLOCK || n->tok == MDOC_Nm)
continue;
+
+ if (n->tok == MDOC_It) {
+ have_it = 1;
+ continue;
+ }
+
if (atok == n->tok) {
assert(body);
* just proceed to closing out.
*/
- if (later == NULL)
+ if (later == NULL ||
+ (tok == MDOC_El && !have_it))
break;
/*
* implicit ones, the first open implicit block.
*/
- if (later &&
- mdoc_macros[later->tok].flags & MDOC_EXPLICIT)
- continue;
- if (n->tok != MDOC_It)
+ if (later == NULL ||
+ ! (mdoc_macros[later->tok].flags & MDOC_EXPLICIT))
later = n;
}
rew_sub(MDOC_BODY, mdoc, tok, line, ppos);