source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Format multiple subsequent .IP or multiple subsequent .TP/.TQ as
@ 2019-02-28 16:36 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-02-28 16:36 UTC (permalink / raw)
  To: source

Log Message:
-----------
Format multiple subsequent .IP or multiple subsequent .TP/.TQ
as a single <dl> list rather than opening a new list for each item;
feature suggested by Pali dot Rohar at gmail dot com.

Modified Files:
--------------
    mandoc:
        TODO
        man_html.c

Revision Data
-------------
Index: man_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man_html.c,v
retrieving revision 1.170
retrieving revision 1.171
diff -Lman_html.c -Lman_html.c -u -p -r1.170 -r1.171
--- man_html.c
+++ man_html.c
@@ -233,7 +233,25 @@ print_man_node(MAN_ARGS)
 
 	/* This will automatically close out any font scope. */
 	t->refcnt--;
-	print_stagq(h, t);
+	if (n->type == ROFFT_BLOCK &&
+	    (n->tok == MAN_IP || n->tok == MAN_TP || n->tok == MAN_TQ)) {
+		t = h->tag;
+		while (t->tag != TAG_DL)
+			t = t->next;
+		/*
+		 * Close the list if no further item of the same type
+		 * follows; otherwise, close the item only.
+		 */
+		if (n->next == NULL ||
+		    (n->tok == MAN_IP && n->next->tok != MAN_IP) ||
+		    (n->tok != MAN_IP &&
+		     n->next->tok != MAN_TP && n->next->tok != MAN_TQ)) {
+			print_tagq(h, t);
+			t = NULL;
+		}
+	}
+	if (t != NULL)
+		print_stagq(h, t);
 
 	if (n->flags & NODE_NOFILL && n->tok != MAN_YS &&
 	    (n->next != NULL && n->next->flags & NODE_LINE)) {
@@ -399,7 +417,15 @@ man_IP_pre(MAN_ARGS)
 	switch (n->type) {
 	case ROFFT_BLOCK:
 		html_close_paragraph(h);
-		print_otag(h, TAG_DL, "c", "Bl-tag");
+		/*
+		 * Open a new list unless there is an immediately
+		 * preceding item of the same type.
+		 */
+		if (n->prev == NULL ||
+		    (n->tok == MAN_IP && n->prev->tok != MAN_IP) ||
+		    (n->tok != MAN_IP &&
+		     n->prev->tok != MAN_TP && n->prev->tok != MAN_TQ))
+			print_otag(h, TAG_DL, "c", "Bl-tag");
 		return 1;
 	case ROFFT_HEAD:
 		print_otag(h, TAG_DT, "");
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/mandoc/TODO,v
retrieving revision 1.283
retrieving revision 1.284
diff -LTODO -LTODO -u -p -r1.283 -r1.284
--- TODO
+++ TODO
@@ -349,11 +349,6 @@ are mere guesses, and some may be wrong.
    it does seem cleaner.)
   loc **  exist **  algo *  size *  imp ***
 
-- format multiple subsequent .IP as a single list
-  rather than opening a new list for each item
-  Pali Rohar 25 Nov 2018 14:34:26 +0100
-  loc *  exist **  algo *  size *  imp ***
-
 - format ".IP *" etc. as <ul> rather than <dl>
   https://github.com/Debian/debiman/issues/67
   reminded by Pali Rohar 25 Nov 2018 14:34:26 +0100
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

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

only message in thread, other threads:[~2019-02-28 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-28 16:36 mandoc: Format multiple subsequent .IP or multiple subsequent .TP/.TQ as 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).