Monday, February 28, 2011

Using rst files -- the easy way

When viewing documents of mahatos, there are text files with rst as their extensions. They reminded me about the reStructureText which I met but got confused and gave it up. This time I tried to figure out how to use it and how to convert it into other formats, for example, the HTML. The following steps and links are my quick notes, just for you who also want to try the rst files very quickly on Ubuntu.

  1. Assume that you have Python on your system already.
  2. $ sudo apt-get install python-docutils (this is the module that gives the utilities of the conversion between rst and other formats)
  3. Download the source package of Docutils
  4. Untar the downloaded package and go to the tools directory, find the, and copy it to a folder contained the cheatsheet.txt (Please download it. It is a text file formatted in rst file, and we will use it for the following test.)
  5. Go to the folder contained the cheatsheet.txt file
  6. $ python cheatsheet.txt cheatsheet.html
  7. You now have the cheatsheet.txt converted to cheatsheet.html, and you can view the cheatsheet.html in your browser
To be brief, use the the tools given by the source package to convert the rst text files into other formats.

Before jump into installing the Dcoutils on your system, you may want to try and see the rendered result online: reST to HTML conversion. Just copy the content of cheatsheet.txt and paste it into the online converter, and click the Render button to view the result. That's pretty cool. :-)

    No comments:

    Post a Comment