def cleanup(self, document, files, postProcess=None): res = XHTMLRenderer.cleanup(self, document, files, postProcess=postProcess) self.database = dict() self.doEpubFiles(document) return res
def runRenderer(tmpdir, doc): # Create document file # Run plastex on the document os.chdir(str(tmpdir)) Renderer().render(doc) assert tmpdir.join('index.html').isfile() # Get output file return Soup(tmpdir.join('index.html').read())
import sys, os from plasTeX import TeX, TeXDocument from plasTeX.Config import config as texConfig from plasTeX.Renderers.XHTML import Renderer FILE = sys.argv[1] tempdir = sys.argv[2] texConfig['files']['split-level'] = -10 texConfig['files']['filename'] = u'index$num(0).html' texConfig['general']['theme'] = 'minimal' cwd = os.getcwd() os.chdir(tempdir) document = TeXDocument(config=texConfig) tex = TeX.TeX(document, file=FILE) Renderer().render(tex.parse()) os.chdir(cwd)
def main(fname): document = plasTeX.TeXDocument() tex = TeX(document, myfile=fname) tex.parse() Renderer().render(document)