summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-04-13 16:28:07 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-04-13 16:28:07 +0000
commit534cdc68f3485e735d3ad600a0eae1623a2b15d1 (patch)
tree874c1f995e1683dd5fc752f2c46a7915ed0556f2 /html.c
parent0609782211f70e20c352ca9e580e328fc5817302 (diff)
downloadmandoc-534cdc68f3485e735d3ad600a0eae1623a2b15d1.tar.gz
preserve comments before .Dd and .TH (typically Copyright and license)
in full HTML output, but not with -Ofragment, e.g. in man.cgi(8); suggested by Thomas Klausner <wiz at NetBSD>
Diffstat (limited to 'html.c')
-rw-r--r--html.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/html.c b/html.c
index e644fa21..65827058 100644
--- a/html.c
+++ b/html.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -771,6 +771,32 @@ print_gen_decls(struct html *h)
}
void
+print_gen_comment(struct html *h, struct roff_node *n)
+{
+ int wantblank;
+
+ print_word(h, "<!-- This is an automatically generated file."
+ " Do not edit.");
+ h->indent = 1;
+ wantblank = 0;
+ while (n != NULL && n->type == ROFFT_COMMENT) {
+ if (strstr(n->string, "-->") == NULL &&
+ (wantblank || *n->string != '\0')) {
+ print_endline(h);
+ print_indent(h);
+ print_word(h, n->string);
+ wantblank = *n->string != '\0';
+ }
+ n = n->next;
+ }
+ if (wantblank)
+ print_endline(h);
+ print_word(h, " -->");
+ print_endline(h);
+ h->indent = 0;
+}
+
+void
print_text(struct html *h, const char *word)
{
if (h->col && (h->flags & HTML_NOSPACE) == 0) {