aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc_html.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-15 11:29:53 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-15 11:29:53 +0000
commit4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00 (patch)
tree29466681c88eea5ed0346c222603343534c49d77 /mandoc_html.3
parent7820a26ea52032d0330456ae02d4044b357144de (diff)
downloadmandoc-4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00.tar.gz
mandoc-4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00.tar.zst
mandoc-4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00.zip
Minimal support for deep linking into man(7) pages.
As the man(7) language does not provide semantic markup, only .SH, .SS, and .UR become anchors for now.
Diffstat (limited to 'mandoc_html.3')
-rw-r--r--mandoc_html.333
1 files changed, 30 insertions, 3 deletions
diff --git a/mandoc_html.3 b/mandoc_html.3
index a274fd03..1382a2f8 100644
--- a/mandoc_html.3
+++ b/mandoc_html.3
@@ -1,4 +1,4 @@
-.\" $Id: mandoc_html.3,v 1.6 2017/03/13 19:01:38 schwarze Exp $
+.\" $Id: mandoc_html.3,v 1.7 2017/03/15 11:29:53 schwarze Exp $
.\"
.\" Copyright (c) 2014, 2017 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: March 13 2017 $
+.Dd $Mdocdate: March 15 2017 $
.Dt MANDOC_HTML 3
.Os
.Sh NAME
@@ -48,6 +48,14 @@
.Fa "struct html *h"
.Fa "const char *word"
.Fc
+.Ft char *
+.Fo html_make_id
+.Fa "const struct roff_node *n"
+.Fc
+.Ft int
+.Fo html_strlen
+.Fa "const char *cp"
+.Fc
.Sh DESCRIPTION
The mandoc HTML formatter is not a formal library.
However, as it is compiled into more than one program, in particular
@@ -306,8 +314,27 @@ and
.Fn print_tagq
functions.
.Pp
+The function
+.Fn html_make_id
+takes a node containing one or more text children
+and returns a newly allocated string containing the concatenation
+of the child strings, with blanks replaced by underscores.
+If the node
+.Fa n
+contains any non-text child node,
+.Fn html_make_id
+returns
+.Dv NULL
+instead.
+The caller is responsible for freeing the returned string.
+.Pp
+The function
+.Fn html_strlen
+counts the number of characters in
+.Fa cp .
+It is used as a crude estimate of the width needed to display a string.
+.Pp
The functions
-.Fn html_strlen ,
.Fn print_eqn ,
.Fn print_tbl ,
and