discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Pali Rohar <pali.rohar@gmail.com>
Cc: discuss@mandoc.bsd.lv
Subject: Re: mandoc & perl documentation
Date: Thu, 28 Feb 2019 17:45:51 +0100	[thread overview]
Message-ID: <20190228164551.GB80399@athene.usta.de> (raw)
In-Reply-To: <20181125133426.s77sfsadbkz6jhcl@pali>

Hi,

i just implement yet another suggestion that came up in this conversation,
see the commit below.

The only TODO item i'm aware of that is still open following the
reports from Pali Rohar is this one:

 - 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
   loc ** exist ** algo ** size * imp ***

It will eventually get done, too.

Yours,
  Ingo


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 discuss+unsubscribe@mandoc.bsd.lv

  parent reply	other threads:[~2019-02-28 16:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 15:12 Pali Rohár
2018-09-13 15:32 ` Anthony J. Bentley
2018-09-13 15:36   ` Pali Rohár
2018-10-11  7:52 ` Pali Rohár
2018-10-11  8:54   ` Jan Stary
2018-10-23 17:45   ` Ingo Schwarze
2018-10-24  8:03     ` Pali Rohár
2018-10-25  1:51       ` Ingo Schwarze
2018-10-25  8:10         ` Pali Rohár
2018-10-25 21:30           ` Ingo Schwarze
2018-10-26  8:15             ` Pali Rohár
2018-11-24 19:31               ` Ingo Schwarze
2018-11-25 13:34                 ` Pali Rohár
2018-11-25 18:20                   ` Ingo Schwarze
2018-11-26  8:48                     ` Pali Rohár
2019-02-28 16:45                   ` Ingo Schwarze [this message]
2019-03-02 17:09                   ` Ingo Schwarze
2019-01-17  8:02           ` Ingo Schwarze
2018-11-04 20:00         ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190228164551.GB80399@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mandoc.bsd.lv \
    --cc=pali.rohar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).