summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-06 10:16:17 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-06 10:16:17 +0000
commitb19e09dbeb7e957bca580776d8b3a4651016c904 (patch)
tree9decba67ceddc230203a9a25445f231797d73b56 /mdoc_term.c
parent9c50b3f3dd65454028a85113ebc01c5f1f8dabf5 (diff)
downloadmandoc-b19e09dbeb7e957bca580776d8b3a4651016c904.tar.gz
Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.
In HTML output, improve the logic for writing inside permalinks: skip them when there is no child content or when there is a risk that the children might contain flow content.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index f7e59cca..d221b61d 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -335,7 +335,8 @@ print_mdoc_node(DECL_ARGS)
memset(&npair, 0, sizeof(struct termpair));
npair.ppair = pair;
- if (n->flags & NODE_ID)
+ if (n->flags & NODE_ID && n->tok != MDOC_Pp &&
+ (n->tok != MDOC_It || n->type != ROFFT_BLOCK))
term_tag_write(n, p->line);
/*
@@ -630,6 +631,8 @@ termp_it_pre(DECL_ARGS)
if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n->parent->parent, n);
+ if (n->flags & NODE_ID)
+ term_tag_write(n, p->line);
return 1;
}
@@ -1110,7 +1113,6 @@ termp_ex_pre(DECL_ARGS)
static int
termp_nd_pre(DECL_ARGS)
{
-
if (n->type == ROFFT_BODY)
term_word(p, "\\(en");
return 1;
@@ -1119,14 +1121,20 @@ termp_nd_pre(DECL_ARGS)
static int
termp_bl_pre(DECL_ARGS)
{
-
- return n->type != ROFFT_HEAD;
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ term_newln(p);
+ return 1;
+ case ROFFT_HEAD:
+ return 0;
+ default:
+ return 1;
+ }
}
static void
termp_bl_post(DECL_ARGS)
{
-
if (n->type != ROFFT_BLOCK)
return;
term_newln(p);
@@ -1140,7 +1148,6 @@ termp_bl_post(DECL_ARGS)
static int
termp_xr_pre(DECL_ARGS)
{
-
if (NULL == (n = n->child))
return 0;
@@ -1555,6 +1562,8 @@ static int
termp_pp_pre(DECL_ARGS)
{
term_vspace(p);
+ if (n->flags & NODE_ID)
+ term_tag_write(n, p->line);
return 0;
}