reStructuredText parser : JRst

User Documentation

Presentation

reStructuredText format is a document description format. Like other LaTex or DocBook, it can be converted toward a multitude of formats. These formats have usually invading syntax which, if it is necessary for very specific documents, becomes useless when it is used to quickly creating a simple document. RST has a so simple syntax that it becomes almost invisible.

Two methods of generation are possible :
  • The first one uses Jython to execute DocUtils scripts to transform RST into XML. All the functionalities of ReStructuredText are available but the generation is longer than with our parser because it uses Docutils external scripts.

  • The second uses our own JRST parser to generate XML, which allows to obtain good performance but some functionalities are not available.

With the XML document, we can transform it to other formats like HTML or PDF.

How to use it

JRST takes a reStructuredText file and generates XML file. Which could be used to produce various files formats with generation XSL files. The available output formats are HTML, xhtml, rst, pdf, docbook or XML [1] .

If JRST is launched without arguments, a graphical user interface is displayed for the user. Thus, we can choose easily files, output type, external XSL stylesheets to apply or the generation mode (simple or not).

JRST myfile.rst

This command converts myfile.rst toward XML file, displayed to the standard output (console). Several options are available :

-o file,--outFile=file

To write toward a file.

-t format,--outType format

To specify exit format, so using generation XSL file(s). Several formats are available xhtml, docbook, xml, HTML, xdoc, pdf.

-x xslFile,--xslFile xslFile

To specify generation XSL file at using.

--force

To overwrite, if file exists, it will be replaced by the new one.

--simple

To use our own parser JRST to generate XML. All the functionalities are not available but generation is faster.

--help

To display available options :

Usage: [options] FILE
   [--force] : overwrite existing out file
   [--simple] : use our own parser to generate the file
   [--help] : display this help and exit
   [--outFile -o value] : Output file
   [--outType -t /xhtml|docbook|xml|html|xdoc|rst/] : Output type
   [--xslFile -x value] : XSL file list to apply, comma separated

ex :

JRST --force -t html -o myfile.html myfile.rst

This command produces html file (myfile.html) from rst file (myfile.rst) even if myfile.html already exists.

Maven Plugin

Maven plugin is available at the following links : http://maven-site.nuiton.org/jrst/maven-jrst-plugin/en. It enables the use of JRST from Maven.

[1]

Only html, xhtml, DocBook, xdoc and pdf are available for the moment.