summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2010-06-27 21:54:41 +0000
committerschwarze <schwarze@openbsd.org>2010-06-27 21:54:41 +0000
commit9830bf9fa1ffaa7b4320b7991b78f1626f2527fb (patch)
treefa29ed2858d8df7d5c89a45db4e5d0895cdbdbc9 /usr.bin/mandoc/mdoc_html.c
parentdon't probe "volume knobs" on resume. probably not needed and (diff)
downloadwireguard-openbsd-9830bf9fa1ffaa7b4320b7991b78f1626f2527fb.tar.xz
wireguard-openbsd-9830bf9fa1ffaa7b4320b7991b78f1626f2527fb.zip
Full .nr nS support, unbreaking the kernel manuals.
Kristaps coded this from scratch after reading my .nr patch; it is simpler and more powerful. Registers live in struct regset in regs.h, struct man and struct mdoc contain pointers to it. The nS register is cleared when parsing .Sh. Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.
Diffstat (limited to 'usr.bin/mandoc/mdoc_html.c')
-rw-r--r--usr.bin/mandoc/mdoc_html.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 4fac42a6faa..54a7d203a5a 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.22 2010/06/26 17:56:43 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.23 2010/06/27 21:54:42 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -26,6 +26,7 @@
#include "mandoc.h"
#include "out.h"
#include "html.h"
+#include "regs.h"
#include "mdoc.h"
#include "main.h"
@@ -299,7 +300,7 @@ synopsis_pre(struct html *h, const struct mdoc_node *n)
struct roffsu su;
struct htmlpair tag;
- if (NULL == n->prev || SEC_SYNOPSIS != n->sec)
+ if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags))
return;
SCALE_VS_INIT(&su, 1);
@@ -1609,7 +1610,7 @@ mdoc_fn_pre(MDOC_ARGS)
*/
#if 0
- if (SEC_SYNOPSIS == n->sec) {
+ if (MDOC_SYNPRETTY & n->flags) {
nbuf[0] = '\0';
html_idcat(nbuf, sp, BUFSIZ);
PAIR_ID_INIT(&tag[1], nbuf);
@@ -1639,7 +1640,7 @@ mdoc_fn_pre(MDOC_ARGS)
for (nn = n->child->next; nn; nn = nn->next) {
i = 1;
- if (SEC_SYNOPSIS == n->sec)
+ if (MDOC_SYNPRETTY & n->flags)
i = 2;
t = print_otag(h, TAG_SPAN, i, tag);
print_text(h, nn->string);
@@ -1649,7 +1650,7 @@ mdoc_fn_pre(MDOC_ARGS)
}
print_text(h, ")");
- if (SEC_SYNOPSIS == n->sec)
+ if (MDOC_SYNPRETTY & n->flags)
print_text(h, ";");
return(0);
@@ -1819,7 +1820,7 @@ mdoc_in_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag[0], "includes");
print_otag(h, TAG_SPAN, 1, tag);
- if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
+ if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags)
print_text(h, "#include");
print_text(h, "<");