EsTexte - Usage

Running EsTexte

EsTexte transforms can be brought about in 2 different ways:

  1. From the command line
  2. From a Java program

Running from the command line

EsTexte can be run from the command-line to do two different things:

  1. generate an html page from an EsTexte page
  2. generate a set of html pages from a directory containing EsTexte pages

In both cases, you need to set your classpath to include the EsTexte.jar file, then launch the EsTexte transformer in one of two ways:

java -classpath EsTexte.jar estexte.EsTexte -indir [inputDir] -outdir [outputDir]

...transforms all the documents from the [inputDir] directory into the [outputDir] directory.

java -classpath EsTexte.jar estexte.EsTexte -infile [inputFile] -outdir [outputFile]

...transforms the [inputFile] file into the [outputFile] file.

to get usage from the command line, run the EsTexte transformer without and parameters:

java -classpath EsTexte.jar estexte.EsTexte

Generating with basic HTML envelope

If you don't want to personalize your HTML content by including appropriate <html> <head> headers, run EsTexte with the -basic switch: this will generate an HTML page that includes basic header information, including a reference to a style.css stylesheet included in the same directory as the HTML page.

Then, if you want to personalise the look of the page, you just pop a style.css stylesheet in the same directory as the HTML page and let it take it's effect.

java -classpath EsTexte.jar estexte.EsTexte -indir [inputDir] -outdir [outputDir] -basic

Using a template

If you want to factor into a template header and footer information, you can use the -template switch. If you use the switch in one of the following ways:

java ... estexte.EsTexte -indir [inputDir] -outdir [outputDir] -template [templateFile]
java ... estexte.EsTexte -infile [inputFile] -outdir [outputFile] -template [templateFile]

...then the template file identified by [templateFile] will be parsed and the @content@ tag included in it will be replaced by the generated content of each processed file. This is tantamount to including a mandatory header and footer to each page that is processed.

About path names

With all path names, an attempt is made to find the file relative to the location of the file being processed. This ensures that the processed file will always be the reference in both inlusion and templating mechanisms.

However, if the file is not found in relative form, an attempt is then made to find the file as though its path were expressed in absolute form.

So: precedence to relative paths, absolute paths being attempted if relative search fails.

Running from a java program

To use it from a Java client, you rely not on the EsTexte class but on the underlying TextProcessor class. The way to use it is simply to import the TextProcessor class, create an instance, pass it a input stream from ExTexte text, call the process() method, and write the output to an HTML stream. Here's an example:

import estexte.*;
...
File in = new File(inputFile);		
TextProcessor processor = new TextProcessor(new FileInputStream(in), in.getParent());
processor.process();
processor.write(new FileOutputStream(outputFile));

René Ghosh. last update: 03/07/2006