Package doconce :: Module DocWriter :: Class DocWriter
[hide private]
[frames] | no frames]

Class DocWriter

source code

DocWriter can write documents in several formats at once.

Instance Methods [hide private]
 
__init__(self, *formats) source code
 
documents(self) source code
 
__str__(self) source code
 
dispatcher(self, *args, **kwargs) source code
 
figure(self, filename, caption, width=None, height=None, label=None)
Insert a figure into the document.
source code
 
link(self, link_text, link_target)
Typeset a hyperlink.
source code
 
list(self, items, listtype='itemize')
Write list or nested lists.
source code
 
math(self, text)
Write block of mathematical text (equations).
source code
 
paragraph(self, title, ending='.', label=None)
Write a paragraph heading with the given title and an ending (period, question mark, colon) and an optional label (for navigation).
source code
 
paragraph_separator(self)
Add a (space) separator between running paragraphs.
source code
 
raw(self, text)
Write text directly 'as is' to output.
source code
 
section(self, title, label=None)
Write a section heading with the given title and an optional label (for navigation).
source code
 
subsection(self, title, label=None)
Write a subsection heading with the given title and an optional label (for navigation).
source code
 
subsubsection(self, title, label=None)
Write a subsubsection heading with the given title and an optional label (for navigation).
source code
 
table(self, table, column_headline_pos='c', column_pos='c')
Translates a two-dimensional list of data, containing strings or numbers, to a suitable "tabular" environment in the output.
source code
 
text(self, text, indent=0)
Write plain text.
source code
 
title(self, title, authors_and_institutions=[], date='today')
Provide title and authors.
source code
 
url(self, url_address, link_text=None)
Typeset an URL (with an optional link).
source code
 
verbatim(self, code)
Write verbatim text in fixed-width form (typically for computer code).
source code
 
write_to_file(self, filename)
Write formatted document to a file.
source code
Class Variables [hide private]
  methods = ('title', 'section', 'subsection', 'subsubsection', ...
Method Details [hide private]

__init__(self, *formats)
(Constructor)

source code 
Parameters:
  • formats - sequence of strings specifying the desired formats.

figure(self, filename, caption, width=None, height=None, label=None)

source code 

Insert a figure into the document. filename should be without extension; a proper extension is added, and if the figure is not available in that image format, the convert utility from ImageMagick is called to convert the format.

list(self, items, listtype='itemize')

source code 

Write list or nested lists.

Parameters:
  • items - list of items.
  • listtype - 'itemize', 'enumerate', or 'description'.

table(self, table, column_headline_pos='c', column_pos='c')

source code 

Translates a two-dimensional list of data, containing strings or numbers, to a suitable "tabular" environment in the output.

Parameters:
  • table - list of list with rows/columns in table, including (optional) column-headline 1st row and row-headline 1st column.
  • column_pos - specify the l/c/r position of data entries in columns, give either (e.g.) 'llrrc' or one char (if all are equal).
  • column_headline_pos - position l/c/r for the headline row

text(self, text, indent=0)

source code 

Write plain text. Each line can be idented by a given number of spaces.

title(self, title, authors_and_institutions=[], date='today')

source code 

Provide title and authors.

Parameters:
  • title - document title (string).
  • authors_and_institutions - list of authors and their associated institutions, where each list item is a tuple/list with author as first element followed by the name of all institutions this author is associated with.
  • date - None implies no date, while 'today' generates the current date, otherwise a string is supplied.

write_to_file(self, filename)

source code 

Write formatted document to a file. Just give the stem of the file name; the extension will be automatically added (depending on the document format).


Class Variable Details [hide private]

methods

Value:
('title',
 'section',
 'subsection',
 'subsubsection',
 'paragraph',
 'paragraph_separator',
 'text',
 'list',
...