The commands on the XHTML and XML menus, and the corresponding buttons in the XHTML palette, let you create new elements at the insertion point within the document. To use the commands from the XHTML and XML menus, place the cursor at the desired position and choose the element type.
When creating new elements, it is important to select an insertion point, not some text nor a single character: if the current selection is not empty, Amaya tries to transform the selected part into the element type chosen.
Sometimes elements cannot be created at the chosen location because of the constraints imposed by the HTML language. Amaya then tries to create the element at the closest valid position. For example, if the insertion point is at the end of the last line of a paragraph when you click on the Heading 2 button , Amaya creates the new heading after the paragraph.
In some other cases, Amaya changes the existing structure for creating the desired element at a valid position. If the insertion point is somewhere within a list item (li) when you create a heading, the item and its enclosing list are automatically split, in order to create the requested heading at the chosen position and to comply with the HTML DTD.
To create elements in the document head
, use the
XHTML/Structure submenu. This menu is enabled only when the
selection is in the head
of the document. The head
is displayed only in the Structure view. This view
should then be open. Put the cursor at the desired position and choose the
element type from the Structure submenu.
The Structure submenu also enables you to create comments. Comments are shown only in the Structure view, but they can be inserted at any position in the document.
Some HTML elements are constituted by several other elements of different
types. For instance, a table usually contains a caption
(caption
), several rows (tr
), and several cells
(td
or th
) in each row.
When Amaya creates such elements, it also creates their components. A table is created with a caption and a few rows containing several cells. The insertion point is placed automatically in the first of these components. You can enter the content of that component immediately or later. You can move to the next (empty) component with the mouse or with the arrow keys.
When you are writing a new document or a new part in a document, you can create elements sequentially by pressing the Enter (or Return) key. The current element is terminated and a new one is created immediately after.
Most often, the new element created is simply a paragraph, whatever the type of the previous element. You can change the element type by selecting the desired type from the XHTML menu or by clicking the corresponding button in the XHTML palette. You can also keep typing and change the element type later on.
When the cursor is at the end of a pre
formatted element,
hitting the Enter key creates a new line in the pre
. To create
another element, say a paragraph, after the pre
, you have to
select the whole pre
element with the F2 key and to
press Enter.
In the same way, you can create a new paragraph after a table by selecting the whole table and pressing Enter.
When a whole element like h2
or li
is selected
the Enter key creates a new h2
or li
after.
When a paragraph or another block of text is styled terminated by an anchor or a character string in bold, italic or other such style moving the insertion point to the end and typing new text appends characters to the anchor or the styled string.
To exit an anchor or styled element and enter plain text:
When the insertion point is in an empty element, pressing the Enter key replaces that element by another empty element at the next higher level in the document structure. This feature allows you to create complex, nested structures very quickly.
As an example, consider the following structure:
A paragraph in the first item
To create the above structure:
The Enter key works in the same way when the insertion point is at the beginning of an element, but it creates new elements before the current element. For example, to add a list item between the first two items in the above structure, place the cursor at the beginning of the second list item, and press the Enter key twice.
Note:á This use of the Enter key does not apply only to lists and paragraphs, but to all elements.
To edit the document title:
Note:ááá
You can also edit the document title from the Structure view.