sphinx.ext.math: Update the label of permalink

This commit is contained in:
Takeshi KOMIYA 2016-07-19 11:16:57 +09:00
parent 2c5a9f3975
commit 0e829c845e
4 changed files with 4 additions and 4 deletions

View File

@ -255,7 +255,7 @@ def html_visit_displaymath(self, node):
self.body.append('<p>') self.body.append('<p>')
if node['number']: if node['number']:
self.body.append('<span class="eqno">(%s)' % node['number']) self.body.append('<span class="eqno">(%s)' % node['number'])
self.add_permalink_ref(node, _('Permalink to this code')) self.add_permalink_ref(node, _('Permalink to this equation'))
self.body.append('</span>') self.body.append('</span>')
if fname is None: if fname is None:
# something failed -- use text-only as a bad substitute # something failed -- use text-only as a bad substitute

View File

@ -36,7 +36,7 @@ def html_visit_displaymath(self, node):
# necessary to e.g. set the id property correctly # necessary to e.g. set the id property correctly
if node['number']: if node['number']:
self.body.append('<span class="eqno">(%s)' % node['number']) self.body.append('<span class="eqno">(%s)' % node['number'])
self.add_permalink_ref(node, _('Permalink to this code')) self.add_permalink_ref(node, _('Permalink to this equation'))
self.body.append('</span>') self.body.append('</span>')
self.body.append(self.starttag(node, 'div', CLASS='math')) self.body.append(self.starttag(node, 'div', CLASS='math'))
else: else:

View File

@ -37,7 +37,7 @@ def html_visit_displaymath(self, node):
# necessary to e.g. set the id property correctly # necessary to e.g. set the id property correctly
if node['number']: if node['number']:
self.body.append('<span class="eqno">(%s)' % node['number']) self.body.append('<span class="eqno">(%s)' % node['number'])
self.add_permalink_ref(node, _('Permalink to this code')) self.add_permalink_ref(node, _('Permalink to this equation'))
self.body.append('</span>') self.body.append('</span>')
self.body.append(self.builder.config.mathjax_display[0]) self.body.append(self.builder.config.mathjax_display[0])
parts = [prt for prt in node['latex'].split('\n\n') if prt.strip()] parts = [prt for prt in node['latex'].split('\n\n') if prt.strip()]

View File

@ -23,7 +23,7 @@ def test_jsmath(app, status, warning):
assert '<div class="math">\na^2 + b^2 = c^2</div>' in content assert '<div class="math">\na^2 + b^2 = c^2</div>' in content
assert '<div class="math">\n\\begin{split}a + 1 &lt; b\\end{split}</div>' in content assert '<div class="math">\n\\begin{split}a + 1 &lt; b\\end{split}</div>' in content
assert (u'<span class="eqno">(1)<a class="headerlink" href="#equation-foo" ' assert (u'<span class="eqno">(1)<a class="headerlink" href="#equation-foo" '
u'title="Permalink to this code">\xb6</a></span>' u'title="Permalink to this equation">\xb6</a></span>'
u'<div class="math" id="equation-foo">\ne^{i\\pi} = 1</div>' in content) u'<div class="math" id="equation-foo">\ne^{i\\pi} = 1</div>' in content)
assert ('<span class="eqno">(2)</span><div class="math">\n' assert ('<span class="eqno">(2)</span><div class="math">\n'
'e^{ix} = \\cos x + i\\sin x</div>' in content) 'e^{ix} = \\cos x + i\\sin x</div>' in content)