HTMLUtils  -  Web utilities

by Alan Wrigley

HTMLUtils provides two very useful functions for Acorn users who enjoy browsing the Web. These functions overcome two irritations that often afflict users:

1. Although it is possible to save HTML files to disc from most Acorn browsers while browsing, together with any images used on the pages, these images often have full or relative pathnames built into them. In order to view the pages correctly from disc, the source file must be laboriously searched for pathnames so that these can be edited manually to enable the images to be found when the page is displayed.

2. When reading newsgroups, email or magazines, you often come across Web URLs that sound interesting. In order to follow these up when you are next on line, you have to make a note of them first of all, and then type them into your browser's dialogue box when next logged on, with the consequent risk of typing errors.

HTMLUtils helps you to minimise both these problems. It will search a file for image names and remove pathnames, and it will also scan a text file for anything resembling a URL, which it will then add to an HTML document (or compile a new document) full of 'bookmarks' ready for you to click on a link when you are next on line.

The application is run in the usual way from the RISC User menu system or by double-clicking on its icon in a directory viewer. An icon is installed on the icon bar. Clicking on this icon with Select or Adjust opens the main window, which is initially divided into two sections. In the upper section, a pair of radio icons allow you to select which of the program's two functions you wish to perform. If you choose the Strip pathnames option, two option icons also become available. These allow you to choose whether to strip tags from images or from hypertext links, or both. The default settings are Strip pathnames and Images.

If the Strip pathnames option is selected, dragging a file to the window or the icon bar icon will place the filename in the writable icon in the window's lower section. Clicking on the Save icon will process the file, strip the pathnames according to the options set, and save the file back. You can of course edit the filename, or drag the file icon to a directory viewer in normal RISC OS fashion.

When the Add to bookmark radio option is selected, a third section of the window opens, containing two icons onto which files should be dropped. The icon labelled Input file is for the file which you want to search for URLs (it may be of any filetype but the program will assume that any URLs in the file will appear in text form). Dropping a file onto this icon will cause it to be scanned, and a second window will open listing any URLs that are found. This will be any text string that starts with "http://", "ftp://" or "gopher://". Any of the following characters will be taken to be the end of the URL: carriage return, linefeed, space, full stop followed by space, quotation mark, comma, and any brackets, i.e. ()<>{}[].

Once the window containing the list is open, you can add some descriptive text for that item. This will be the text that actually appears in the Web browser for that link when the bookmark document is loaded. To add the text, click over any item on the list and a dialogue box will open, into which you can type the text you want. Clicking on OK or pressing Return will set the text for that item. So if, for example, the input file contains the URL:
http://www.cybervillage.co.uk/acorn/
then you may want to add the description "Acorn Cybervillage". When the bookmark file is subsequently loaded into a Web browser, the text "Acorn Cybervillage" will appear, carrying a link to the URL.

To create the bookmark file, either drag an existing HTML document onto the Output file icon, or enter a filename into the writable save icon or drag the file icon to a directory viewer in the normal way. If the file you save does not already exist, a new file will be created. If the file does exist the links will be added to the end of that file. Note that the file must contain both the following closing tags: </body> and </html>. The tags must appear in that order, but they do not need to be adjacent to one another. If either of these is missing then an error is generated. Provided both tags are present, the new items will be added before the </body> tag.

Copyright  Rheingold Enterprises 1996
 