Base Class for Exporters

Base class for all exporters

class quill.exporter.base.ExporterBase[source]

Bases: object

book(book)[source]

Export the notebook.

Must be implemented in derived classes.

Parameters:book – the notebook to export
get_page_numbers(book)

Return the page numbers to be exported.

Parameters:book – the notebook to use, instance of Book. This is necessary to be able to list all page numbers.
Return type:list of integers

EXAMPLES:

>>> from quill.exporter.base import ExporterBase
>>> exporter = ExporterBase()
>>> exporter.get_page_numbers(sample_book)
[0, 1, 2]
>>> exporter.set_page_numbers(1)
>>> exporter.get_page_numbers(sample_book)
[1]
is_multipage()

Return whether the exporter can export multiple pages.

SVG or image export can only export a single page, while pdf or postscript allow multiple pages. This method returns whether the backend allows multiple pages. You should override this method to return True if your backend supports multiple pages.

EXAMPLES:

>>> from quill.exporter.base import ExporterBase
>>> exporter = ExporterBase()
>>> exporter.is_multipage()
False
set_page_numbers(numbers=None)

Set the page numbers to export.

Parameters:numbers – an integer, a list/tuple/iterable of integers, or None (default). The page numbers of the pages to export. By default, all pages are exported.

EXAMPLES:

>>> from quill.exporter.base import ExporterBase
>>> exporter = ExporterBase()
>>> exporter.get_page_numbers(sample_book)
[0, 1, 2]
>>> exporter.set_page_numbers(1)
>>> exporter.get_page_numbers(sample_book)
[1]
exception quill.exporter.base.QuillExporterError

Bases: exceptions.Exception

Previous topic

Importer for Quill Archives

Next topic

More Advanced Base Class for Exporters

This Page