=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.275 retrieving revision 1.279 diff -u -p -r1.275 -r1.279 --- mandoc/html.c 2021/09/09 14:47:24 1.275 +++ mandoc/html.c 2022/08/09 11:23:11 1.279 @@ -1,7 +1,8 @@ -/* $Id: html.c,v 1.275 2021/09/09 14:47:24 schwarze Exp $ */ +/* $Id: html.c,v 1.279 2022/08/09 11:23:11 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze + * Copyright (c) 2022 Anna Vyalkova * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -67,8 +68,10 @@ static const struct htmldata htmltags[TAG_MAX] = { {"style", HTML_NLALL | HTML_INDENT}, {"title", HTML_NLAROUND}, {"body", HTML_NLALL}, + {"main", HTML_NLALL}, {"div", HTML_NLAROUND}, {"section", HTML_NLALL}, + {"nav", HTML_NLALL}, {"table", HTML_NLALL | HTML_INDENT}, {"tr", HTML_NLALL | HTML_INDENT}, {"td", HTML_NLAROUND}, @@ -78,8 +81,8 @@ static const struct htmldata htmltags[TAG_MAX] = { {"dl", HTML_NLALL | HTML_INDENT}, {"dt", HTML_NLAROUND}, {"dd", HTML_NLAROUND | HTML_INDENT}, - {"h1", HTML_TOPHRASE | HTML_NLAROUND}, {"h2", HTML_TOPHRASE | HTML_NLAROUND}, + {"h3", HTML_TOPHRASE | HTML_NLAROUND}, {"p", HTML_TOPHRASE | HTML_NLAROUND | HTML_INDENT}, {"pre", HTML_TOPHRASE | HTML_NLAROUND | HTML_NOINDENT}, {"a", HTML_INPHRASE | HTML_TOPHRASE}, @@ -400,10 +403,13 @@ html_make_id(const struct roff_node *n, int unique) * In addition, reserve '~' for ordinal suffixes. */ - for (cp = buf; *cp != '\0'; cp++) - if (isalnum((unsigned char)*cp) == 0 && + for (cp = buf; *cp != '\0'; cp++) { + if (*cp == ASCII_HYPH) + *cp = '-'; + else if (isalnum((unsigned char)*cp) == 0 && strchr("!$&'()*+,-./:;=?@_", *cp) == NULL) *cp = '_'; + } if (unique == 0) return buf; @@ -707,6 +713,9 @@ print_otag(struct html *h, enum htmltag tag, const cha break; case 'i': attr = "id"; + break; + case 'r': + attr = "role"; break; case '?': attr = arg1;