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)
评论列表
文章目录