XIST.converters

Module with the converter class

Home › Python software › ll.xist › convertersText · XIST · Python

This modules contains the base class for the converter objects used in the call to the convert method of Node objects.

class ConverterState​(object):

def __init__​(self, node, root, mode, stage, target, lang, makeaction, makeproject):

class Converter​(object):

An instance of this class is passed around in calls to the convert method. A Converter object can be used when some element needs to keep state across a nested convert call. A typical example are nested chapter/subchapter elements with automatic numbering. For an example see the element ll.xist.ns.doc.section.

def __init__​(self, node=None, root=None, mode=None, stage=None, target=None, lang=None, makeaction=None, makeproject=None):

Create a Converter. Arguments are used to initialize the Converter properties of the same name.

property node:

The root node for which conversion has been called. This is automatically set by the conv method of Node objects.

def __get__​(self):

def __set__​(self, node):

def __delete__​(self):

property root:

The root URL for the conversion. Resolving URLs during the conversion process should be done relative to root.

def __get__​(self):

def __set__​(self, root):

def __delete__​(self):

property mode:

The conversion mode. This corresponds directly to the mode in XSLT. The default is None.

def __get__​(self):

def __set__​(self, mode):

def __delete__​(self):

property stage:

If your conversion is done in multiple steps or stages you can use this property to specify in which stage the conversion process currently is. The default is "deliver".

def __get__​(self):

def __set__​(self, stage):

def __delete__​(self):

property target:

Specifies the conversion target. This must be a namespace module or similar object.

def __get__​(self):

def __set__​(self, target):

def __delete__​(self):

property lang:

The target language. The default is None.

def __get__​(self):

def __set__​(self, lang):

def __delete__​(self):

property makeaction:

If an XIST conversion is done by an ll.make.XISTConvertAction this property will hold the action object during that conversion. If you're not using the ll.make module you can simply ignore this property. The default is None.

def __get__​(self):

def __set__​(self, makeaction):

def __delete__​(self):

property makeproject:

If an XIST conversion is done by an ll.make.XISTConvertAction this property will hold the Project object during that conversion. If you're not using the ll.make module you can simply ignore this property.

def __get__​(self):

def __set__​(self, makeproject):

def __delete__​(self):

def push​(self, node=None, root=None, mode=None, stage=None, target=None, lang=None, makeaction=None, makeproject=None):

def pop​(self):

def __getitem__​(self, obj):

Return a context object for obj, which should be an ll.xist.xsc.Node instance or subclass. Each of these classes that defines its own Context class gets a unique instance of this class. This instance will be created on the first access and the element can store information there that needs to be available across calls to convert.