[Python-checkins] r65555 - in doctools/trunk: doc/ext/math.rst sphinx/ext/mathbase.py tests/root/conf.py tests/root/contents.txt tests/root/math.txt

georg.brandl python-checkins at python.org
Wed Aug 6 16:57:45 CEST 2008


Author: georg.brandl
Date: Wed Aug  6 16:57:44 2008
New Revision: 65555

Log:
Test suite update for math extension.


Added:
   doctools/trunk/tests/root/math.txt   (contents, props changed)
Modified:
   doctools/trunk/doc/ext/math.rst
   doctools/trunk/sphinx/ext/mathbase.py
   doctools/trunk/tests/root/conf.py
   doctools/trunk/tests/root/contents.txt

Modified: doctools/trunk/doc/ext/math.rst
==============================================================================
--- doctools/trunk/doc/ext/math.rst	(original)
+++ doctools/trunk/doc/ext/math.rst	Wed Aug  6 16:57:44 2008
@@ -63,7 +63,7 @@
    to be issued.  See :role:`eqref` for an example.  The numbering style depends
    on the output format.
 
-.. role:: eqref
+.. role:: eq
 
    Role for cross-referencing equations via their label.  This currently works
    only within the same document.  Example::
@@ -71,7 +71,7 @@
       .. math:: e^{i\pi} + 1 = 0
          :label: euler
 
-      Euler's identity, equation :eqref:`euler`, was elected one of the most
+      Euler's identity, equation :eq:`euler`, was elected one of the most
       beautiful mathematical formulas.
    
 

Modified: doctools/trunk/sphinx/ext/mathbase.py
==============================================================================
--- doctools/trunk/sphinx/ext/mathbase.py	(original)
+++ doctools/trunk/sphinx/ext/mathbase.py	Wed Aug  6 16:57:44 2008
@@ -67,8 +67,8 @@
     raise nodes.SkipNode
 
 def latex_visit_displaymath(self, node):
-    self.body.append(wrap_displaymath(node['latex'],
-                                      node['docname'] + '-' + node['label']))
+    label = node['label'] and node['docname'] + '-' + node['label'] or None
+    self.body.append(wrap_displaymath(node['latex'], label))
     raise nodes.SkipNode
 
 def latex_visit_eqref(self, node):
@@ -87,7 +87,7 @@
     raise nodes.SkipNode
 
 def text_visit_eqref(self, node):
-    self.add_text(node['label'])
+    self.add_text(node['target'])
     raise nodes.SkipNode
 
 

Modified: doctools/trunk/tests/root/conf.py
==============================================================================
--- doctools/trunk/tests/root/conf.py	(original)
+++ doctools/trunk/tests/root/conf.py	Wed Aug  6 16:57:44 2008
@@ -23,7 +23,8 @@
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['ext', 'sphinx.ext.autodoc']
+extensions = ['ext', 'sphinx.ext.autodoc', 'sphinx.ext.jsmath']
+jsmath_path = 'dummy.js'
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']

Modified: doctools/trunk/tests/root/contents.txt
==============================================================================
--- doctools/trunk/tests/root/contents.txt	(original)
+++ doctools/trunk/tests/root/contents.txt	Wed Aug  6 16:57:44 2008
@@ -13,6 +13,7 @@
    images
    includes
    markup
+   math
 
 Indices and tables
 ==================

Added: doctools/trunk/tests/root/math.txt
==============================================================================
--- (empty file)
+++ doctools/trunk/tests/root/math.txt	Wed Aug  6 16:57:44 2008
@@ -0,0 +1,22 @@
+Test math extensions
+====================
+
+This is inline math: :math:`a^2 + b^2 = c^2`.
+
+.. math:: a^2 + b^2 = c^2
+
+.. math::
+
+   a^2 + b^2 = c^2
+
+.. math::
+   :label: foo
+
+   e^{i\pi} = 1
+
+.. math::
+   :label:
+
+   e^{ix} = \cos x + i\sin x
+
+Referencing equation :eq:`foo`.


More information about the Python-checkins mailing list