org.jppf.doc
Class HtmlDocGenerator

java.lang.Object
  extended by org.jppf.doc.HtmlDocGenerator

public class HtmlDocGenerator
extends Object

This class generates an HTML doc based on HTML templates and text files for the content.

The goal is to programmatically realize something like a client-side include for HTML documents. The templates are place holders inserted within the HTML code. They can hold parameters to make them more generic and resusable.
A template can be nested within another template.

Rationale: HTML docs often contain more code for the visual rendering of the content than for the content itself. For example, using rounded tables holding the actual content implies a lot of additional table constructs and ends up cluttering the code. This makes the documentation difficult to maintain.
This implementation provides a means to leave the additional rendering constructs in separate files, with the double benefit of making the doc easier to author, read and maintain, and making it possible to reuse the visual effects easily.

Author:
Laurent Cohen

Field Summary
static String COMMENT
          Start of a template line comment.
static String CONTENT_END
          End of a content parameter value.
static String CONTENT_START
          Start of a content parameter value.
static String EQUALS
          Separator for parameter name/value pair.
static String PARAM_END
          End of a template parameter placeholder.
static String PARAM_START
          Start of a template parameter placeholder.
static String QUOTE
          Enclosing sequence for parameter values.
static String TEMPLATE_END
          End of a template insertion.
static String TEMPLATE_START
          Start of a template insertion.
 
Constructor Summary
HtmlDocGenerator()
           
 
Method Summary
 void generatePage(String source, String target, String templateFolder)
          Generate a target HTML document for a document source, using a specified location for the templates to use.
static void main(String... args)
          Test this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE_START

public static final String TEMPLATE_START
Start of a template insertion.

See Also:
Constant Field Values

TEMPLATE_END

public static final String TEMPLATE_END
End of a template insertion.

See Also:
Constant Field Values

CONTENT_START

public static final String CONTENT_START
Start of a content parameter value.

See Also:
Constant Field Values

CONTENT_END

public static final String CONTENT_END
End of a content parameter value.

See Also:
Constant Field Values

EQUALS

public static final String EQUALS
Separator for parameter name/value pair.

See Also:
Constant Field Values

QUOTE

public static final String QUOTE
Enclosing sequence for parameter values.

See Also:
Constant Field Values

COMMENT

public static final String COMMENT
Start of a template line comment.

See Also:
Constant Field Values

PARAM_START

public static final String PARAM_START
Start of a template parameter placeholder.

See Also:
Constant Field Values

PARAM_END

public static final String PARAM_END
End of a template parameter placeholder.

See Also:
Constant Field Values
Constructor Detail

HtmlDocGenerator

public HtmlDocGenerator()
Method Detail

generatePage

public void generatePage(String source,
                         String target,
                         String templateFolder)
                  throws Exception
Generate a target HTML document for a document source, using a specified location for the templates to use.

Parameters:
source - the source document.
target - the target HTML document.
templateFolder - the location of the templates.
Throws:
Exception - if any error occurs while reading, parsing or writing any of the files.

main

public static void main(String... args)
Test this class.

Parameters:
args - the options to use.


Copyright © 2005-2010 JPPF Team.