aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-01-06 04:55:09 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-01-06 04:55:09 +0000
commit9b3bcfda2071ff49dd238b2315b1cc49c09a1552 (patch)
tree930e58bb00056f64a6942ed94bd64dfb194fcba0
parent589d3fbc1807388fbe883742468701520d81c047 (diff)
downloadmandoc-9b3bcfda2071ff49dd238b2315b1cc49c09a1552.tar.gz
mandoc-9b3bcfda2071ff49dd238b2315b1cc49c09a1552.tar.zst
mandoc-9b3bcfda2071ff49dd238b2315b1cc49c09a1552.zip
Finally, represent the man(7) .PP and .HP macros by the natural
choice, which is the <p> HTML element. On top of the previous fill-mode improvements, the key to making this possible is to automatically close the <p> when required: before headers, subsequent paragraphs, lists, indented blocks, synopsis blocks, tbl(7) blocks, and before blocks using no-fill mode. In man(7) documents, represent the .sp request by a blank line in no-fill mode and in the same way as .PP in fill mode.
-rw-r--r--html.c19
-rw-r--r--html.h6
-rw-r--r--man_html.c125
-rw-r--r--regress/man/HP/Makefile3
-rw-r--r--regress/man/HP/literal.in21
-rw-r--r--regress/man/HP/literal.out_ascii15
-rw-r--r--regress/man/HP/literal.out_html20
-rw-r--r--regress/man/IP/Makefile3
-rw-r--r--regress/man/IP/literal.in12
-rw-r--r--regress/man/IP/literal.out_ascii6
-rw-r--r--regress/man/IP/literal.out_html65
-rw-r--r--regress/man/RS/Makefile6
-rw-r--r--regress/man/RS/paragraph.in23
-rw-r--r--regress/man/RS/paragraph.out_ascii21
-rw-r--r--regress/man/RS/paragraph.out_html8
-rw-r--r--regress/man/SH/Makefile5
-rw-r--r--regress/man/SH/paragraph.in17
-rw-r--r--regress/man/SH/paragraph.out_ascii23
-rw-r--r--regress/man/SH/paragraph.out_html6
-rw-r--r--regress/man/SS/Makefile5
-rw-r--r--regress/man/SS/paragraph.in17
-rw-r--r--regress/man/SS/paragraph.out_ascii23
-rw-r--r--regress/man/SS/paragraph.out_html8
-rw-r--r--regress/man/TP/Makefile4
-rw-r--r--regress/man/TP/literal.in18
-rw-r--r--regress/man/TP/literal.out_ascii13
-rw-r--r--regress/man/TP/literal.out_html27
-rw-r--r--regress/roff/sp/Makefile8
-rw-r--r--regress/roff/sp/fill-man.in18
-rw-r--r--regress/roff/sp/fill-man.out_ascii21
-rw-r--r--regress/roff/sp/fill-man.out_html9
-rw-r--r--roff_html.c10
-rw-r--r--tbl_html.c3
33 files changed, 466 insertions, 122 deletions
diff --git a/html.c b/html.c
index 72153db7..71070769 100644
--- a/html.c
+++ b/html.c
@@ -1,7 +1,7 @@
-/* $Id: html.c,v 1.248 2019/01/05 09:14:44 schwarze Exp $ */
+/* $Id: html.c,v 1.249 2019/01/06 04:55:09 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011-2015, 2017-2019 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
@@ -78,6 +78,7 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"dl", HTML_NLALL | HTML_INDENT},
{"dt", HTML_NLAROUND},
{"dd", HTML_NLAROUND | HTML_INDENT},
+ {"p", HTML_NLAROUND | HTML_INDENT},
{"pre", HTML_NLALL | HTML_NOINDENT},
{"var", 0},
{"cite", 0},
@@ -265,6 +266,19 @@ print_metaf(struct html *h, enum mandoc_esc deco)
}
}
+void
+html_close_paragraph(struct html *h)
+{
+ struct tag *t;
+
+ for (t = h->tag; t != NULL; t = t->next) {
+ if (t->tag == TAG_P) {
+ print_tagq(h, t);
+ break;
+ }
+ }
+}
+
/*
* ROFF_nf switches to no-fill mode, ROFF_fi to fill mode.
* TOKEN_NONE does not switch. The old mode is returned.
@@ -287,6 +301,7 @@ html_fillmode(struct html *h, enum roff_tok want)
print_tagq(h, t);
break;
case ROFF_nf:
+ html_close_paragraph(h);
print_otag(h, TAG_PRE, "");
break;
case TOKEN_NONE:
diff --git a/html.h b/html.h
index cad32115..89cfa96f 100644
--- a/html.h
+++ b/html.h
@@ -1,7 +1,7 @@
-/* $Id: html.h,v 1.98 2019/01/05 09:14:44 schwarze Exp $ */
+/* $Id: html.h,v 1.99 2019/01/06 04:55:09 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2017, 2018, 2019 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
@@ -39,6 +39,7 @@ enum htmltag {
TAG_DL,
TAG_DT,
TAG_DD,
+ TAG_P,
TAG_PRE,
TAG_VAR,
TAG_CITE,
@@ -135,5 +136,6 @@ void print_eqn(struct html *, const struct eqn_box *);
void print_paragraph(struct html *);
void print_endline(struct html *);
+void html_close_paragraph(struct html *);
enum roff_tok html_fillmode(struct html *, enum roff_tok);
char *html_make_id(const struct roff_node *, int);
diff --git a/man_html.c b/man_html.c
index 0eb482b0..98ab2aae 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.165 2019/01/05 21:55:11 schwarze Exp $ */
+/* $Id: man_html.c,v 1.166 2019/01/06 04:55:09 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -42,14 +42,11 @@ struct man_html_act {
int (*post)(MAN_ARGS);
};
-static void print_bvspace(struct html *,
- const struct roff_node *);
static void print_man_head(const struct roff_meta *,
struct html *);
static void print_man_nodelist(MAN_ARGS);
static void print_man_node(MAN_ARGS);
static int man_B_pre(MAN_ARGS);
-static int man_HP_pre(MAN_ARGS);
static int man_IP_pre(MAN_ARGS);
static int man_I_pre(MAN_ARGS);
static int man_OP_pre(MAN_ARGS);
@@ -57,7 +54,6 @@ static int man_PP_pre(MAN_ARGS);
static int man_RS_pre(MAN_ARGS);
static int man_SH_pre(MAN_ARGS);
static int man_SM_pre(MAN_ARGS);
-static int man_SS_pre(MAN_ARGS);
static int man_SY_pre(MAN_ARGS);
static int man_UR_pre(MAN_ARGS);
static int man_abort_pre(MAN_ARGS);
@@ -72,14 +68,14 @@ static void man_root_pre(const struct roff_meta *,
static const struct man_html_act man_html_acts[MAN_MAX - MAN_TH] = {
{ NULL, NULL }, /* TH */
{ man_SH_pre, NULL }, /* SH */
- { man_SS_pre, NULL }, /* SS */
+ { man_SH_pre, NULL }, /* SS */
{ man_IP_pre, NULL }, /* TP */
{ man_IP_pre, NULL }, /* TQ */
{ man_abort_pre, NULL }, /* LP */
{ man_PP_pre, NULL }, /* PP */
{ man_abort_pre, NULL }, /* P */
{ man_IP_pre, NULL }, /* IP */
- { man_HP_pre, NULL }, /* HP */
+ { man_PP_pre, NULL }, /* HP */
{ man_SM_pre, NULL }, /* SM */
{ man_SM_pre, NULL }, /* SB */
{ man_alt_pre, NULL }, /* BI */
@@ -110,27 +106,6 @@ static const struct man_html_act man_html_acts[MAN_MAX - MAN_TH] = {
};
-/*
- * Printing leading vertical space before a block.
- * This is used for the paragraph macros.
- * The rules are pretty simple, since there's very little nesting going
- * on here. Basically, if we're the first within another block (SS/SH),
- * then don't emit vertical space. If we are (RS), then do. If not the
- * first, print it.
- */
-static void
-print_bvspace(struct html *h, const struct roff_node *n)
-{
- if (n->body != NULL && n->body->child != NULL &&
- n->body->child->type == ROFFT_TBL)
- return;
-
- if (n->prev == NULL && n->parent->tok != MAN_RS)
- return;
-
- print_paragraph(h);
-}
-
void
html_man(void *arg, const struct roff_meta *man)
{
@@ -239,7 +214,8 @@ print_man_node(MAN_ARGS)
t = h->tag;
if (n->tok < ROFF_MAX) {
roff_html_pre(h, n);
- print_stagq(h, t);
+ if (n->tok != ROFF_sp)
+ print_stagq(h, t);
return;
}
@@ -315,11 +291,23 @@ man_SH_pre(MAN_ARGS)
{
char *id;
- if (n->type == ROFFT_HEAD) {
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ html_close_paragraph(h);
+ break;
+ case ROFFT_HEAD:
id = html_make_id(n, 1);
- print_otag(h, TAG_H1, "cTi", "Sh", id);
+ if (n->tok == MAN_SH)
+ print_otag(h, TAG_H1, "cTi", "Sh", id);
+ else
+ print_otag(h, TAG_H2, "cTi", "Ss", id);
if (id != NULL)
print_otag(h, TAG_A, "chR", "permalink", id);
+ break;
+ case ROFFT_BODY:
+ break;
+ default:
+ abort();
}
return 1;
}
@@ -380,27 +368,23 @@ man_SM_pre(MAN_ARGS)
}
static int
-man_SS_pre(MAN_ARGS)
-{
- char *id;
-
- if (n->type == ROFFT_HEAD) {
- id = html_make_id(n, 1);
- print_otag(h, TAG_H2, "cTi", "Ss", id);
- if (id != NULL)
- print_otag(h, TAG_A, "chR", "permalink", id);
- }
- return 1;
-}
-
-static int
man_PP_pre(MAN_ARGS)
{
- if (n->type == ROFFT_HEAD)
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ html_close_paragraph(h);
+ break;
+ case ROFFT_HEAD:
return 0;
- else if (n->type == ROFFT_BLOCK)
- print_bvspace(h, n);
-
+ case ROFFT_BODY:
+ if (n->child != NULL &&
+ (n->child->flags & NODE_NOFILL) == 0)
+ print_otag(h, TAG_P, "c",
+ n->tok == MAN_PP ? "Pp" : "Pp HP");
+ break;
+ default:
+ abort();
+ }
return 1;
}
@@ -409,16 +393,21 @@ man_IP_pre(MAN_ARGS)
{
const struct roff_node *nn;
- if (n->type == ROFFT_BODY) {
- print_otag(h, TAG_DD, "");
- return 1;
- } else if (n->type != ROFFT_HEAD) {
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ html_close_paragraph(h);
print_otag(h, TAG_DL, "c", "Bl-tag");
return 1;
+ case ROFFT_HEAD:
+ print_otag(h, TAG_DT, "");
+ break;
+ case ROFFT_BODY:
+ print_otag(h, TAG_DD, "");
+ return 1;
+ default:
+ abort();
}
- print_otag(h, TAG_DT, "");
-
switch(n->tok) {
case MAN_IP: /* Only print the first header element. */
if (n->child != NULL)
@@ -441,19 +430,6 @@ man_IP_pre(MAN_ARGS)
}
static int
-man_HP_pre(MAN_ARGS)
-{
- if (n->type == ROFFT_HEAD)
- return 0;
-
- if (n->type == ROFFT_BLOCK) {
- print_bvspace(h, n);
- print_otag(h, TAG_DIV, "c", "HP");
- }
- return 1;
-}
-
-static int
man_OP_pre(MAN_ARGS)
{
struct tag *tt;
@@ -510,10 +486,18 @@ man_ign_pre(MAN_ARGS)
static int
man_RS_pre(MAN_ARGS)
{
- if (n->type == ROFFT_HEAD)
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ html_close_paragraph(h);
+ break;
+ case ROFFT_HEAD:
return 0;
- if (n->type == ROFFT_BLOCK)
+ case ROFFT_BODY:
print_otag(h, TAG_DIV, "c", "Bd-indent");
+ break;
+ default:
+ abort();
+ }
return 1;
}
@@ -522,6 +506,7 @@ man_SY_pre(MAN_ARGS)
{
switch (n->type) {
case ROFFT_BLOCK:
+ html_close_paragraph(h);
print_otag(h, TAG_TABLE, "c", "Nm");
print_otag(h, TAG_TR, "");
break;
diff --git a/regress/man/HP/Makefile b/regress/man/HP/Makefile
index e0d2a3b4..1e33cfb4 100644
--- a/regress/man/HP/Makefile
+++ b/regress/man/HP/Makefile
@@ -1,5 +1,6 @@
-# $OpenBSD: Makefile,v 1.2 2014/04/08 04:45:50 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2019/01/06 04:41:15 schwarze Exp $
REGRESS_TARGETS = break literal macrotag manyargs spacing
+HTML_TARGETS = literal
.include <bsd.regress.mk>
diff --git a/regress/man/HP/literal.in b/regress/man/HP/literal.in
index 0f256638..e5d1b71a 100644
--- a/regress/man/HP/literal.in
+++ b/regress/man/HP/literal.in
@@ -1,27 +1,32 @@
-.\" $OpenBSD: literal.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $
-.TH HP-LITERAL 1 "January 4, 2011"
+.\" $OpenBSD: literal.in,v 1.3 2019/01/06 04:41:15 schwarze Exp $
+.TH HP-LITERAL 1 "January 6, 2019"
.SH NAME
HP-literal \- hanged paragraphs in literal context
.SH DESCRIPTION
-regular
-text
+BEGINTEST
+before hanged paragraph
.HP 10n
tag
indented
text
.PP
regular
-text
+paragraph
.nf
literal
text
.HP 10n
tag
-indented
-text
+literal
+hanged
+paragraph
.PP
literal
-text
+paragraph
.fi
regular
text
+.br
+ENDTEST
+.br
+end of file
diff --git a/regress/man/HP/literal.out_ascii b/regress/man/HP/literal.out_ascii
index ff7aabf7..1e27b1ae 100644
--- a/regress/man/HP/literal.out_ascii
+++ b/regress/man/HP/literal.out_ascii
@@ -6,22 +6,25 @@ NNAAMMEE
HP-literal - hanged paragraphs in literal context
DDEESSCCRRIIPPTTIIOONN
- regular text
+ BEGINTEST before hanged paragraph
tag indented text
- regular text
+ regular paragraph
literal
text
tag
- indented
- text
+ literal
+ hanged
+ paragraph
literal
- text
+ paragraph
regular text
+ ENDTEST
+ end of file
-OpenBSD January 4, 2011 HP-LITERAL(1)
+OpenBSD January 6, 2019 HP-LITERAL(1)
diff --git a/regress/man/HP/literal.out_html b/regress/man/HP/literal.out_html
new file mode 100644
index 00000000..d40ee9a5
--- /dev/null
+++ b/regress/man/HP/literal.out_html
@@ -0,0 +1,20 @@
+BEGINTEST before hanged paragraph
+<p class="Pp HP">tag indented text</p>
+<p class="Pp">regular paragraph</p>
+<pre>
+literal
+text
+</pre>
+<pre>
+tag
+literal
+hanged
+paragraph
+</pre>
+<pre>
+literal
+paragraph
+</pre>
+regular text
+<br/>
+ENDTEST
diff --git a/regress/man/IP/Makefile b/regress/man/IP/Makefile
index 9edc12e1..a677b970 100644
--- a/regress/man/IP/Makefile
+++ b/regress/man/IP/Makefile
@@ -1,6 +1,7 @@
-# $OpenBSD: Makefile,v 1.8 2014/07/02 05:51:49 schwarze Exp $
+# $OpenBSD: Makefile,v 1.9 2019/01/06 04:41:15 schwarze Exp $
REGRESS_TARGETS = empty literal longhead manyargs spacing width
LINT_TARGETS = empty
+HTML_TARGETS = literal
.include <bsd.regress.mk>
diff --git a/regress/man/IP/literal.in b/regress/man/IP/literal.in
index edb8eb02..2fb459cb 100644
--- a/regress/man/IP/literal.in
+++ b/regress/man/IP/literal.in
@@ -1,10 +1,10 @@
-.\" $OpenBSD: literal.in,v 1.6 2017/07/04 14:53:23 schwarze Exp $
-.TH IP-LITERAL 1 "January 4, 2011"
+.\" $OpenBSD: literal.in,v 1.7 2019/01/06 04:41:15 schwarze Exp $
+.TH IP-LITERAL 1 "January 6, 2019"
.SH NAME
IP-literal \- indented paragraphs in literal context
.SH DESCRIPTION
-regular
-text
+BEGINTEST
+before indentation
.IP tag 10n
indented
regular
@@ -63,3 +63,7 @@ paragraph
.fi
regular
text
+.br
+ENDTEST
+.br
+end of file
diff --git a/regress/man/IP/literal.out_ascii b/regress/man/IP/literal.out_ascii
index db020a5e..e4984ede 100644
--- a/regress/man/IP/literal.out_ascii
+++ b/regress/man/IP/literal.out_ascii
@@ -6,7 +6,7 @@ NNAAMMEE
IP-literal - indented paragraphs in literal context
DDEESSCCRRIIPPTTIIOONN
- regular text
+ BEGINTEST before indentation
tag indented regular text
@@ -47,7 +47,9 @@ DDEESSCCRRIIPPTTIIOONN
literal
paragraph
regular text
+ ENDTEST
+ end of file
-OpenBSD January 4, 2011 IP-LITERAL(1)
+OpenBSD January 6, 2019 IP-LITERAL(1)
diff --git a/regress/man/IP/literal.out_html b/regress/man/IP/literal.out_html
new file mode 100644
index 00000000..ae90758b
--- /dev/null
+++ b/regress/man/IP/literal.out_html
@@ -0,0 +1,65 @@
+BEGINTEST before indentation
+<dl class="Bl-tag">
+ <dt>tag</dt>
+ <dd>indented regular text</dd>
+</dl>
+<p class="Pp">new regular paragraph</p>
+<pre>
+literal
+text
+</pre>
+<dl class="Bl-tag">
+ <dt>tag</dt>
+ <dd>
+ <pre>
+indented
+literal
+text
+ </pre>
+ </dd>
+</dl>
+<pre>
+new
+literal
+paragraph
+</pre>
+regular text
+<h2 class="Ss" title="Ss" id="literal_into_indented_paragraph"><a class="permalink" href="#literal_into_indented_paragraph">literal
+ into indented paragraph</a></h2>
+regular text
+<pre>
+literal
+text
+</pre>
+<dl class="Bl-tag">
+ <dt>tag</dt>
+ <dd>
+ <pre>
+indented
+literal
+text
+ </pre>
+ indented regular text</dd>
+</dl>
+<p class="Pp">new regular paragraph</p>
+<h2 class="Ss" title="Ss" id="literal_out_of_indented_paragraph"><a class="permalink" href="#literal_out_of_indented_paragraph">literal
+ out of indented paragraph</a></h2>
+regular text
+<dl class="Bl-tag">
+ <dt>tag</dt>
+ <dd>indented regular text
+ <pre>
+indented
+literal
+text
+ </pre>
+ </dd>
+</dl>
+<pre>
+new
+literal
+paragraph
+</pre>
+regular text
+<br/>
+ENDTEST
diff --git a/regress/man/RS/Makefile b/regress/man/RS/Makefile
index 34c0029c..e7b64ab1 100644
--- a/regress/man/RS/Makefile
+++ b/regress/man/RS/Makefile
@@ -1,8 +1,8 @@
-# $OpenBSD: Makefile,v 1.13 2019/01/05 20:00:33 schwarze Exp $
+# $OpenBSD: Makefile,v 1.14 2019/01/06 04:41:15 schwarze Exp $
REGRESS_TARGETS = an-margin breaking broken empty literal lonelyRE
-REGRESS_TARGETS += nested noRE nowidth REarg width
+REGRESS_TARGETS += nested noRE nowidth paragraph REarg width
LINT_TARGETS = empty lonelyRE noRE REarg
-HTML_TARGETS = literal
+HTML_TARGETS = literal paragraph
.include <bsd.regress.mk>
diff --git a/regress/man/RS/paragraph.in b/regress/man/RS/paragraph.in
new file mode 100644
index 00000000..01f90f04
--- /dev/null
+++ b/regress/man/RS/paragraph.in
@@ -0,0 +1,23 @@
+.\" $OpenBSD: paragraph.in,v 1.1 2019/01/06 04:41:15 schwarze Exp $
+.TH RS-PARAGRAPH 1 "January 6, 2019"
+.SH NAME
+RS-paragraph \- interaction between regular and indented paragraphs
+.SH DESCRIPTION
+BEGINTEST
+before paragraph
+.PP
+regular
+paragraph
+.RS
+indented
+paragraph
+.PP
+nested
+paragraph
+.RE
+regular text
+after display
+.br
+ENDTEST
+.br
+end of file
diff --git a/regress/man/RS/paragraph.out_ascii b/regress/man/RS/paragraph.out_ascii
new file mode 100644
index 00000000..91e0ee3e
--- /dev/null
+++ b/regress/man/RS/paragraph.out_ascii
@@ -0,0 +1,21 @@
+RS-PARAGRAPH(1) General Commands Manual RS-PARAGRAPH(1)
+
+
+
+NNAAMMEE
+ RS-paragraph - interaction between regular and indented paragraphs
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST before paragraph
+
+ regular paragraph
+ indented paragraph
+
+ nested paragraph
+ regular text after display
+ ENDTEST
+ end of file
+
+
+
+OpenBSD January 6, 2019 RS-PARAGRAPH(1)
diff --git a/regress/man/RS/paragraph.out_html b/regress/man/RS/paragraph.out_html
new file mode 100644
index 00000000..8b518698
--- /dev/null
+++ b/regress/man/RS/paragraph.out_html
@@ -0,0 +1,8 @@
+BEGINTEST before paragraph
+<p class="Pp">regular paragraph</p>
+<div class="Bd-indent">indented paragraph
+<p class="Pp">nested paragraph</p>
+</div>
+regular text after display
+<br/>
+ENDTEST
diff --git a/regress/man/SH/Makefile b/regress/man/SH/Makefile
index 6fff341f..55133efe 100644
--- a/regress/man/SH/Makefile
+++ b/regress/man/SH/Makefile
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile,v 1.4 2015/04/04 18:52:12 schwarze Exp $
+# $OpenBSD: Makefile,v 1.6 2019/01/06 04:41:15 schwarze Exp $
-REGRESS_TARGETS = broken broken_eline empty_before longarg noarg
+REGRESS_TARGETS = broken broken_eline empty_before longarg noarg paragraph
LINT_TARGETS = broken broken_eline empty_before noarg
+HTML_TARGETS = paragraph
# groff-1.22.3 defects:
# - .SH without args just before EOF causes two additional blank lines.
diff --git a/regress/man/SH/paragraph.in b/regress/man/SH/paragraph.in
new file mode 100644
index 00000000..8ea45822
--- /dev/null
+++ b/regress/man/SH/paragraph.in
@@ -0,0 +1,17 @@
+.\" $OpenBSD: paragraph.in,v 1.1 2019/01/06 04:41:15 schwarze Exp $
+.TH SH-PARAGRAPH 1 "January 6, 2019"
+.SH NAME
+SH-paragraph \- interaction of section headers with paragraphs
+.SH SYNOPSIS
+BEGINTEST
+.SH DESCRIPTION
+This text
+immediately follows
+a section header.
+.PP
+This is
+a paragraph.
+.SH EXAMPLES
+ENDTEST
+.PP
+end of file
diff --git a/regress/man/SH/paragraph.out_ascii b/regress/man/SH/paragraph.out_ascii
new file mode 100644
index 00000000..c7b8a621
--- /dev/null
+++ b/regress/man/SH/paragraph.out_ascii
@@ -0,0 +1,23 @@
+SH-PARAGRAPH(1) General Commands Manual SH-PARAGRAPH(1)
+
+
+
+NNAAMMEE
+ SH-paragraph - interaction of section headers with paragraphs
+
+SSYYNNOOPPSSIISS
+ BEGINTEST
+
+DDEESSCCRRIIPPTTIIOONN
+ This text immediately follows a section header.
+
+ This is a paragraph.
+
+EEXXAAMMPPLLEESS
+ ENDTEST
+
+ end of file
+
+
+
+OpenBSD January 6, 2019 SH-PARAGRAPH(1)
diff --git a/regress/man/SH/paragraph.out_html b/regress/man/SH/paragraph.out_html
new file mode 100644
index 00000000..5aef80e2
--- /dev/null
+++ b/regress/man/SH/paragraph.out_html
@@ -0,0 +1,6 @@
+BEGINTEST
+<h1 class="Sh" title="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
+This text immediately follows a section header.
+<p class="Pp">This is a paragraph.</p>
+<h1 class="Sh" title="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
+ENDTEST
diff --git a/regress/man/SS/Makefile b/regress/man/SS/Makefile
index 01bd7edb..0ae0fbc5 100644
--- a/regress/man/SS/Makefile
+++ b/regress/man/SS/Makefile
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile,v 1.2 2015/04/04 18:52:12 schwarze Exp $
+# $OpenBSD: Makefile,v 1.4 2019/01/06 04:41:15 schwarze Exp $
-REGRESS_TARGETS = broken broken_eline longarg noarg
+REGRESS_TARGETS = broken broken_eline longarg noarg paragraph
LINT_TARGETS = broken broken_eline noarg
+HTML_TARGETS = paragraph
# groff-1.22.3 defects:
# - .SS without args just before EOF causes two additional blank lines.
diff --git a/regress/man/SS/paragraph.in b/regress/man/SS/paragraph.in
new file mode 100644
index 00000000..c30ee9c3
--- /dev/null
+++ b/regress/man/SS/paragraph.in
@@ -0,0 +1,17 @@
+.\" $OpenBSD: paragraph.in,v 1.1 2019/01/06 04:41:15 schwarze Exp $
+.TH SS-PARAGRAPH 1 "January 6, 2019"
+.SH NAME
+SS-paragraph \- interaction of subsection headers with paragraphs
+.SH DESCRIPTION
+BEGINTEST
+.SS First subsection
+This text
+immediately follows
+a subsection header.
+.PP
+This is
+a paragraph.
+.SS Second subsection
+ENDTEST
+.PP
+end of file
diff --git a/regress/man/SS/paragraph.out_ascii b/regress/man/SS/paragraph.out_ascii
new file mode 100644
index 00000000..3448eedb
--- /dev/null
+++ b/regress/man/SS/paragraph.out_ascii
@@ -0,0 +1,23 @@
+SS-PARAGRAPH(1) General Commands Manual SS-PARAGRAPH(1)
+
+
+
+NNAAMMEE
+ SS-paragraph - interaction of subsection headers with paragraphs
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST
+
+ FFiirrsstt ssuubbsseeccttiioonn
+ This text immediately follows a subsection header.
+
+ This is a paragraph.
+
+ SSeeccoonndd ssuubbsseeccttiioonn
+ ENDTEST
+
+ end of file
+
+
+
+OpenBSD January 6, 2019 SS-PARAGRAPH(1)
diff --git a/regress/man/SS/paragraph.out_html b/regress/man/SS/paragraph.out_html
new file mode 100644
index 00000000..e36f2a06
--- /dev/null
+++ b/regress/man/SS/paragraph.out_html
@@ -0,0 +1,8 @@
+BEGINTEST
+<h2 class="Ss" title="Ss" id="First_subsection"><a class="permalink" href="#First_subsection">First
+ subsection</a></h2>
+This text immediately follows a subsection header.
+<p class="Pp">This is a paragraph.</p>
+<h2 class="Ss" title="Ss" id="Second_subsection"><a class="permalink" href="#Second_subsection">Second
+ subsection</a></h2>
+ENDTEST
diff --git a/regress/man/TP/Makefile b/regress/man/TP/Makefile
index b1763652..2fc1074f 100644
--- a/regress/man/TP/Makefile
+++ b/regress/man/TP/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.12 2015/09/21 13:24:32 schwarze Exp $
+# $OpenBSD: Makefile,v 1.15 2019/01/06 04:41:15 schwarze Exp $
REGRESS_TARGETS = badarg broken double eof fill indent literal longhead
REGRESS_TARGETS += macrotag manyargs sameline spacing width
-
LINT_TARGETS = broken double eof
+HTML_TARGETS = literal
# groff-1.22.3 defects:
# - If .TP precedes .RE, the latter does not properly reset indentation.
diff --git a/regress/man/TP/literal.in b/regress/man/TP/literal.in
index 4fa30fd1..a2dc956f 100644
--- a/regress/man/TP/literal.in
+++ b/regress/man/TP/literal.in
@@ -1,27 +1,33 @@
-.\" $OpenBSD: literal.in,v 1.3 2017/07/04 14:53:24 schwarze Exp $
-.TH TP-LITERAL 1 "January 4, 2011"
+.\" $OpenBSD: literal.in,v 1.4 2019/01/06 04:41:15 schwarze Exp $
+.TH TP-LITERAL 1 "January 6, 2019"
.SH NAME
TP-literal \- indented paragraphs in literal context
.SH DESCRIPTION
-regular
-text
+BEGINTEST
+before indentation
.TP 10n
tag
+regular
indented
text
.PP
regular
-text
+paragraph
.nf
literal
text
.TP 10n
tag
indented
+literal
text
.PP
literal
-text
+paragraph
.fi
regular
text
+.br
+ENDTEST
+.br
+end of file
diff --git a/regress/man/TP/literal.out_ascii b/regress/man/TP/literal.out_ascii
index b8dddb7b..6fcaeeb6 100644
--- a/regress/man/TP/literal.out_ascii
+++ b/regress/man/TP/literal.out_ascii
@@ -6,21 +6,24 @@ NNAAMMEE
TP-literal - indented paragraphs in literal context
DDEESSCCRRIIPPTTIIOONN
- regular text
+ BEGINTEST before indentation
- tag indented text
+ tag regular indented text
- regular text
+ regular paragraph
literal
text
tag indented
+ literal
text
literal
- text
+ paragraph
regular text
+ ENDTEST
+ end of file
-OpenBSD January 4, 2011 TP-LITERAL(1)
+OpenBSD January 6, 2019 TP-LITERAL(1)
diff --git a/regress/man/TP/literal.out_html b/regress/man/TP/literal.out_html
new file mode 100644
index 00000000..14bfb834
--- /dev/null
+++ b/regress/man/TP/literal.out_html
@@ -0,0 +1,27 @@
+BEGINTEST before indentation
+<dl class="Bl-tag">
+ <dt>tag</dt>
+ <dd>regular indented text</dd>
+</dl>
+<p class="Pp">regular paragraph</p>
+<pre>
+literal
+text
+</pre>
+<dl class="Bl-tag">
+ <dt>tag</dt>
+ <dd>
+ <pre>
+indented
+literal
+text
+ </pre>
+ </dd>
+</dl>
+<pre>
+literal
+paragraph
+</pre>
+regular text
+<br/>
+ENDTEST
diff --git a/regress/roff/sp/Makefile b/regress/roff/sp/Makefile
index 7a09afb1..8d766a48 100644
--- a/regress/roff/sp/Makefile
+++ b/regress/roff/sp/Makefile
@@ -1,6 +1,8 @@
-# $OpenBSD: Makefile,v 1.5 2015/02/06 09:38:22 schwarze Exp $
+# $OpenBSD: Makefile,v 1.6 2019/01/06 04:41:15 schwarze Exp $
-REGRESS_TARGETS = badargs-man badargs-mdoc negative scaling-man scaling-mdoc
-LINT_TARGETS = badargs-man
+REGRESS_TARGETS = badargs-man badargs-mdoc fill-man
+REGRESS_TARGETS += negative scaling-man scaling-mdoc
+LINT_TARGETS = badargs-man
+HTML_TARGETS = fill-man
.include <bsd.regress.mk>
diff --git a/regress/roff/sp/fill-man.in b/regress/roff/sp/fill-man.in
new file mode 100644
index 00000000..2faf7ca0
--- /dev/null
+++ b/regress/roff/sp/fill-man.in
@@ -0,0 +1,18 @@
+.\" $OpenBSD: fill-man.in,v 1.1 2019/01/06 04:41:15 schwarze Exp $
+.TH SP-FILL-MAN 1 "January 6, 2019"
+.SH NAME
+sp-fill-man \- interaction of vertical spacing requests with fill modes
+.SH DESCRIPTION
+BEGINTEST
+in fill mode:
+.sp
+switch to no-fill mode:
+.nf
+in no-fill mode:
+.sp
+back to
+fill mode:
+.fi
+ENDTEST
+.br
+end of file
diff --git a/regress/roff/sp/fill-man.out_ascii b/regress/roff/sp/fill-man.out_ascii
new file mode 100644
index 00000000..c111a012
--- /dev/null
+++ b/regress/roff/sp/fill-man.out_ascii
@@ -0,0 +1,21 @@
+SP-FILL-MAN(1) General Commands Manual SP-FILL-MAN(1)
+
+
+
+NNAAMMEE
+ sp-fill-man - interaction of vertical spacing requests with fill modes
+
+DDEESSCCRRIIPPTTIIOONN
+ BEGINTEST in fill mode:
+
+ switch to no-fill mode:
+ in no-fill mode:
+
+ back to
+ fill mode:
+ ENDTEST
+ end of file
+
+
+
+OpenBSD January 6, 2019 SP-FILL-MAN(1)
diff --git a/regress/roff/sp/fill-man.out_html b/regress/roff/sp/fill-man.out_html
new file mode 100644
index 00000000..3fcfa2a6
--- /dev/null
+++ b/regress/roff/sp/fill-man.out_html
@@ -0,0 +1,9 @@
+BEGINTEST in fill mode:
+<p class="Pp">switch to no-fill mode:</p>
+<pre>
+in no-fill mode:
+
+back to
+fill mode:
+</pre>
+ENDTEST
diff --git a/roff_html.c b/roff_html.c
index 0593e252..dabf7ca9 100644
--- a/roff_html.c
+++ b/roff_html.c
@@ -1,4 +1,4 @@
-/* $Id: roff_html.c,v 1.17 2019/01/05 09:14:44 schwarze Exp $ */
+/* $Id: roff_html.c,v 1.18 2019/01/06 04:55:09 schwarze Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2017, 2018, 2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -107,5 +107,11 @@ roff_html_pre_nf(ROFF_HTML_ARGS)
static void
roff_html_pre_sp(ROFF_HTML_ARGS)
{
- print_paragraph(h);
+ if (html_fillmode(h, TOKEN_NONE) == ROFF_nf) {
+ h->col++;
+ print_endline(h);
+ } else if (n->parent->tok >= MAN_TH)
+ print_otag(h, TAG_P, "c", "Pp");
+ else
+ print_paragraph(h);
}
diff --git a/tbl_html.c b/tbl_html.c
index 98c7b96c..4ab6bed1 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_html.c,v 1.31 2018/12/16 00:17:02 schwarze Exp $ */
+/* $Id: tbl_html.c,v 1.32 2019/01/06 04:55:09 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -80,6 +80,7 @@ html_tbl_sulen(const struct roffsu *su, void *arg)
static void
html_tblopen(struct html *h, const struct tbl_span *sp)
{
+ html_close_paragraph(h);
if (h->tbl.cols == NULL) {
h->tbl.len = html_tbl_len;
h->tbl.slen = html_tbl_strlen;