Friday, June 21, 2013

Docutils Structure



DOCUTILS

Docutils is a python docstring processing system. It reads the statements from an input file parses the document and prints the output in a specified format. This is a tool which can be used to process restructured text. The structure of docutils is highly modular and well defined. It has got readers, parsers, transformers and writers.

Reader: Reader understand the input and sends the file to the parser. It sends the file to the parser as a whole or in chucks. If it uses the chuck form, it provides context so the the system can be consolidated again in a single form. It can read normal text format and rest format. It also recognizes FAQs and email.

Parser: It gets the input from the reader and construct document tree from the given input. At present only one parser has been implemented that is rest parser, other parsers are in the way of development.

Transformer: It is related to the formatting of the document tree. It can add to the tree, prune it, change from one form to another and many others. Some transformers are document.Splitter which splits the document into tree structure of sub-documents, document.Merger which combines multiple doctrees into one, parts.Content which generates a table of content for a document etc.

Writer: The writer produces the final output. The output can be in any one of many available formats. Some of the available formats are pdf, HTML, plain text restructured text etc.

No comments:

Post a Comment