void-packages/srcpkgs/mdocml/patches/cgi-head.patch

61 lines
1.8 KiB
Diff

allows for injecting html into <head> for man-cgi
https://inbox.vuxu.org/mandoc-tech/4d6a587e4edb6a4bd7fc6c5a790e3cf9e16ed7a6.camel@placeviolette.net/T/#u
--- a/cgi.c
+++ b/cgi.c
@@ -408,11 +408,14 @@
printf("(%.*s)", secsz, sec);
fputs(" - ", stdout);
}
- printf("%s</title>\n"
- "</head>\n"
- "<body>\n",
+ printf("%s</title>\n",
CUSTOMIZE_TITLE);
+ resp_copy(MAN_DIR "/head.html");
+
+ printf("</head>\n"
+ "<body>\n");
+
resp_copy(MAN_DIR "/header.html");
}
--- a/man.cgi.3 15 Mar 2017 13:18:53 -0000 1.4
+++ b/man.cgi.3 7 Nov 2022 17:32:35 -0000
@@ -240,8 +240,10 @@
.It Ft void Fn resp_begin_html "int code" "const char *msg" "const char *file"
This generator calls
.Fn resp_begin_http
-to print the HTTP headers, then prints the HTML header up to the
-opening tag of the <body> element, then copies the file
+to print the HTTP headers, then prints the HTML header, then copies the file
+.Pa head.html
+to the output, if it exists and is readable, then prints up to the opening tag
+of the <body> element, then copies the file
.Pa header.html
to the output, if it exists and is readable.
If
--- a/man.cgi.8 6 Jul 2022 15:47:28 -0000 1.24
+++ b/man.cgi.8 7 Nov 2022 17:32:35 -0000
@@ -199,6 +199,7 @@
for this purpose.
The files
.Pa manpath.conf ,
+.Pa head.html ,
.Pa header.html ,
and
.Pa footer.html
@@ -380,6 +381,10 @@
.Sx Restricted character set ,
.Nm
reports an internal server error and exits without doing anything.
+.It Pa /man/head.html
+An optional file containing static HTML code to be inserted right before
+closing the <HEAD> element.
+For example, it can contain additional <META> tags or <LINK>s to other resources.
.It Pa /man/header.html
An optional file containing static HTML code to be wrapped in
a <HEADER> element and inserted right after opening the <BODY> element.