From 92313ed7f021e8c60b5432d68b33d5fff17e1892 Mon Sep 17 00:00:00 2001 From: jfieber Date: Sat, 5 Oct 1996 23:38:55 +0000 Subject: [PATCH] Some new options for the FreeBSD web pages. These are for the moment not officially documented and are subject to change. -hdr and -ftr Specify files to insert at the top and bottom of every page. This is similar in result to the existing -ssi option but everything happens at build time. If the string @@UPDATED@@ appears in either file it will be replaced with "Updated" followed by the current date. -white Make the pages black text on white background. --- usr.bin/sgmlfmt/sgmlfmt.pl | 43 ++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/usr.bin/sgmlfmt/sgmlfmt.pl b/usr.bin/sgmlfmt/sgmlfmt.pl index 21f43bfb98c4..7c3ee2714b6f 100755 --- a/usr.bin/sgmlfmt/sgmlfmt.pl +++ b/usr.bin/sgmlfmt/sgmlfmt.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: sgmlfmt.pl,v 1.15 1996/09/29 19:42:51 jfieber Exp $ +# $Id: sgmlfmt.pl,v 1.16 1996/10/01 16:23:39 jfieber Exp $ # Copyright (C) 1996 # John R. Fieber. All rights reserved. @@ -361,7 +361,8 @@ sub html2html { $header[$st_ol[$sc]] = "$doctype\n\n\n$st_header[0]\n" . - "\n\n"; + "\n$BODY\n"; + $header[$st_ol[$sc]] .= $html_header; if ($opt_ssi) { # Server Side Include hook $header[$st_ol[$sc]] .= ""; @@ -369,6 +370,7 @@ sub html2html { $header[$st_ol[$sc]] .= "\n

$st_header[0]

\n"; $footer[$st_ol[$sc]] = "\n"; + $footer[$st_ol[$sc]] .= $html_footer; if ($opt_ssi) { # Server Side Include hook $footer[$st_ol[$sc]] .= ""; @@ -393,13 +395,15 @@ sub html2html { # set up headers and footers if ($st_sl[$sc] > 0 && $st_sl[$sc] <= $maxlevel) { $header[$st_ol[$sc]] = - "$doctype\n\n\n$_\n\n\n"; + "$doctype\n\n\n$_\n\n$BODY\n"; + $header[$st_ol[$sc]] .= $html_header; if ($opt_ssi) { # Server Side Include hook $header[$st_ol[$sc]] .= ""; } - $header[$st_ol[$sc]] .= "\n$navbar[$st_ol[$sc]]\n
\n"; - $footer[$st_ol[$sc]] = "
\n$navbar[$st_ol[$sc]]\n"; + $header[$st_ol[$sc]] .= "\n$navbar[$st_ol[$sc]]\n
\n"; + $footer[$st_ol[$sc]] = "
\n$navbar[$st_ol[$sc]]\n"; + $footer[$st_ol[$sc]] .= $html_footer; if ($opt_ssi) { # Server Side Include hook $footer[$st_ol[$sc]] .= ""; @@ -659,7 +663,7 @@ sub extlink { sub main { # Check arguments - if (!&NGetOpt('f=s', 'links', 'ssi', 'i:s@')) { + if (!&NGetOpt('f=s', 'links', 'ssi', 'i:s@', 'hdr=s', 'ftr=s', 'white')) { &usage; exit 1; } @@ -676,6 +680,10 @@ sub main { # Generate output if ($opt_f eq 'html') { + if ($opt_hdr) {$html_header = &gethf($opt_hdr);} + if ($opt_ftr) {$html_footer = &gethf($opt_ftr);} + if ($opt_white) {$BODY = "";} + else {$BODY = ""} &gen_html(); } elsif ($opt_f eq 'latex' || $opt_f eq 'latex') { @@ -713,3 +721,26 @@ sub main { exit 0; +sub getdate { + @months = ("January", "February", "March", "April", "May","June", + "July", "August", "September", "October", "November", "December"); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year += 1900; + return "$months[$mon] $mday, $year"; +} + +sub gethf { + local ($file) = @_; + + $date = &getdate; + $data = ""; + + if (open(IN, $file)) { + while () { + s/\@\@UPDATE\@\@/Updated $date/; + $data .= $_; + } + close(IN); + } + return $data; +}