source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Support .Bl -offset in -mdoc -Tman.
@ 2013-05-19 21:40 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2013-05-19 21:40 UTC (permalink / raw)
  To: source

Log Message:
-----------
Support .Bl -offset in -mdoc -Tman.
Issue found when Thomas Klausner <wiz at NetBSD dot org> made me 
look at the manuals of his http://www.nih.at/libzip library.

Modified Files:
--------------
    mdocml:
        mdoc_man.c

Revision Data
-------------
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.48 -r1.49
--- mdoc_man.c
+++ mdoc_man.c
@@ -1,6 +1,6 @@
 /*	$Id$ */
 /*
- * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011, 2012, 2013 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
@@ -910,6 +910,16 @@ pre_bl(DECL_ARGS)
 {
 	size_t		 icol;
 
+	/*
+	 * print_offs() will increase the -offset to account for
+	 * a possible enclosing .It, but any enclosed .It blocks
+	 * just nest and do not add up their indentation.
+	 */
+	if (n->norm->Bl.offs) {
+		print_offs(n->norm->Bl.offs);
+		Bl_stack[Bl_stack_len++] = 0;
+	}
+
 	switch (n->norm->Bl.type) {
 	case (LIST_enum):
 		n->norm->Bl.count = 0;
@@ -942,8 +952,16 @@ post_bl(DECL_ARGS)
 	default:
 		break;
 	}
-	outflags |= MMAN_PP | MMAN_nl;
-	outflags &= ~(MMAN_sp | MMAN_br);
+
+	if (n->norm->Bl.offs) {
+		print_line(".RE", MMAN_nl);
+		assert(Bl_stack_len);
+		Bl_stack_len--;
+		assert(0 == Bl_stack[Bl_stack_len]);
+	} else {
+		outflags |= MMAN_PP | MMAN_nl;
+		outflags &= ~(MMAN_sp | MMAN_br);
+	}
 
 	/* Maybe we are inside an enclosing list? */
 	if (NULL != n->parent->next)
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-19 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-19 21:40 mdocml: Support .Bl -offset in -mdoc -Tman schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).