diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/python/lib/common/Sphinx-0.5.1-py2.5.egg/sphinx/ext/jsmath.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/external/python/lib/common/Sphinx-0.5.1-py2.5.egg/sphinx/ext/jsmath.py Wed Dec 23 19:29:07 2009 +0200 @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +""" + sphinx.ext.jsmath + ~~~~~~~~~~~~~~~~~ + + Set up everything for use of JSMath to display math in HTML + via JavaScript. + + :copyright: 2008 by Georg Brandl. + :license: BSD. +""" + +from docutils import nodes + +from sphinx.application import ExtensionError +from sphinx.ext.mathbase import setup as mathbase_setup + + +def html_visit_math(self, node): + self.body.append(self.starttag(node, 'span', '', CLASS='math')) + self.body.append(self.encode(node['latex']) + '') + raise nodes.SkipNode + +def html_visit_displaymath(self, node): + if node['nowrap']: + self.body.append(self.starttag(node, 'div', CLASS='math')) + self.body.append(node['latex']) + self.body.append('') + raise nodes.SkipNode + for i, part in enumerate(node['latex'].split('\n\n')): + part = self.encode(part) + if i == 0: + # necessary to e.g. set the id property correctly + if node['number']: + self.body.append('(%s)' % node['number']) + self.body.append(self.starttag(node, 'div', CLASS='math')) + else: + # but only once! + self.body.append('