本文整理汇总了Python中plasTeX.Renderers.PageTemplate.Renderer.render方法的典型用法代码示例。如果您正苦于以下问题:Python Renderer.render方法的具体用法?Python Renderer.render怎么用?Python Renderer.render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plasTeX.Renderers.PageTemplate.Renderer
的用法示例。
在下文中一共展示了Renderer.render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from plasTeX.Renderers.PageTemplate import Renderer [as 别名]
# 或者: from plasTeX.Renderers.PageTemplate.Renderer import render [as 别名]
def render(self, document):
templatepaths = [os.path.join(os.path.dirname(__file__), '../templates/html'),
os.path.join(os.path.dirname(__file__), '../../templates/html'),
'/usr/lib/problemtools/templates/html']
templatepath = None
for p in templatepaths:
if os.path.isdir(p):
templatepath = p
break
if templatepath == None:
raise Exception('Could not find templates needed for conversion to HTML')
# Ugly but unfortunately PlasTeX is quite inflexible when it comes to
# configuring where to search for template files
os.environ['ProblemRendererTEMPLATES'] = templatepath
# Gigantic ugliness to cope with PlasTeX problem that prevents
# plastex from resetting list of invalid filenames when doing multiple renderings.
f = Filenames('blah.html', {}, {}, 'html')
f.invalid.clear()
# Setup our own mini-imager which just does copying and converts pdfs to png
self.imager = ImageConverter(document)
Renderer.render(self, document)