You can convert reStructuredText into HTML text by rst2html, which is installed in bin directory.
For example, if you convert rst.txt (written with reStructuredText format) into rst.html, just type:
rst2html rst.txt
rst2html has more useful options. If you want to know all options, just type:
rst2html
First of all, add rst-0.1.4.jar to your classpath. If you use RST from Maven2, you can download this jar file from maven.seasar.org repository. To make Maven2 scan maven.seasar.org repository and get RST jar file, simply add your pom.xml the folowing lines:
<repositories>
...
<repository>
<id>www.seasar.org</id>
<name>The Seasar Foundation Maven2 Repository</name>
<url>http://maven.seasar.org/maven2</url>
</repository>
</repositories>
...
<dependencies>
...
<dependency>
<groupId>net.skirnir.rst</groupId>
<artifactId>rst</artifactId>
<version>0.1.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
To parse reStructuredText and generate Java object, write like the following:
import net.skirnir.rst.element.Document; import net.skirnir.rst.parser.RstParser; ... RstParser parser = new RstParser(); Reader reader = ...; Document document = parser.parse(reader); ...
When a target text is invalid, RstParser throws net.skirnir.rst.IllegalFormatRuntimeException.
RstParser is thread-safe unless modifying the internal structure.
To convert net.skirnir.rst.element.Document object into HTML text, write like the following:
import net.skirnir.rst.element.Document; import net.skirnir.rst.parser.RstParser; ... Document document = parser.parse(reader); HTMLConverter converter = new HTMLConverter(); StringBuffer sb = new StringBuffer(); converter.convert(document, sb); String html = sb.toString(); ...
HTMLconverter is also thread-safe unless modifying the internal structure.
If you maintain Maven2 project and want to write site contents of the project with reStructuredText format, please try doxia-module-rst.