Using hoglet
Using hoglet is easy. Although there are a number of ways it can be configured and used. hoglet can be configured via a XML configuration file and in that case you can use the XML configured processor to process your file/text. Alternatively you can configure hoglet in Java code directly.
For example:
For example:
// Create a TextHandler that will handle the tag "pre". TextHandler th = new TextHandler (); Map handlers = new HashMap (); handlers.put ("pre", th); // Create the processor. Processor p = new Processor (handlers); // Now process a file using the standard hoglet parser delimiters. String output = p.process (new FileReader (pathToMyFile), ParserCharset.STANDARD);
Classpath
Before using hoglet you should have the following jars (they can be found in the default installation) in your classpath:- hoglet-0.2.jar
- 3rd-party-jars/jdom-1.0.jar
- 3rd-party-jars/gentlyWEB.jar
Processing the Tags yourself
If you wish to process your input text/file yourself. Then you can get the processor to convert the text/file to tags via method: convertToTags(java.io.Reader, org.hoglet.ParserCharset). This will return a list of Tag objects.
Thread Safety
The Processor class is thread safe. The core tag handlers are also thread safe. Be aware though that if you use your own handlers and they store any state then you will need to externally synchronize calls to the processor.
This Site
Nearly all of this website (well the main information pages anyway) was written using hoglet markup. Needless to say the use of hoglet markup made writing (and maintaining) this site much easier than trying to do it in HTML or even with an editor. As such they provide some useful examples of using hoglet to actually DO something. Note: the standard hoglet delimiters were used.
Click the links below for the source:
Click the links below for the source:
- index.txt
- release-notes.txt
- using-hoglet.txt
- tags.txt
- tag-handlers.txt
- core-tag-handlers.txt
- text-handler.txt
- code-handler.txt
- link-handler.txt
- javadoc-handler.txt
- xml-handler.txt
- table-row-handler.txt
- xml-configured-processor.txt
- tools.txt