RstCloth¶
- class rstcloth.rstcloth.RstCloth(line_width=72)[source]¶
RstCloth is the base object to create a ReStructuredText document programatically.
- Parameters
line_width – (optional, default=72), the line width to use if wrap is set to true in an individual action.
- Returns
- codeblock(content, indent=0, wrap=True, language=None)[source]¶
- Parameters
content – the text to write into this element
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
language –
- Returns
- content(content, indent=0, wrap=True)[source]¶
- Parameters
content – the text to write into this element
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
- Returns
- property data¶
- Returns
- definition(name, text, indent=0, wrap=True, bold=False)[source]¶
- Parameters
name – the name of the definition
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
bold –
- Returns
- directive(name, arg=None, fields=None, content=None, indent=0, wrap=True)[source]¶
- Parameters
name – the directive itself to use
arg – the argument to pass into the directive
fields – fields to append as children underneath the directive
content – the text to write into this element
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
- Returns
- field(name, value, indent=0, wrap=True)[source]¶
- Parameters
name – the name of the field
value – the value of the field
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
- Returns
- footnote(ref, text, indent=0, wrap=True)[source]¶
- Parameters
ref – the reference value
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
- Returns
- h1(text, indent=0)[source]¶
- Parameters
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
- Returns
- h2(text, indent=0)[source]¶
- Parameters
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
- Returns
- h3(text, indent=0)[source]¶
- Parameters
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
- Returns
- h4(text, indent=0)[source]¶
- Parameters
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
- Returns
- h5(text, indent=0)[source]¶
- Parameters
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
- Returns
- h6(text, indent=0)[source]¶
- Parameters
text – the text to write into this element
indent – (optional default=0) number of characters to indent this element
- Returns
- heading(text, char, indent=0)[source]¶
- Parameters
text – the text to write into this element
char – the character to line the heading with
indent – (optional default=0) number of characters to indent this element
- Returns
- static inline_link(text, link)[source]¶
- Parameters
text – the printed value of the link
link – the url the link should goto
- Returns
- li(content, bullet='-', indent=0, wrap=True)[source]¶
- Parameters
content – the text to write into this element
bullet – (optional, default=’-‘) the character of the bullet
indent – (optional default=0) number of characters to indent this element
wrap – (optional, default=True) Whether or not to wrap lines to the line_width
- Returns
- newline(count=1)[source]¶
- Parameters
count – (optional default=1) the number of newlines to add
- Returns
- ref_target(name, indent=0)[source]¶
- Parameters
name – the name of the reference target
indent – (optional default=0) number of characters to indent this element
- Returns
- replacement(name, value, indent=0)[source]¶
- Parameters
name – the name of the replacement
value – the value fo the replacement
indent – (optional default=0) number of characters to indent this element
- Returns
- static role(name, value, text=None)[source]¶
- Parameters
name – the name of the role
value – the value of the role
text – (optional, default=None) text after the role
- Returns
- table(header, data, indent=0)[source]¶
- Parameters
header – a list of header values (strings), to use for the table
data – a list of lists of row data (same length as the header list each)
indent – something!
- Returns
- title(text, char='=', indent=0)[source]¶
- Parameters
text – the text to write into this element
char – (optional, default=’=’) the character to underline the title with
indent – (optional default=0) number of characters to indent this element
- Returns
- write(filename)¶
- Parameters
filename –
- Returns