Use a bash shell script to create web pages with a pre-formatted header and footer and
save some typing. This assumes you have access to the Linux bash shell (read more on
how to get this for Windows, here or
here).
Here's a simple little script to create web pages using the vi text editor (see this). The bash shell will execute the script. First
it names the new web page, then it pulls in a formatted header for the page and invokes
vi to edit the file. You add something to the title tag and at the
<h1> tag, specify the font, color and size for the text (or include a
link to your CSS file) and you can begin
adding content at the end of the file. When you exit the file - since you're in vi,
type
:!wq
A footer is added to the end of the file. Something like this is a
great time saver.
if [ "$1" = "" ]
then
echo -e "Enter new web page name ... \c"
read "page"
else
page="$1"
fi
# The following creates the correct filename
# regardless of the extension entered ...
page=`echo "$page"|awk -F\. '{print $1}'`
page=${page}.html
# I use tmp to spell check all new files:
echo $page >>tmp
# start with a standard HTML header:
cp pageheader $page
vi $page
# close the file with a standard footer:
cat pagefooter >> $page
# Don't know where the *bak files come from
# but I don't like them ...
if [ -f "*bak" ]
then
rm -f *bak
fi
Notice the reference to a spell checker. If you're running Linux or Cygwin, you can
run apsell check to spell-check any file so you could add this to the bottom
of the script:
aspell check $page
You should always proof-read your web pages anyway but, since I always miss something,
I need all the help I can get.
The web page header might look something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/
loose.dtd">
<html>
<head>
<title>
</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="description" content="Create web pages">
<meta name="keywords" content="bash,shell">
<link rel="stylesheet" type="text/css" href="/my-style.css">
<link rel="shortcut icon" href="/favicon.ico" type="images/x-icon">
</head>
<body>
<center>
<a href="/index.html"><img src="/images/my_logo.jpg" width=492 height=92
border="0" title=" Find More Stuff Here ... "
</center>
<h1 id="my-title">
</h1>
<table width="85%"><tr><td colspan="2" valign="top">
</td></tr><tr><td valign="top">
<center>
<table width="80%"><tr><td valign="top">
<span style="font-family:verdana; font-size:15pt;color:#555522;">
</span>
<blockquote>
<span style="font-family:verdana; font-size:12pt;color:#000000;">
As you can see the header has all the formatting so you just change the title, meta
tags and H1 heading, go to the end of the file and start typing. When you exit the file
(quit vi) the footer file gets appended and you have a complete web page. Here's the
footer for the page:
</span>
</td></tr></table>
</center>
<p>
<a href="index.html">Return to Contents Page<a>
</center>
<p>
</body>
</html>
|