* [PATCH] man.cgi: support inserting HTML code into <HEAD>
@ 2022-11-07 17:49 Abigail G
0 siblings, 0 replies; only message in thread
From: Abigail G @ 2022-11-07 17:49 UTC (permalink / raw)
To: tech
Similar to the header.html and footer.html files, this allows
downstream users to include their own set of meta and other tags.
Index: cgi.c
===================================================================
RCS file: /cvs/mandoc/cgi.c,v
retrieving revision 1.180
diff -u -r1.180 cgi.c
--- cgi.c 6 Jul 2022 17:21:04 -0000 1.180
+++ cgi.c 7 Nov 2022 17:32:35 -0000
@@ -413,11 +413,14 @@
printf("(%.*s)", secsz, sec);
fputs(" - ", stdout);
}
- printf("%s</title>\n"
- "</head>\n"
- "<body>\n",
+ printf("%s</title>\n",
CUSTOMIZE_TITLE);
+ resp_copy(NULL, MAN_DIR "/head.html");
+
+ printf("</head>\n"
+ "<body>\n");
+
return resp_copy("header", MAN_DIR "/header.html");
}
Index: man.cgi.3
===================================================================
RCS file: /cvs/mandoc/man.cgi.3,v
retrieving revision 1.4
diff -u -r1.4 man.cgi.3
--- man.cgi.3 15 Mar 2017 13:18:53 -0000 1.4
+++ 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
Index: man.cgi.8
===================================================================
RCS file: /cvs/mandoc/man.cgi.8,v
retrieving revision 1.24
diff -u -r1.24 man.cgi.8
--- man.cgi.8 6 Jul 2022 15:47:28 -0000 1.24
+++ 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.
--
To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-07 17:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 17:49 [PATCH] man.cgi: support inserting HTML code into <HEAD> Abigail G
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).