aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tree.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-07 22:56:02 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-07 22:56:02 +0000
commitf4c07cc80595b2276a99fd6e5c95c734187feaab (patch)
tree23f120c67a8a3f6a33615c3d4d9f8115ed9ac08d /tree.c
parent70b71d1de24478a8fcc7413f1cb42c83db416bc3 (diff)
downloadmandoc-f4c07cc80595b2276a99fd6e5c95c734187feaab.tar.gz
mandoc-f4c07cc80595b2276a99fd6e5c95c734187feaab.tar.zst
mandoc-f4c07cc80595b2276a99fd6e5c95c734187feaab.zip
Separate the place to put the <a href> permalink (now marked
with NODE_HREF) from the target element of the link (still marked with NODE_ID). In many cases, use this to move the target to the beginning of the paragraph, such that readers don't get dropped into the middle of a sentence.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tree.c b/tree.c
index f08695d3..b901be1a 100644
--- a/tree.c
+++ b/tree.c
@@ -1,4 +1,4 @@
-/* $Id: tree.c,v 1.87 2020/03/13 15:32:29 schwarze Exp $ */
+/* $Id: tree.c,v 1.88 2020/04/07 22:56:02 schwarze Exp $ */
/*
* Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -207,8 +207,11 @@ print_mdoc(const struct roff_node *n, int indent)
if (n->string != NULL)
printf("=%s", n->string);
}
- if (n->flags & NODE_HREF)
+ if (n->flags & NODE_HREF) {
printf(" HREF");
+ if (n->string != NULL && (n->flags & NODE_ID) == 0)
+ printf("=%s", n->string);
+ }
if (n->flags & NODE_BROKEN)
printf(" BROKEN");
if (n->flags & NODE_NOFILL)