A code snippet is a fragment of ready-to-use source code. It can easily be inserted into a document using an associated keyword (a keyboard shortcut). The extension offers two types of snippets:
FreeMarker snippets
These snippets represent all the instructions (directives) of the FreeMarker language in version 2.3.28.
There are two types of snippet:
snippet without parameters: This is inserted into the document without the user needing to complete it (e.g. <#break/>, <#continue/>, <#flush/>, etc.),
snippet with parameters: This is inserted into the document in the form of a "cloze text" where the user must replace the parameters with their own values. Users navigate among the parameters using the "Tab" key.
A snippet is enabled (inserted) by entering an associated keyword: FreeMarker snippets are enabled by starting input with the "&#" character string then entering the directive name (or a substring contained in this name): a tooltip is displayed with a set of proposals.
The user navigates around the list via the "Up arrow" and "Down arrow" and selects a snippet using the "Tab" or "Enter" key.
NB: All the available FreeMarker snippets can be displayed by simply entering the "&#" character string.
External library snippets
These snippets insert the call for macros and functions defined in the Core, CSS, FO and Adv libraries.
Depending on the nature of these entities, the associated snippets can be with or without parameters (see FreeMarker snippets). When an entity (macro or function) admits mandatory and optional parameters, the associated snippet represents the call to this entity with the mandatory parameters only.
A snippet is enabled (inserted) by entering an associated keyword: Library snippets are enabled by starting input with the "&@" character string for macros or the "&$" character string for functions, then entering the name of the library concerned ("core" or "css" or "fo" or "adv") and finally, the directive name (or a substring contained in the name): a tooltip is displayed with a set of proposals.
The user navigates around the list via the "Up arrow" and "Down arrow" and selects a snippet using the "Tab" or "Enter" key.
Note: When activating certain snippets from the FO library, inserting a hardisFo macro inserts a nested macro: This is due to the fact that the XSL-FO tag associated with the enclosing macro must have a child XSL-FO tag characterized by the enclosed macro. This is automatically added to facilitate input.
All the available library snippets can be displayed by simply entering the "&@" (lists the macros) or "&$" (lists the functions) character string.
Template model snippets
These snippets rapidly create an APE template based on a predefined model.
The following models are proposed:
minimalDoc: A minimal document model with an elementary page layout,
regionsDoc: A document model in A4 portrait format including margins and top/bottom/right/left regions with an elementary page layout,
oddevenDoc: A document model in A4 portrait format including margins and top bottom regions with an odd and even page layout.
A snippet is enabled (inserted) by entering an associated keyword: Template model snippets are enabled by starting input with the "@!" character string then entering the model name (or a substring contained in this name): a tooltip is displayed with a set of proposals.
The user navigates around the list via the "Up arrow" and "Down arrow" and selects a snippet using the "Tab" or "Enter" key.
All the available model snippets can be displayed by simply entering the "&@!" character string.