aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc_html.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-19 15:16:56 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-19 15:16:56 +0000
commit4ee381e7bf5e05beda919be00d162d31ae86f4b8 (patch)
treeaf3b13beff80c2092bff9798c55d29d6694a5e5a /mandoc_html.3
parent05fe7c8316644cd9fe362b1f561ef55e65e93846 (diff)
downloadmandoc-4ee381e7bf5e05beda919be00d162d31ae86f4b8.tar.gz
mandoc-4ee381e7bf5e05beda919be00d162d31ae86f4b8.tar.zst
mandoc-4ee381e7bf5e05beda919be00d162d31ae86f4b8.zip
Correctly handle non-unique tags even when NODE_ID and NODE_HREF fall
apart, NODE_ID occurring earlier than NODE_HREF.
Diffstat (limited to 'mandoc_html.3')
-rw-r--r--mandoc_html.333
1 files changed, 17 insertions, 16 deletions
diff --git a/mandoc_html.3 b/mandoc_html.3
index bcb8b178..8b9a4420 100644
--- a/mandoc_html.3
+++ b/mandoc_html.3
@@ -1,4 +1,4 @@
-.\" $Id: mandoc_html.3,v 1.21 2020/04/18 20:44:09 schwarze Exp $
+.\" $Id: mandoc_html.3,v 1.22 2020/04/19 15:16:56 schwarze Exp $
.\"
.\" Copyright (c) 2014, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 18 2020 $
+.Dd $Mdocdate: April 19 2020 $
.Dt MANDOC_HTML 3
.Os
.Sh NAME
@@ -366,6 +366,18 @@ If the
.Fa unique
argument is non-zero, deduplication is performed by appending an
underscore and a decimal integer, if necessary.
+If the
+.Fa unique
+argument is 1, this is assumed to be the first call for this tag
+at this location, typically for use by
+.Dv NODE_ID ,
+so the integer is incremented before use.
+If the
+.Fa unique
+argument is 2, this is ssumed to be the second call for this tag
+at this location, typically for use by
+.Dv NODE_HREF ,
+so the existing integer, if any, is used without incrementing it.
.Pp
The function
.Fn print_otag_id
@@ -400,9 +412,9 @@ This function is a wrapper around
.Fn html_make_id
and
.Fn print_otag ,
-fixing the
+automatically chosing the
.Fa unique
-argument to 1 and the
+argument appropriately and setting the
.Fa fmt
arguments to
.Qq chR
@@ -457,20 +469,9 @@ returns a newly allocated string or
if
.Fa n
lacks text data to create the attribute from.
-If the
-.Fa unique
-argument is 0, the caller is responsible for
+The caller is responsible for
.Xr free 3 Ns ing
the returned string after using it.
-If the
-.Fa unique
-argument is non-zero, the
-.Va id_unique
-ohash table is used for de-duplication and owns the returned string.
-In this case, it will be freed automatically by
-.Fn html_reset
-or
-.Fn html_free .
.Pp
In case of
.Xr malloc 3