Tag Handlers
A tag handler is an arbitrary piece of Java code that implements interface TagHandler.
A tag handler can do anything you want it to. hoglet has a number of core tag handlers built in that perform certain actions on the content of tags, anything from formatting Java code to creating tables. A tag handler can do more than that though, for instance you may want to create a tag handler that will replace the tag in the source text with a table of the current currency exchange rate.
A tag handler can also support options. Options are there to modify the behaviour of the tag handler, or they can be used to actually generate the content to replace the tag. The action taken and options supported is down to the tag handler implementation.
A tag handler can do anything you want it to. hoglet has a number of core tag handlers built in that perform certain actions on the content of tags, anything from formatting Java code to creating tables. A tag handler can do more than that though, for instance you may want to create a tag handler that will replace the tag in the source text with a table of the current currency exchange rate.
A tag handler can also support options. Options are there to modify the behaviour of the tag handler, or they can be used to actually generate the content to replace the tag. The action taken and options supported is down to the tag handler implementation.
Processing content
When the convert(org.hoglet.data.Tag, java.lang.String) method is called for the tag handler, the isAutoExpandContent() method is called first. The result of this call will tell the processor what to do with the content. If true is returned then the child tags (if any) within the tag will be expanded first and then passed as the content parm to the convert method. If false is returned then null will be passed and the tag handler should process it's child tags itself to generate the content of the tag.
It is up to the tag handler implementation to decide whether the value returned from the isAutoExpandContent method is respected.
It is up to the tag handler implementation to decide whether the value returned from the isAutoExpandContent method is respected.
Default Handler
You can customize how hoglet processes plain text (i.e. content of tags or text without a tag) by specifying a tag handler that maps to tag: _default. If a handler is provided for that tag then hoglet will use that handler to process the text. If no handler is provided then hoglet will use it's built-in processing method to process the text.