factor out common HTML header output into 'html_header' function
authorTomas Pospisek <tpo_hp@sourcepole.ch>
Fri, 23 Jan 2015 23:56:02 +0000 (00:56 +0100)
committerTomas Pospisek <tpo_hp@sourcepole.ch>
Sat, 24 Jan 2015 00:02:55 +0000 (01:02 +0100)
dohtml

diff --git a/dohtml b/dohtml
index 62eea00..d3a8bd1 100755 (executable)
--- a/dohtml
+++ b/dohtml
@@ -2,6 +2,25 @@
 
 htmldir=/org/bugs.debian.org/www/bugscan
 
+header() {
+       local   title="$1"      # Title of page
+       local   date="$2"       # Date
+
+       cat <<EOF
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>$title, $date</title>
+  </head>
+<body bgcolor="white">
+<h1 align="center">$title</h1>
+
+<h2 align="center">$date</h2>
+
+EOF
+}
+
 realmakepage() {
        local   filter="$1"     # Distributions to list
        local   title="$2"      # Title of page
@@ -18,17 +37,9 @@ realmakepage() {
 
        filter="$filter $worry"
 
-       cat <<EOF
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>$title, $date</title>
-  </head>
-<body bgcolor="white">
-<h1 align="center">$title</h1>
+       header "$title" "$date"
 
-<h2 align="center">$date</h2>
+       cat <<EOF
 
 <p align="center">for distribution(s): $descr</p>
 
@@ -76,17 +87,10 @@ EOF
 }
 
 makemainpage() {
-       cat <<EOF
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>$title, $time</title>
-  </head>
-<body bgcolor="white">
-<h1 align="center">$title</h1>
 
-<h2 align="center">$time</h2>
+       header "$title" "$date"
+
+       cat <<EOF
 
 <p align="center">
 EOF