tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Abigail G <dev@placeviolette.net>
To: tech@mandoc.bsd.lv
Subject: [PATCH] man.cgi: support inserting HTML code into <HEAD>
Date: Mon, 07 Nov 2022 12:49:55 -0500	[thread overview]
Message-ID: <4d6a587e4edb6a4bd7fc6c5a790e3cf9e16ed7a6.camel@placeviolette.net> (raw)

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


                 reply	other threads:[~2022-11-07 17:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d6a587e4edb6a4bd7fc6c5a790e3cf9e16ed7a6.camel@placeviolette.net \
    --to=dev@placeviolette.net \
    --cc=tech@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).