An XIST module that allows embedding Python code in XML. ============================ class ``Code``​(``object``): ============================ def ``__init__``​(``self``, ``text``, ``ignorefirst``=``False``): ----------------------------------------------------------------- def ``indent``​(``self``): -------------------------- def ``funcify``​(``self``, ``name``=``'__'``): ---------------------------------------------- def ``asstring``​(``self``): ---------------------------- =========================================== class ``_base``​(``ll.xist.xsc.ProcInst``): =========================================== class ``Context``​(``ll.xist.xsc.Context``): -------------------------------------------- def ``__init__``​(``self``): """""""""""""""""""""""""""" ============================= class ``pyexec``​(``_base``): ============================= When converting a ``pyexec`` object the content of the processing instruction is executed as Python code. Execution is done when the node is converted. When converted such a node will result in an empty ``Null`` node. These processing instructions will be evaluated and executed in the namespace of the module sandbox (which will be store in the converter context). def ``convert``​(``self``, ``converter``): ------------------------------------------ ============================= class ``pyeval``​(``_base``): ============================= The content of a ``pyeval`` processing instruction will be executed when the node is converted as if it was the body of a function, so you can return an expression here. Although the content is used as a function body no indentation is neccessary or allowed. The returned value will be converted to a node and this resulting node will be converted. These processing instructions will be evaluated and executed in the namespace of the module sandbox (which will be store in the converter context). Note that you should not define the symbol ``__`` in any of your XIST processing instructions, as it is used by XIST for internal purposes. def ``convert``​(``self``, ``converter``): ------------------------------------------ Evaluates the code as if it was the body of a Python funtion. The ``converter`` argument will be available under the name ``converter`` as an argument to the function.