Contents |
We maintain a small number of tools that you may find useful when editing web pages on lab-managed Linux computers. To access these, you may want to add /anfs/www/tools/bin to your PATH environment variable.
cl-web-view
Opens a a web page in a web browser by converting a specified Linux filename on the departmental filer into a corresponding http URL, which it then passes on to firefox.
For example:
$ cd ~mgk25/public_html/
$ cl-web-view file.html
The above is equivalent to calling
$ firefox https://www.cl.cam.ac.uk/~mgk25/file.html
This tool not only knows about the various directories that the CL main web server exports directly. It also uses a database of symbolic links that extend the http-exported filespace. This link database is updated every night.
Using cl-web-view file.html instead of firefox file.html has several advantages, because the HTTP server adds metadata to the web page, and adjusts URLs in links, without which a page (or the links in it) might not display correctly. For example:
- Character set: The HTTP header “Content-Type: text/html; charset=utf-8” ensures that the web page is displayed with the correct character set (UTF-8), whereas previewing a page via file:// will try to display non-ASCII characters according to ISO 8859-1.
- index.html: For URLs ending in a slash (“/”) the HTTP server automatically serves the corresponding index.html file, whereas a file:// URL would just show a directory listing.
- Absolute pathnames: For URLs starting with a slash (“/”) in a link a web page accessed via file:// would incorrectly resolve this from the root of the Unix file system, rather than from the root of the web site.
- Redirects: Some URLs in web pages only lead to the correct page if an HTTP server and client follow Redirect directives (e.g., specified in .htaccess files).
htmlcheck
Performs a HTML 4.0 syntax check, using the nsgmls SGML parser and the W3C document-type definitions.
For example:
$ htmlcheck *-b.html
$ ucampas-xargs htmlcheck
Make sure your HTML document starts with this line, to help the checker to load the correct document-type definition:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">