Lab Assignment, Foundations of Computing

Hints added January 24 2001. Click your browser's Reload or Refresh button to get the latest version.


Construct a web page by putting a file named z-test.html in the web subdirectory of your login directory. This page will be available on the web at http://grace.evergreen.edu/~username/z-test.html. Prepare the file and make it display properly, following these instructions:

Start with the TeX file with your last name in the /usr/users4/fofc/z2html/tex directory. For example the instructor's TeX file is jacky.tex.

Create your HTML file by using programs in the /usr/users4/fofc/z2html/bin directory. The sed program z2html.sed performs most of the processing, reading TeX from the standard input and writing HTML to the standard output. The awk program paragraph.awk does some post-processing, reading HTML from the input and writing HTML to the output.

The z2html-cmd script in the z2html/bin directory shows one way to coordinate the programs. It takes the name of the TeX file as its only argument and writes the HTML to standard output. However it only works when the script, the sed program, and the awk program are all in the working directory.

When you have an HTML file, edit it to add a horizontal rule and your name at the bottom. See http://grace.evergreen.edu/~jackyj/z-test.html

The HTML file will only display properly if there is a subdirectory named zimg in your web subdirectory, containing all the GIF's mentioned in the HTML file. There is an example at /usr/users4/fofc/z2html/zimg

The HTML file will only display properly in some browsers if there is a zed.css file in your web subdirectory. There is an example at /usr/users4/fofc/z2html/html/zed.css

(The TeX files are excerpted from these Z notation examples. The programs and GIFs are from the Z2HTML translator.)

Hints

The z2html-cmd script takes one argument on the command line: the name of the TeX file to translate. It writes the translated HTML output to the standard output. To see the script in action, translating jacky.tex and writing the HTML to your screen, cd into the /usr/users4/fofc/z2html/bin directory and execute this command:


   ./z2html-cmd jacky.tex

You may have to put ./ in front of z2html-cmd (with no spaces) to force the shell to execute the command because the working directory . (dot) may not be in your path when you log in on a machine in the ACC lab. (It seems the working directory is in your path when you log in using telnet --- another one of those little wrinkles.)

Each commands in the pipeline in z2html-cmd has options and arguments. The whole pipeline is


   cat $1 | sed -f z2html.sed | awk -f paragraph.awk

The meaning of each command in the pipeline is
cat $1
Read the file named in the first command line argument and write it to standard output (the next program in the pipeline).
sed -f z2html.sed
Run the sed language interpreter, taking instructions from the script in the file z2html.sed in the working directory. Read text from standard input and write translated text to standard output.
awk -f paragraph.awk
Run the awk language interpreter, taking instructions from the script in the file paragraph.awk in the working directory. Read text from standard input and write translated text to standard output.