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.
The XHTML palette provides direct access to:
code
( ), insertion ( ), and
For more information see the list of all HTML 4.0 elements.
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.
HTML defines inline elements that allow you to attach style to character strings. See Creating HTML Style Elements to create such elements.
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.
The XHTML/Insert time stamp menu entry allows you to insert the current date either in the ISO format (YYY-MM-DD) or in the European format (DD-MM-YYYY). The date format is fixed by the Preference menu.
Once the date is inserted, Amaya automatically updates it each times the document is saved and so maintains the last update date.
Amaya removes insignificant white-space characters when it loads a document unless they must be explicitly preserved. This is true for XHTML, MathML, and SVG documents, as well as MathML or SVG elements included in a HTML document,
The following are considered as insignificant white-space characters:
#xD
and #xA
)#X9
)To preserve all the characters for some elements, use the
xml:space
attribute or the PRE
element (only valid
for XHTML documents). The possible values for the xml:space
attribute are default
and preserve
.
default
means that an applications' default
white-space treatment is acceptable for these elements. In Amaya, the
default treatment removes the insignificant white-space characters for
all supported DTDs (see above). preserve
indicates that applications will
preserve all the characters, except the first one that immediately
follows the end tag of the element where it is specified, if that element
is an end of line.You apply the xml:space
attribute to all elements within the
content of the element where it is specified, unless it is overriden with
another instance of the xml:space
attribute.
In an XHTML DTD, the PRE
element causes the same behavior as
the xml:space
attribute with the value preserve
.
Amaya applies white space handling when it loads a document, not during editing. A consequence is that if you type insignificant white-space characters, they will be visible and saved but will be removed the next time the document is loaded. For example, the following source code:
<p>Amaya removes the <strong> insignificant white-space
</strong>when it loads ...</p>
displays as follows during editing:
Amaya removes the insignificant white-space when it
loads...
The text will be saved with that syntax. However, the next time the document is loaded, the text will display as:
Amaya removes theinsignificant white-spacewhen it
loads...
because the leading and trailing spaces of the element
<strong>
are considered to be insignificant and are
removed.
The correct source code would be:
<p>Amaya removes the <strong>insignificant
white-space</strong> when it loads ...</p>
By default Amaya removes insignificant white-space
characters.
It is possible to resquest to "Keep multiple spaces" in Preference dialog. In this case, Amaya will
remplace insignificant white-space characters it should to remove by no-break
spaces.