def doFile(fn, docsdir, ext, url, templ, linkrel='', d=None): d = d or {} doc = tree.parseFileAndReport(fn) formulaeToImages(doc, os.path.dirname(fn)) cn = templ.cloneNode(1) tree.munge(doc, cn, linkrel, docsdir, fn, ext, url, d) cn.writexml(open(os.path.splitext(fn)[0]+ext, 'wb'))
def doFile(fn, linkrel, ext, url, templ, d=None): from tree import parseFileAndReport d = d or {} doc = parseFileAndReport(fn) slides = munge(doc, templ, linkrel, os.path.dirname(fn), fn, ext, url, d) for slide, index in zip(slides, range(len(slides))): slide.dom.writexml(open(os.path.splitext(fn)[0]+'-'+str(index)+ext, 'wb'))
def doFile(filename, linkrel, ext, url, templ, options={}, outfileGenerator=getOutputFileName): from tree import parseFileAndReport doc = parseFileAndReport(filename) slides = munge(doc, templ, linkrel, os.path.dirname(filename), filename, ext, url, options) for slide, index in zip(slides, range(len(slides))): newFilename = outfileGenerator(filename, ext, index) makeSureDirectoryExists(newFilename) slide.dom.writexml(open(newFilename, 'wb'))
def doFile(filename, linkrel, ext, url, templ, options={}, outfileGenerator=getOutputFileName): from tree import parseFileAndReport doc = parseFileAndReport(filename) slides = munge(doc, templ, linkrel, os.path.dirname(filename), filename, ext, url, options) for slide, index in zip(slides, range(len(slides))): newFilename = outfileGenerator(filename, ext, index) makeSureDirectoryExists(newFilename) f = open(newFilename, 'wb') slide.dom.writexml(f) f.close()
def processFile(spitter, fin): # XXX Use Inversion Of Control Pattern to orthogonalize the parsing API # from the Visitor Pattern application. (EnterPrise) dom = tree.parseFileAndReport(fin.name, lambda x: fin).documentElement spitter.visitNode(dom)