Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Move extlinks into the main Sage code
Browse files Browse the repository at this point in the history
so ? does not require the documentation configuration to be present
  • Loading branch information
saraedum committed Jul 6, 2018
1 parent 6bccacc commit 13958db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
16 changes: 1 addition & 15 deletions src/doc/common/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys, os, sphinx
from sage.env import SAGE_DOC_SRC, SAGE_DOC, SAGE_SRC, THEBE_DIR, SAGE_SHARE
import sage.version
from sage.misc.sagedoc import extlinks
import dateutil.parser
from six import iteritems

Expand Down Expand Up @@ -149,21 +150,6 @@ def set_intersphinx_mappings(app):
app.config.intersphinx_mapping[src] = dst


pythonversion = sys.version.split(' ')[0]
# Python and Sage trac ticket shortcuts. For example, :trac:`7549` .

# Sage trac ticket shortcuts. For example, :trac:`7549` .
extlinks = {
'python': ('https://docs.python.org/release/'+pythonversion+'/%s', ''),
'trac': ('https://trac.sagemath.org/%s', 'trac ticket #'),
'wikipedia': ('https://en.wikipedia.org/wiki/%s', 'Wikipedia article '),
'arxiv': ('https://arxiv.org/abs/%s', 'Arxiv '),
'oeis': ('https://oeis.org/%s', 'OEIS sequence '),
'doi': ('https://doi.org/%s', 'doi:'),
'pari': ('https://pari.math.u-bordeaux.fr/dochtml/help/%s', 'pari:'),
'mathscinet': ('https://www.ams.org/mathscinet-getitem?mr=%s', 'MathSciNet ')
}

# By default document are not master.
multidocs_is_master = True

Expand Down
18 changes: 14 additions & 4 deletions src/sage/misc/sagedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,20 @@ def process_dollars(s):
s = s[:m.start()] + "$" + s[m.end():]
return s


# Sage trac ticket shortcuts. For example, :trac:`7549` .
pythonversion = sys.version.split(' ')[0]
extlinks = {
'python': ('https://docs.python.org/release/'+pythonversion+'/%s', ''),
'trac': ('https://trac.sagemath.org/%s', 'trac ticket #'),
'wikipedia': ('https://en.wikipedia.org/wiki/%s', 'Wikipedia article '),
'arxiv': ('https://arxiv.org/abs/%s', 'Arxiv '),
'oeis': ('https://oeis.org/%s', 'OEIS sequence '),
'doi': ('https://doi.org/%s', 'doi:'),
'pari': ('https://pari.math.u-bordeaux.fr/dochtml/help/%s', 'pari:'),
'mathscinet': ('https://www.ams.org/mathscinet-getitem?mr=%s', 'MathSciNet ')
}

def process_extlinks(s, embedded=False):
r"""nodetex
Expand Down Expand Up @@ -494,10 +508,6 @@ def process_extlinks(s, embedded=False):
"""
if embedded:
return s
oldpath = sys.path
sys.path = [os.path.join(SAGE_DOC_SRC, 'common')] + oldpath
from conf import extlinks
sys.path = oldpath
for key in extlinks:
while True:
m = re.search(':%s:`([^`]*)`' % key, s)
Expand Down

0 comments on commit 13958db

Please sign in to comment.