Code clean up

Most word processors can export documents in HTML, but they often produce very bad HTML code. Amaya provides a Code clean-up command that allows these documents to be improved. That command removes deprecated elements like <font>, <basefont>, <center>, <dir>, <menu>, <applet>, <isindex>, <s>, <u>, and <strike> without loosing the content of these elements.

These tools have also a tendency to generate a lot of lang and style attributes. A better solution is to set this information at a higher level (a lang attribute at the <body> or <div> level, a generic style rule instead of a lot of style attributes).

The removing of all these lang and style attributes may be a tedious task which is fortunately performed by the Code clean-up command. It removes these attributes except if they apply to a <div>, a <table>, a <span>, or an <img> element.

Restructuring documents

Changing type

To change the type of an existing element, select it and choose the new type in the Insert menu, or in the Elements tool. You can change that way a numbered list (ol) into an unnumbered list (ul) or a paragraph into a heading or a list, for instance.

Element types offered by the submenus Information type and Character element of the Insert menu work as toggles. If you select some plain text and activate one of these commands, the selected text will be turned into an element of the chosen type. Conversely, if you select an element of a type listed in these submenus and you activate the corresponding menu item, the element is removed from the document, but its content is kept.

Tout select a whole element, put the insertion point anywhere within this element and press key F2.

The transform command

The Transform command from the Tools menu performs complex structure transformations, based on a language that specifies how a given structural pattern can be transformed into a different structure. For example, nested lists can be transformed into a table and back again.

Available transformations

The available transformations are defined in the file Amaya/amaya/HTML.trans. Please refer to the document "Using the HTML.trans file" for a description of the language in which the transformation rules are written.

Additional transformations may be specified in the HTML.trans file. Some transformations are provided in the HTML.trans file as examples.

Using the transform command

The Transform command displays a menu that lists all the transformations that can be applied to the current selection. You just have to choose the transformation you want.

Inserting a division

You can easily group a set of paragraphs, headings, lists, tables, and so on within a division. To do this, select the elements you want to group, and then select Division (div) from the Insert menu or use button Division button in the Elements tool.

Merging elements

You can merge successive elements, even if they are not at the same level in the document structure, by using the Backspace and Delete keys. When the insertion point is at the end of an element, use the Delete key to merge; when it is at the beginning of an element, use the Backspace key. In both cases, these keys do not delete any characters; instead they merge elements previously separated by a structure boundary.

Note that when the insertion point is within an element, the Backspace and Delete keys delete the next or previous character as usual.