aafig-pre-sphinx-trans.py 文件源码

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

项目:hwtLib 作者: Nic30 项目源码 文件源码
def apply(self):
        #print '>>>>>>>>>>>>>>>>>>>>>', self.document.transformer.components['writer']
        current_node = self.startnode
        details = current_node.details
        image_node = details['image_node']
        options = details['aafigure_options'].copy()
        text = current_node.rawsource
        #merge_defaults(options, self)
        # XXX: this is an ugly hack to find out the writer being used
        print '>>>>>>>>>>>>>>>>>>>>>', self.document.transformer.components
        if hasattr(self.document.settings, 'stylesheet_path'): # HTML
            options['format'] = 'png'
        else: # LaTeX
            options['format'] = 'pdf'
        options['format'] = 'png'
        try:
            #TODO: options['format'] = self.builder.config.aafig_format['html']
            fname, outfn, id, extra = render_aafigure(self, text, options)
        except AafigError, exc:
            #TODO: self.builder.warn('aafigure error: ' + str(exc))
            current_node.replace_self([])
            # TODO: ascii art
        image_node['uri'] = directives.uri(fname)
        # TODO: improve image_node['alt']
        current_node.replace_self(image_node)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号