sphinxnodes.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:deviation-manual 作者: DeviationTX 项目源码 文件源码
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)]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号