# HTML Utilities

HTML Utilities menu | HTML Utilities menu with option key pressed

Colors...
You can define and name colors to use as background, text and link color etc. on your www pages. Later, when you insert an element with a color attribute, you can choose the color for the attribute from a menu. A set of 16 basic colors is provided by default. These are the 16 color names defined in HTML 4.0. The predefined colors do not show up in this dialog because you are not allowed to change them.

The 16 predefined colors

| Black = "#000000" |  | Green = "#008000"
| Silver = "#C0C0C0" |  | Lime = "#00FF00"
| Gray = "#808080" |  | Olive = "#808000"
| White = "#FFFFFF" |  | Yellow = "#FFFF00"
| Maroon = "#800000" |  | Navy = "#000080"
| Red = "#FF0000" |  | Blue = "#0000FF"
| Purple = "#800080" |  | Teal = "#008080"
| Fuchsia = "#FF00FF" |  | Aqua = "#00FFFF"

In the popup menu in the dialog window shown above are all color names you have defined. Below is the hexadecimal number corresponding to the color selected in the menu.

Tip: Use the up and down arrows to navigate in the menu.

New:
To define a new color with a color picker.

Change:
To change a color with a color picker.

Remove:
To remove the color selected in the menu.

View:
To view a color in a color picker. (Clicking OK and Cancel in this picker have the same effect. No changes are saved.)

New by number:
To define a new color by specifying its hexadecimal number #RRGGBB in the dialog window shown below.

Change number:
To change a color by changing its hexadecimal number #RRGGBB.

Home Pages...
To define which folders contain the files of different sites, see the section about how to configure HTML mode.

Footers...
A footer is a file with text which you automatically can put into the BODY of the document when you create a new document. To use this function,

- first create a file with the text which you want to use on many of your pages -- for example, directory buttons, your address etc.
- then define the file to be a footer.

When you later use "New document" you can select this file from a menu, and its content will be put inside the BODY element.

These files can of course contain any kind of text but I call them footers because my basic idea is that they should contain things you put at the bottom of every page.

In the popup menu in the dialog window shown below are the file names of the footers you have defined. Below is the full path corresponding to the file selected in the menu.

New:
Presents you with a file dialog to pick a file with a footer. This does not insert any text in your document. It only defines a file to be a footer.

Remove:
Removes the footer selected in the menu. Note: this does not delete the file. It is just no longer a footer.

Insert:
Inserts the footer selected in the menu in the document.

Key Bindings...
To redefine the key bindings in the menus. See the section about key bindings.

Editing | Functions for easier and quicker editing.
Validate | Functions to validate the HTML code.
Character Translation | To translate characters to and from their HTML entities.
URLs | Everything for managing the URL cache.
Windows | Everything for managing the window cache.
Check Links | Functions to scan files in your home page folder and check that all links, HREFs SRCs etc. point to files which exist.
Includes | Functions to dynamically include files in your document.
Home Page Windows | Windows with lists of your files from where you can copy and paste links.
Extend | To add new HTML elements, or new attributes to existing elements, to HTML mode.

Reformat Paragraph
If there is a selection the code is reformat within the selection, otherwise it is reformatted in the paragraph of the current position. A paragraph is in this case defined to be everything between the nearest blank lines.

Reformat Document (option)
Reformats the whole document.

The reformatting is basically done such that the document would look as if you have typed it from top to bottom without changing anything. The following is done:

- Everything between SCRIPT, STYLE, and PRE tags as well as everything inside comments is left untouched.
- Line breaks are never inserted inside attribute values. If there is an attribute ATTR="blah blah", then "blah blah" is never broken into two lines. This is in particular to prevent that the event handlers are broken into two lines.
- Provided these constraints Alpha inserts line breaks and blank lines at appropriate places and indents the code where it should be indented, and otherwise tries to make the lines approximately equally long.

Unfortunately reformatting of the code is rather complex and therefore not lightning fast.

Save to FTP Server
First saves the window to the disk and then uploads it to your ftp server. See the section how to configure HTML mode such that it knows which server to upload the file to.

