Returns a Document object.
>>> import rst
>>> doc = rst.Document('Title of the report')
>>> print doc.get_rst()
===================
Title of the report
===================
Adds a Node object to the Document. Returns True in case of success.
Returns the rst representation of the document in unicode format.
Saves the document in the given path.
Parameters: | path – Path to save the document. |
---|
Represents a paragraph
Parameters: | text – Text to be present in the paragraph. |
---|
. doctest:
>>> import rst
>>> doc = rst.Document('Title of the report')
>>> para = rst.Paragraph('This is a paragraph. A long one.')
>>> doc.add_child(para)
True
>>> print doc.get_rst()
===================
Title of the report
===================
This is a paragraph. A long one.
Represents a Section object.
Parameters: |
|
---|
Represents a Ordered List.
>>> import rst
>>> doc = rst.Document('Title of the report')
>>> blt = rst.Orderedlist()
>>> blt.add_item('Fedora')
>>> blt.add_item('Debian')
>>> doc.add_child(blt)
True
>>> print doc.get_rst()
===================
Title of the report
===================
1. Fedora
2. Debian
Adds a new text block in the Bulletlist.
Parameters: | text – text to be added in the list, remember it is ordered list. |
---|
Represents a Bullet List.
>>> import rst
>>> doc = rst.Document('Title of the report')
>>> blt = rst.Bulletlist()
>>> blt.add_item('Fedora')
>>> blt.add_item('Debian')
>>> doc.add_child(blt)
True
>>> print doc.get_rst()
===================
Title of the report
===================
* Fedora
* Debian
Adds a new text block in the Bulletlist.
Parameters: | text – text to be added in the list. |
---|
Represents a Table, (will be wriiten in csv-table style)
>>> import rst
>>> doc = rst.Document('Title of the report')
>>> tbl = rst.Table('My friends', ['Name', 'Major Project'])
>>> tbl.add_item(('Ramki', 'Python'))
>>> tbl.add_item(('Pradeepto', 'Kde'))
>>> tbl.add_item(('Nicubunu', 'Fedora'))
>>> doc.add_child(tbl)
True
>>> print doc.get_rst()
===================
Title of the report
===================
.. list-table:: My friends
:header-rows: 1
* - Name
- Major Project
* - Ramki
- Python
* - Pradeepto
- Kde
* - Nicubunu
- Fedora
Adds a new row to the table.
Parameters: | row – list of items in the table. |
---|