Apama 10.7.2 | Developing Apama Applications | Developing Apama Applications in EPL | Generating Documentation for Your EPL Code | Inserting EPL source code examples
 
Inserting EPL source code examples
ApamaDoc supports the <code>...</code> tag in ApamaDoc comments. You can use this tag to specify code snippets as part of the comment. In this case, you need not specify the comment character (*) at the beginning of each line.
The ApamaDoc <code> tag is a block element, and is not the same as the HTML <code> tag that is used for inline markup. Unlike the HTML <code> tag, the ApamaDoc <code> tag preserves the indentation and line breaks of the code snippet. You need not use the HTML <br> tag to force a line break.
If you want to mark up pieces of program code within the running text, use the HTML tag <tt>.
In many cases, you can enter the less-than (<) and greater-than (>) signs as they are. However, you need to take care when you have text that is enclosed in these signs in your comment and which has no spaces between the text and these signs (for example, sequence<string>). This will be interpreted as an HTML tag. To avoid this, we recommend that you always add spaces (for example, sequence< string >). If this is not possible for your particular use case, you have to use the &lt; and &gt; entities instead (for example, sequence&lt;string&gt;). So check the generated result carefully if you are using these signs.
Example:
/**
* This is an example of a comment.
*
* When using the <tt>code</tt> tag, all indentation and line breaks
* are preserved.
<code>
sequence< string > s :=
["Something", "Completely", "Different"];
print ", ".join(s);
</code>
* Note that the above < and > signs will be generated unchanged
* because spaces have been added.
*/
Note:
If you have to use the special symbol @ within the ApamaDoc <code>...</code> tag, you must use the HTML ASCII code &#64; instead of the symbol. Otherwise, this will be interpreted as an ApamaDoc tag (such as @param).