Alpha needs a helper application to do the uploading. Fetch, Anarchie, and NetFinder are the three ftp applications Alpha can talk to. Unfortunately, NetFinder doesn't send any error message back to Alpha if something goes wrong with the upload, for example that the password is wrong or the server isn't responding. Therefore, if you're using NetFinder Alpha always assumes that the upload was done without problems.

If Alpha doesn't know your password you are asked for it. (The textbox is made so narrow that it is impossible to see what you type.)

Forget Passwords (option)
Makes Alpha forget all passwords, except those which you specified when you configured HTML mode.

Move Files...
To move files between different folders, automatically updating all links which points to any of these files in every file in a home page folder, as well as updating all links in the moved files. Alpha updates both HTML links, HREF="...", SRC="..." etc. and CSS links, url("...").

- First you are asked to select the folder which contains the files you want to move.
- Then you are asked to select the files you want to move from this folder.
- And then you are asked to select the destination folder.

Alpha then moves the files and then asks you if you want to update all links (this is the whole point of this function, so a 'yes' should be appropriate, but it gives you a chance to abort the update if you have moved the wrong files). Depending on if you have moved files in a home page folder or an include folder, the following will happen.

- If you have moved files in a home page folder the links in all HTML and CSS files (as determined by the suffix mapping) pointing to the moved files will be updated. Thereafter all links in the moved files are updated.
- If you have moved files in an include folder all include tags in the HTML files in the home page folder pointing to the moved files are updated.

Updating links may take a little while if you have very many files but should in most cases be a lot faster than to make the changes manually.

Limitations:

- Alpha only searches for strings like HREF="file" without checking that they are inside a tag. This means that Alpha could find links, which actually are not links. This should only be a problem if your making pages about HTML.
- You can only move files between subfolders in one home page folder, not between the different home page folders.
- Only files in the home page folder where you move files are updated, not the files in any other home page folder.

### Renaming files

Sometimes you want to rename a file, but find it too painful to change all links to the file. Fortunately Alpha can help you. To change the links to a renamed file do like this:

- Create a fileset of the type fromHiearachy of all your HTML files. Filesets are created using the fileset menu, the one with the menu icon of two Alpha documents.
- Use 'Replace in fileset' to replace 'oldfile.html' to 'newfile.html' in all HTML files.

Last Modified...
Adds tags to the document which makes it possible to automatically add the date and time when the document is saved. Two tags inside HTML comments are inserted:

`<!-- #LASTMODIFIED TEXT="some text" FORM="date format" -->`
some text and date
`<!-- /#LASTMODIFIED -->`

Whenever the document is saved the date is changed. Don't write anything between the comment tags. It will be removed when the document is saved.

Character translation is done automatically of the text and date.

In the dialog window shown above you can specify:

- the text before the date. (Default: Last modified)
- the date format, long, abbreviated or short. On an American system these are:
  Saturday, October 19, 1996 9:10 PM
  Sat, Oct 19, 1996 9:10 PM
  10/19/96 9:10 PM
- if the weekday should be included in the date. (Does not apply to the short format.)
- if the time should be included in the date.

If you want to change how the date is displayed, just use 'Last modified' again and the tags will be replaced. It is not possible to have more than one pair of tags in a document.

Note! The short time format can be confusing. For example 4/5/98 means 4 May 1998 in some parts of the world and April 4, 1998 in other parts.

Document Type...
Inserts a document type declaration at the top of the document. If there already is one, it is replaced.

Document size
Calculates the size of the current window including images etc. The following limitations apply:

- For documents with frames, the images etc. in the individual frames are not included.
- Images etc. loaded by external style sheets are excluded.
- Java applets are excluded.
- Remote sources are excluded.

Document index...
Makes an index of the document with an item for each header H1-6. If there already exists an index in the document it is replaced, otherwise a new one is inserted at the current position.

The index can be done using either PRE or an UL list. When Alpha makes the index it goes through the window and looks for all headers. If there is an anchor <A NAME="..."> inside a header that anchor is used when building the index, otherwise an anchor is inserted inside the header. Alpha then inserts

`<!-- #DOCINDEX TYPE="PRE,3" -->`
the index
`<!-- /#DOCINDEX -->`

The index consists of a list with links to the various headers.