Repository: networkx/networkx

Issue:
pngmath is deprecated, causes build error
Building on Fedora rawhide results in:
```
Running Sphinx v1.4.9
making output directory...
WARNING: sphinx.ext.pngmath has been deprecated. Please use sphinx.ext.imgmath instead.
Extension error:
sphinx.ext.pngmath: other math package is already loaded
```
Simply removing it from the extensions allow it to build:
```
diff -up networkx-networkx-1.11/doc/source/conf.py.sphinx networkx-networkx-1.11/doc/source/conf.py
--- networkx-networkx-1.11/doc/source/conf.py.sphinx    2016-01-30 10:25:44.000000000 -0700
+++ networkx-networkx-1.11/doc/source/conf.py   2016-12-23 09:54:55.280925006 -0700
@@ -74,7 +74,6 @@ extensions = [
     'sphinx.ext.intersphinx',
     'sphinx.ext.mathjax',
     'sphinx.ext.napoleon',
-    'sphinx.ext.pngmath',
     'sphinx.ext.todo',
     'sphinx.ext.viewcode',
     #'sphinxcontrib.bibtex',
```
There is also this line:
```
pngmath_use_preview = True
```
which perhaps also should be removed/changed.

Upstream notes that pngmath has been deprecated: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/pngmath.py#L255


Discussion:
This issue was fixed in commit ffa3e5deb837 and should be closed. @hagberg 

Just noticed a small remaining item. I will submit a pull request to close this momentarily.  Sorry for the noise.

Resolving patch:
diff --git a/doc/source/conf.py b/doc/source/conf.py
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -59,7 +59,6 @@ def cd(newpath):
 
 # If your extensions are in another directory, add it here.
 # These locations are relative to conf.py
-sys.path.append(os.path.abspath('../sphinxext'))
 
 # General configuration
 # ---------------------
@@ -76,9 +75,6 @@ def cd(newpath):
     'sphinx.ext.napoleon',
     'sphinx.ext.todo',
     'sphinx.ext.viewcode',
-    #'sphinxcontrib.bibtex',
-    #'IPython.sphinxext.ipython_console_highlighting',
-    #'IPython.sphinxext.ipython_directive',
 ]
 
 
@@ -99,7 +95,7 @@ def cd(newpath):
 
 # General substitutions.
 project = 'NetworkX'
-copyright = '2015, NetworkX Developers'
+copyright = '2004-2017, NetworkX Developers'
 
 # The default replacements for |version| and |release|, also used in various
 # other places throughout the built documents.
@@ -178,7 +174,7 @@ def cd(newpath):
 html_index = 'contents.html'
 
 # Custom sidebar templates, maps page names to templates.
-#html_sidebars = {'index': 'indexsidebar.html'}
+#html_sidebars = {}
 
 # Additional templates that should be rendered to pages, maps page names to
 # templates.
@@ -193,8 +189,6 @@ def cd(newpath):
 # Output file base name for HTML help builder.
 htmlhelp_basename = 'NetworkX'
 
-pngmath_use_preview = True
-
 # Options for LaTeX output
 # ------------------------
 
@@ -222,10 +216,8 @@ def cd(newpath):
                        'http://docs.scipy.org/doc/numpy/': None,
                       }
 
-# For trac custom roles
-
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
 default_role = 'obj'
-trac_url = 'https://networkx.lanl.gov/trac/'
-mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML'
 
 numpydoc_show_class_members = False
diff --git a/doc/sphinxext/customroles.py b/doc/sphinxext/customroles.py
deleted file mode 100644
--- a/doc/sphinxext/customroles.py
+++ /dev/null
@@ -1,138 +0,0 @@
-"""
-    Custom Roles
-"""
-
-from docutils import nodes, utils
-from docutils.parsers.rst import roles
-
-from sphinx import addnodes
-from sphinx.util import ws_re, caption_ref_re
-
-# http://www.doughellmann.com/articles/how-tos/sphinx-custom-roles/index.html
-def sample_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
-    """Custom role.
-   
-    Parameters
-    ----------
-    name : str
-        The name of the role, as used in the document.
-    rawtext : str
-        The markup, including the role declaration.
-    text : str
-        The text to be marked up by the role.
-    lineno : int
-        The line number where `rawtext` appears.
-    inliner : Inliner
-        The instance that called the role.
-    options : dict
-        Directive options for customizatoin.
-    content : list
-        The directive content for customization.
-        
-    Returns
-    -------
-    nodes : list
-        The list of nodes to insert into the document.
-    msgs : list
-        The list of system messages, perhaps an error message.
-        
-    """
-    pass
-    
-    
-##################   
-    
-    
-prefixed_roles = {
-    # name: (prefix, baseuri)
-    'arxiv': ('arXiv:', 'http://arxiv.org/abs/'),
-    'doi': ('doi:', 'http://dx.doi.org/'),
-}
-
-no_text_roles = [
-    'url',
-    'pdf',
-]
-
-def prefixed_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
-    prefix, baseuri = prefixed_roles[name]
-    uri = baseuri + text
-    display = utils.unescape(text)
-    node = nodes.literal(prefix, prefix)
-    ref = nodes.reference(rawtext, display, refuri=uri, **options)
-    node += ref # keep it in the 'literal' background
-    return [node], []
-    
-def url_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
-    uri = text
-    display = 'url'
-    node = nodes.literal('', '')
-    node += nodes.reference(rawtext, name, refuri=uri, **options)
-    return [node], []
-    
-def trac_ticket_role(name, rawtext, text, lineno, inliner, 
-                     options={}, content=[]):
-    app = inliner.document.settings.env.app
-    try:
-        base = app.config.trac_url
-        if not base:
-            raise AttributeError
-    except AttributeError as err:
-        msg = 'trac_url configuration value is not set (%s)'
-        raise ValueError(msg % str(err))
-
-    slash = '/' if base[-1] != '/' else ''
-    prefix = 'ticket '
-    node = nodes.literal(prefix, prefix)
-    display = utils.unescape(text)
-    uri = base + slash + 'ticket/' + text
-    node += nodes.reference(rawtext, display, refuri=uri, **options)
-    return [node], []  
-
-def trac_changeset_role(name, rawtext, text, lineno, inliner, 
-                        options={}, content=[]):
-    app = inliner.document.settings.env.app
-    try:
-        base = app.config.trac_url
-        if not base:
-            raise AttributeError
-    except AttributeError as err:
-        msg = 'trac_url configuration value is not set (%s)'
-        raise ValueError(msg % str(err))    
-
-    slash = '/' if base[-1] != '/' else ''
-    unescaped = utils.unescape(text)
-    prefix = 'changeset '
-    node = nodes.literal(prefix, prefix)
-
-    # Hard-coded for NetworkX
-    if unescaped.endswith('networkx-svn-archive'):
-        # Use the integer
-        display = unescaped.split('/')[0]
-    else:
-        # hg: use the first 12 hash characters
-        display = unescaped[:12]
-        
-    uri = base + slash + 'changeset/' + text
-    node += nodes.reference(rawtext, display, refuri=uri, **options)
-    return [node], []
-
-active_roles = {
-    'arxiv': prefixed_role,
-    'doi': prefixed_role,
-    'pdf': url_role,
-    'url': url_role,
-    'ticket': trac_ticket_role,
-    'changeset': trac_changeset_role,
-}
-
-# Add a generic docstring.
-for role in active_roles.values():
-    role.__doc__ = sample_role.__doc__
-
-def setup(app):
-    for role, func in active_roles.items():
-        roles.register_local_role(role, func)
-    app.add_config_value('trac_url', None, 'env')
-        
-


Test patch: