From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Format multiple subsequent .IP or multiple subsequent .TP/.TQ as
Date: Thu, 28 Feb 2019 11:36:43 -0500 (EST) [thread overview]
Message-ID: <e3f10b52a1f49b53@fantadrom.bsd.lv> (raw)
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
reply other threads:[~2019-02-28 16:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=e3f10b52a1f49b53@fantadrom.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/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).