=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.208 retrieving revision 1.210 diff -u -p -r1.208 -r1.210 --- mandoc/html.c 2017/03/13 19:01:38 1.208 +++ mandoc/html.c 2017/03/15 11:29:53 1.210 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.208 2017/03/13 19:01:38 schwarze Exp $ */ +/* $Id: html.c,v 1.210 2017/03/15 11:29:53 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017 Ingo Schwarze @@ -28,8 +28,9 @@ #include #include -#include "mandoc.h" #include "mandoc_aux.h" +#include "mandoc.h" +#include "roff.h" #include "out.h" #include "html.h" #include "manconf.h" @@ -236,6 +237,28 @@ print_metaf(struct html *h, enum mandoc_esc deco) } } +char * +html_make_id(const struct roff_node *n) +{ + const struct roff_node *nch; + char *buf, *cp; + + for (nch = n->child; nch != NULL; nch = nch->next) + if (nch->type != ROFFT_TEXT) + return NULL; + + buf = NULL; + deroff(&buf, n); + + /* http://www.w3.org/TR/html5/dom.html#the-id-attribute */ + + for (cp = buf; *cp != '\0'; cp++) + if (*cp == ' ') + *cp = '_'; + + return buf; +} + int html_strlen(const char *cp) { @@ -591,6 +614,8 @@ print_otag(struct html *h, enum htmltag tag, const cha break; su = &mysu; a2width(arg2, su); + /* Increase width to make even bold text fit. */ + su->scale *= 1.1; if (fmt[-1] == 'W') su->scale *= -1.0; break;