def gather_elements(self, client, node, style):
# Based on the graphviz extension
global graphviz_warn
try:
# Is vectorpdf enabled?
if hasattr(VectorPdf,'load_xobj'):
# Yes, we have vectorpdf
fname, outfn = sphinx.ext.graphviz.render_dot(node['builder'], node['code'], node['options'], 'pdf')
else:
# Use bitmap
if not graphviz_warn:
log.warning('Using graphviz with PNG output. You get much better results if you enable the vectorpdf extension.')
graphviz_warn = True
fname, outfn = sphinx.ext.graphviz.render_dot(node['builder'], node['code'], node['options'], 'png')
if outfn:
client.to_unlink.append(outfn)
client.to_unlink.append(outfn+'.map')
else:
# Something went very wrong with graphviz, and
# sphinx should have given an error already
return []
except sphinx.ext.graphviz.GraphvizError, exc:
log.error('dot code %r: ' % node['code'] + str(exc))
return [Paragraph(node['code'],client.styles['code'])]
return [MyImage(filename=outfn, client=client)]
评论列表
文章目录