aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-02-28 16:36:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-02-28 16:36:13 +0000
commit122f08c3f3756fc23b3e070a0322f7250bddbfbf (patch)
tree292df8a2b39ff88cc81498056500c347fd72e9ba
parenta0e394654302e544c81dd4d36338379a91ca1cbe (diff)
downloadmandoc-122f08c3f3756fc23b3e070a0322f7250bddbfbf.tar.gz
mandoc-122f08c3f3756fc23b3e070a0322f7250bddbfbf.tar.zst
mandoc-122f08c3f3756fc23b3e070a0322f7250bddbfbf.zip
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.
-rw-r--r--TODO7
-rw-r--r--man_html.c32
2 files changed, 30 insertions, 9 deletions
diff --git a/TODO b/TODO
index 2dca1cef..15ce410b 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
************************************************************************
* Official mandoc TODO.
-* $Id: TODO,v 1.283 2019/01/17 08:14:38 schwarze Exp $
+* $Id: TODO,v 1.284 2019/02/28 16:36:13 schwarze Exp $
************************************************************************
Many issues are annotated for difficulty as follows:
@@ -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
diff --git a/man_html.c b/man_html.c
index 187383e2..190a3b01 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.170 2019/01/18 14:36:21 schwarze Exp $ */
+/* $Id: man_html.c,v 1.171 2019/02/28 16:36:13 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -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, "");