Ticket #6495: trac_6495-other-parts.patch

File trac_6495-other-parts.patch, 75.4 KB (added by jhpalmieri, 7 years ago)

everything except "part 1"

  • .hgignore

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1311223150 25200
    # Node ID fcdd96364cf3af5220cae94ebc5c7c66ff3c5776
    # Parent  b6e83882e092817cd5a8f80ec5580745376d5d0b
    Break reference manual into manageable pieces.
    
    * Modify reference/index.rst to point to the new files
    doc/en/reference/MODULE/index.rst. Reorganize reference/index.rst so
    it is arranged, at least somewhat, by topic.  Add intersphinx to
    conf.py — see below. Also add the new subdirectories to the list
    exclude_trees. New file conf_sub.py, configuration for the pieces of
    the documentation (as opposed to the main conf.py, which is for
    building reference/index.rst). This file is imported by each of the
    files SUBDIRECTORY/conf.py.
    
    * Changes to doc/common/builder.py: add code to build the reference
    manual in sections, and also to build the sections in parallel. The
    reference manual ought to be built twice to resolve references now, so
    typing "sage --docbuild all html" will build it twice (along with all
    of the other documents, of course). "sage --docbuild reference html"
    will just build it once. You can also run "sage --docbuild
    reference/combinat html", for example, to just build one part of the
    manual. The different parts of the manual are separate documents as
    far as Sphinx is concerned, so allow them to reference each other
    using the "intersphinx" extension. (This is why we need to build it
    twice: the first pass assembles the intersphinx databases, the second
    pass uses the databases to create the references correctly.) For
    pdf format, since it now produces 30 different pdf files, write an
    html file which links to each of them.
    
    * doc/common/conf.py: add the intersphinx extension to the build process.
    
    * doc/common/themes/sage/layout.html: fix a bug where clicking the
    Sage logo in the upper left corner of the docs wouldn't take you
    to the right place, at least in the local documentation. 
    
    * doc/common/themes/sageref/: add a new theme for the pieces of the
    reference manual. This is almost identical to the "sage" theme,
    except for a little tinkering to the links along the top and
    bottom lines.
    
    * In the main Sage library, change a few pathnames to media files in
    the reference manual, since those files have been moved.
    
    * Make the necessary changes to .hgignore and MANIFEST.in to deal with
    the relocated files.
    
    * Fix it so that old URLs to the reference manual work.
    
    
    diff --git a/.hgignore b/.hgignore
    a b sage/modular/arithgroup/farey_symbol.h 
    5959doc/output/
    6060doc/en/reference/sage/
    6161doc/en/reference/sagenb/
     62doc/en/reference/.*/sage/
     63doc/en/reference/.*/sagenb/
  • MANIFEST.in

    diff --git a/MANIFEST.in b/MANIFEST.in
    a b include doc/fr/a_tour_of_sage/eigen_plot 
    3333include doc/fr/a_tour_of_sage/sin_plot.png
    3434include doc/tr/a_tour_of_sage/eigen_plot.png
    3535include doc/tr/a_tour_of_sage/sin_plot.png
    36 graft   doc/en/reference/media
     36graft   doc/en/reference/*/media
    3737graft   doc/en/thematic_tutorials/media
    3838graft   doc/en/prep/media
    3939prune   doc/en/reference/sage
  • doc/common/build_options.py

    diff --git a/doc/common/build_options.py b/doc/common/build_options.py
    a b else: 
    1717#Note that this needs to have the doctrees dir   
    1818ALLSPHINXOPTS   = SPHINXOPTS + " " + PAPEROPTS + " "
    1919WEBSITESPHINXOPTS = ""
     20
     21# Number of threads to use for parallel-building the documentation.
     22NUM_THREADS = int(os.environ.get('SAGE_NUM_THREADS', 1))
  • doc/common/builder.py

    diff --git a/doc/common/builder.py b/doc/common/builder.py
    a b except ValueError: 
    1111from sage.misc.cachefunc import cached_method
    1212from sage.misc.misc import sage_makedirs as mkdir
    1313
    14 # Read options
     14# Load the options, including
     15#     SAGE_DOC, LANGUAGES, SPHINXOPTS, PAPER, OMIT,
     16#     PAPEROPTS, ALLSPHINXOPTS, NUM_THREADS, WEBSITESPHINXOPTS
     17# from build_options.py.
    1518execfile(os.path.join(os.getenv('SAGE_ROOT'), 'devel', 'sage', 'doc', 'common' , 'build_options.py'))
    1619
    1720##########################################
    def copytree(src, dst, symlinks=False, i 
    6164        raise shutil.Error(errors)
    6265
    6366
     67##########################################
     68#      Parallel Building Ref Manual      #
     69##########################################
     70def build_ref_doc(args):
     71    doc = args[0]
     72    lang = args[1]
     73    format = args[2]
     74    kwds = args[3]
     75    args = args[4:]
     76    getattr(ReferenceSubBuilder(doc, lang), format)(*args, **kwds)
    6477
    6578##########################################
    6679#             Builders                   #
    6780##########################################
     81
    6882def builder_helper(type):
    6983    """
    7084    Returns a function which builds the documentation for
    class DocBuilder(object): 
    103117
    104118        - ``lang`` - (default "en") the language of the document.
    105119        """
    106         if '/' in name:
    107             lang, name = name.split(os.path.sep)
    108         self.name = name
     120        doc = name.split(os.path.sep)
     121
     122        if doc[0] in LANGUAGES:
     123            lang = doc[0]
     124            doc.pop(0)
     125
     126        self.name = os.path.join(*doc)
    109127        self.lang = lang
    110         self.dir = os.path.join(SAGE_DOC, lang, name)
     128        self.dir = os.path.join(SAGE_DOC, self.lang, self.name)
    111129
    112130        #Make sure the .static and .templates directories are there
    113131        mkdir(os.path.join(self.dir, "static"))
    class DocBuilder(object): 
    126144            sage: b._output_dir('html')
    127145            '.../devel/sage/doc/output/html/en/tutorial'
    128146        """
     147        if type == "inventory": # put inventories in the html tree
     148            type = "html"
    129149        d = os.path.join(SAGE_DOC, "output", type, self.lang, self.name)
    130150        mkdir(d)
    131151        return d
    class DocBuilder(object): 
    156176            sage: import os, sys; sys.path.append(os.environ['SAGE_DOC']+'/common/'); import builder
    157177            sage: b = builder.DocBuilder('tutorial')
    158178            sage: b._output_formats()
    159             ['changes', 'html', 'htmlhelp', 'json', 'latex', 'linkcheck', 'pickle', 'web']
     179            ['changes', 'html', 'htmlhelp', 'inventory', 'json', 'latex', 'linkcheck', 'pickle', 'web']
    160180
    161181        """
    162182        #Go through all the attributes of self and check to
    class DocBuilder(object): 
    208228    latex = builder_helper('latex')
    209229    changes = builder_helper('changes')
    210230    linkcheck = builder_helper('linkcheck')
     231    # import the customized builder for object.inv files
     232    inventory = builder_helper('inventory')
     233
     234##########################################
     235#      Parallel Building Ref Manual      #
     236##########################################
     237def build_other_doc(args):
     238    document = args[0]
     239    name = args[1]
     240    kwds = args[2]
     241    args = args[3:]
     242    logger.warning("\nBuilding %s.\n" % document)
     243    getattr(get_builder(document), name)(*args, **kwds)
    211244
    212245class AllBuilder(object):
    213246    """
    class AllBuilder(object): 
    228261        This is the function which goes through all of the documents
    229262        and does the actual building.
    230263        """
    231         for document in self.get_all_documents():
     264        import time
     265        start = time.time()
     266        docs = self.get_all_documents()
     267        refs = [x for x in docs if x.endswith('reference')]
     268        others = [x for x in docs if not x.endswith('reference')]
     269        # Build the reference manual twice to resolve references.  That is,
     270        # build once with the inventory builder to construct the intersphinx
     271        # inventory files, and then build the second time for real.  So the
     272        # first build should be as fast as possible;
     273        logger.warning("\nBuilding reference manual, first pass.\n")
     274        global ALLSPHINXOPTS
     275        ALLSPHINXOPTS += ' -Q -D multidoc_first_pass=1'
     276        for document in refs:
     277            getattr(get_builder(document), 'inventory')(*args, **kwds)
     278        logger.warning("Building reference manual, second pass.\n")
     279        ALLSPHINXOPTS = ALLSPHINXOPTS.replace(
     280            'multidoc_first_pass=1', 'multidoc_first_pass=0')
     281        ALLSPHINXOPTS = ALLSPHINXOPTS.replace('-Q', '-q') + ' '
     282        for document in refs:
    232283            getattr(get_builder(document), name)(*args, **kwds)
    233284
     285        # build the other documents in parallel
     286        from multiprocessing import Pool
     287        pool = Pool(NUM_THREADS)
     288        L = [(doc, name, kwds) + args for doc in others]
     289        # map_async, with get to provide a timeout, handles
     290        # KeyboardInterrupt correctly. apply_async does not, so don't
     291        # use it.
     292        pool.map_async(build_other_doc, L).get(99999)
     293        pool.close()
     294        pool.join()
     295        logger.warning("Elapsed time: %.1f seconds."%(time.time()-start))
     296        logger.warning("Done building the documentation!")
     297
    234298    def get_all_documents(self):
    235299        """
    236300        Returns a list of all of the documents. A document is a directory within one of
    class AllBuilder(object): 
    261325
    262326        return documents
    263327
     328
    264329class WebsiteBuilder(DocBuilder):
    265330    def html(self):
    266331        """
    267332        After we've finished building the website index page, we copy
    268         everything one directory up.
     333        everything one directory up.  Then we call
     334        :meth:`create_html_redirects`.
    269335        """
    270336        DocBuilder.html(self)
    271337        html_output_dir = self._output_dir('html')
    class WebsiteBuilder(DocBuilder): 
    273339                 os.path.realpath(os.path.join(html_output_dir, '..')),
    274340                 ignore_errors=False)
    275341
     342        self.create_html_redirects()
     343
     344    def create_html_redirects(self):
     345        """
     346        Writes a number of small HTML files; these are files which
     347        used to contain the main content of the reference manual
     348        before before splitting the manual into multiple
     349        documents. After the split, those files have moved, so in each
     350        old location, write a file which redirects to the new version.
     351        (This is so old URLs to pieces of the reference manual still
     352        open the correct files.)
     353        """
     354        # The simple html template which will cause a redirect to the
     355        # correct file
     356        html_template = """<html><head>
     357            <meta HTTP-EQUIV="REFRESH" content="0; url=%s">
     358            </head><body></body></html>"""
     359
     360        reference_dir = os.path.abspath(os.path.join(self._output_dir('html'),
     361                                                     '..', 'reference'))
     362        reference_builder = ReferenceBuilder('reference')
     363        refdir = os.path.join(os.environ['SAGE_DOC'], 'en', 'reference')
     364        for document in reference_builder.get_all_documents(refdir):
     365            #path is the directory above reference dir
     366            path = os.path.abspath(os.path.join(reference_dir, '..'))
     367
     368            # the name of the subdocument
     369            document_name = document.split('/')[1]
     370
     371            # the sage directory within a subdocument, for example
     372            # /path/to/.../output/html/en/reference/algebras/sage
     373            sage_directory = os.path.join(path, document, 'sage')
     374
     375            # Walk through all of the files in the sage_directory
     376            for dirpath, dirnames, filenames in os.walk(sage_directory):
     377                # a string like reference/algebras/sage/algebras
     378                short_path = dirpath[len(path)+1:]
     379
     380                # a string like sage/algebras
     381                shorter_path = os.path.join(*short_path.split(os.sep)[2:])
     382               
     383                #Make the shorter path directory
     384                try:
     385                    os.makedirs(os.path.join(reference_dir, shorter_path))
     386                except OSError:
     387                    pass
     388               
     389                for filename in filenames:
     390                    if not filename.endswith('html'):
     391                        continue
     392
     393                    # the name of the html file we are going to create
     394                    redirect_filename = os.path.join(reference_dir, shorter_path, filename)
     395
     396                    # the number of levels up we need to use in the relative url
     397                    levels_up = len(shorter_path.split(os.sep))
     398
     399                    # the relative url that we will redirect to
     400                    redirect_url = "/".join(['..']*levels_up + [document_name, shorter_path, filename])
     401
     402                    # write the html file which performs the redirect
     403                    with open(redirect_filename, 'w') as f:
     404                        f.write(html_template % redirect_url)
     405               
     406
    276407    def clean(self):
    277408        """
    278409        When we clean the output for the website index, we need to
    class WebsiteBuilder(DocBuilder): 
    292423
    293424        DocBuilder.clean(self)
    294425
    295 class ReferenceBuilder(DocBuilder):
     426
     427class ReferenceBuilder(AllBuilder):
    296428    """
    297     This the class used to build the reference manual.  It is
     429    This class builds the reference manual.  It uses DocBuilder to
     430    build the top-level page and ReferenceSubBuilder for each
     431    sub-component.
     432    """
     433    def __init__(self, name, lang='en'):
     434        """
     435        Records the reference manual's name, in case it's not
     436        identical to 'reference'.
     437        """
     438        AllBuilder.__init__(self)
     439        doc = name.split(os.path.sep)
     440
     441        if doc[0] in LANGUAGES:
     442            lang = doc[0]
     443            doc.pop(0)
     444
     445        self.name = doc[0]
     446        self.lang = lang
     447
     448    def _output_dir(self, type, lang='en'):
     449        """
     450        Returns the directory where the output of type type is stored.
     451        If the directory does not exist, then it will automatically be
     452        created.
     453
     454        EXAMPLES::
     455
     456            sage: import os, sys; sys.path.append(os.environ['SAGE_DOC']+'/common/'); import builder
     457            sage: b = builder.ReferenceBuilder('reference')
     458            sage: b._output_dir('html')
     459            '.../devel/sage/doc/output/html/en/reference'
     460        """
     461        if type == "inventory": # put inventories in the html tree
     462            type = "html"
     463        d = os.path.join(SAGE_DOC, "output", type, lang, self.name)
     464        mkdir(d)
     465        return d
     466
     467    def _wrapper(self, format, *args, **kwds):
     468        """
     469        Builds reference manuals.  For each language, it builds the
     470        top-level document and its components.
     471        """
     472        for lang in LANGUAGES:
     473            refdir = os.path.join(SAGE_DOC, lang, self.name)
     474            if not os.path.exists(refdir):
     475                continue
     476            output_dir = self._output_dir(format, lang)
     477            from multiprocessing import Pool
     478            pool = Pool(NUM_THREADS)
     479            L = [(doc, lang, format, kwds) + args for doc in self.get_all_documents(refdir)]
     480            # (See comment in AllBuilder._wrapper about using map_async
     481            # instead of apply_async.)
     482            pool.map_async(build_ref_doc, L).get(99999)
     483            pool.close()
     484            pool.join()
     485            # The html refman must be build at the end to ensure correct
     486            # merging of indexes and inventories.
     487            getattr(DocBuilder(self.name, lang), format)(*args, **kwds)
     488
     489            # PDF: we need to build master index file which lists all
     490            # of the PDF file.  So we create an html file, based on
     491            # the file index.html from the "website" target.
     492            if format == 'pdf':
     493                import re
     494                # First build the website page.  (This only takes a
     495                # few seconds.)
     496                getattr(get_builder('website'), 'html')()
     497                # Copy the relevant pieces of
     498                # output/html/en/website/_static to output_dir.
     499                # (Don't copy all of _static to save some space: we
     500                # don't need all of the MathJax stuff, and in
     501                # particular we don't need the fonts.)
     502                website_dir = os.path.join(SAGE_DOC, 'output', 'html',
     503                                           'en', 'website')
     504                static_files = ['COPYING.txt', 'basic.css', 'blank.gif',
     505                         'default.css', 'doctools.js', 'favicon.ico',
     506                         'file.png', 'jquery.js', 'minus.png',
     507                         'pdf.png', 'plus.png', 'pygments.css',
     508                         'sage.css', 'sageicon.png', 'sagelogo.png',
     509                         'searchtools.js', 'sidebar.js', 'underscore.js']
     510                mkdir(os.path.join(output_dir, '_static'))
     511                for f in static_files:
     512                    try:
     513                        shutil.copyfile(os.path.join(website_dir, '_static', f),
     514                                        os.path.join(output_dir, '_static', f))
     515                    except IOError: # original file does not exist
     516                        pass
     517                # Now modify website's index.html page and write it
     518                # to output_dir.
     519                f = open(os.path.join(website_dir, 'index.html'))
     520                html = f.read().replace('Documentation', 'Reference')
     521                f.close()
     522                html_output_dir = os.path.dirname(website_dir)
     523                html = html.replace('http://www.sagemath.org',
     524                                    os.path.join(html_output_dir, 'index.html'))
     525                # From index.html, we want the preamble and the tail.
     526                html_end_preamble = html.find('<h1>Sage Reference')
     527                html_bottom = html.rfind('</table>') + len('</table>')
     528                # For the content, we modify doc/en/reference/index.rst,
     529                # which has two parts: the body and the table of contents.
     530                f = open(os.path.join(SAGE_DOC, lang, 'reference', 'index.rst'))
     531                rst = f.read()
     532                f.close()
     533                # Replace rst links with html links.  There are two forms:
     534                #
     535                #   `blah`__    followed by __ LINK
     536                #
     537                #   :doc:`blah <module/index>`
     538                #
     539                # Change the first form to
     540                #
     541                #   <a href="LINK">blah</a>
     542                #
     543                # Change the second form to
     544                #
     545                #   <a href="module/module.pdf">blah <img src="_static/pdf.png" /></a>
     546                #
     547                rst = re.sub('`([^`]*)`__\.\n\n__ (.*)',
     548                                  r'<a href="\2">\1</a>.', rst)
     549                rst = re.sub(r':doc:`([^<]*?)\s+<(.*)/index>`',
     550                             r'<a href="\2/\2.pdf">\1 <img src="_static/pdf.png" /></a>',
     551                             rst)
     552                # Get rid of todolist and miscellaneous rst markup.
     553                rst = rst.replace('.. toctree::', '')
     554                rst = rst.replace(':maxdepth: 2', '')
     555                rst = rst.replace('todolist', '')
     556                start = rst.find('=\n') + 1
     557                end = rst.find('Table of Contents')
     558                # Body: add paragraph <p> markup.
     559                rst_body = rst[start:end]
     560                rst_body = rst_body.replace('\n\n', '</p>\n<p>')
     561                start = rst.find('Table of Contents') + 2*len('Table of Contents') + 1
     562                # Don't include the indices.
     563                end = rst.find('Indices and Tables')
     564                # TOC: change * to <li>, change rst headers to html headers.
     565                rst_toc = rst[start:end]
     566                rst_toc = rst_toc.replace('*', '<li>')
     567                rst_toc = re.sub('\n([A-Z][a-zA-Z, ]*)\n-*\n',
     568                             '</ul>\n\n\n<h2>\\1</h2>\n\n<ul>\n', rst_toc)
     569                # Now write the file.
     570                new_index = open(os.path.join(output_dir, 'index.html'), 'w')
     571                new_index.write(html[:html_end_preamble])
     572                new_index.write('<h1>' + rst[:rst.find('\n')] +
     573                                ' (PDF version)'+ '</h1>')
     574                new_index.write(rst_body)
     575                new_index.write('<h2>Table of Contents</h2>\n\n<ul>')
     576                new_index.write(rst_toc)
     577                new_index.write('</ul>\n\n')
     578                new_index.write(html[html_bottom:])
     579                new_index.close()
     580                logger.warning('''
     581PDF documents have been created in subdirectories of
     582
     583  %s
     584
     585Alternatively, you can open
     586
     587  %s
     588
     589for a webpage listing all of the documents.''' % (output_dir,
     590                                                 os.path.join(output_dir,
     591                                                              'index.html')))
     592
     593    def get_all_documents(self, refdir):
     594        """
     595        Returns a list of all reference manual components to build.
     596        We add a component name if it's a subdirectory of the manual's
     597        directory and contains a file named 'index.rst'.
     598
     599        EXAMPLES::
     600
     601            sage: import os, sys; sys.path.append(os.environ['SAGE_DOC']+'/common/'); import builder
     602            sage: b = builder.ReferenceBuilder('reference')
     603            sage: refdir = os.path.join(os.environ['SAGE_DOC'], 'en', b.name)
     604            sage: b.get_all_documents(refdir)
     605            ['reference/algebras', 'reference/arithgroup', ..., 'reference/tensor']
     606        """
     607        documents = []
     608
     609        for doc in os.listdir(refdir):
     610            if os.path.exists(os.path.join(refdir, doc, 'index.rst')):
     611                documents.append(os.path.join(self.name, doc))
     612
     613        return sorted(documents)
     614
     615
     616class ReferenceSubBuilder(DocBuilder):
     617    """
     618    This class builds sub-components of the reference manual.  It is
    298619    resposible for making sure the auto generated ReST files for the
    299620    Sage library are up to date.
    300621
    class ReferenceBuilder(DocBuilder): 
    424745        except IOError as err:
    425746            logger.debug("Failed to open Sphinx environment: %s", err)
    426747            pass
    427                                            
     748
    428749    def update_mtimes(self):
    429750        """
    430751        Updates the modification times for ReST files in the Sphinx
    class ReferenceBuilder(DocBuilder): 
    593914
    594915            sage: import os, sys; sys.path.append(os.environ['SAGE_DOC']+'/common/'); import builder
    595916            sage: import builder
    596             sage: builder.ReferenceBuilder("reference").auto_rest_filename("sage.combinat.partition")
     917            sage: builder.ReferenceSubBuilder("reference").auto_rest_filename("sage.combinat.partition")
    597918            '.../devel/sage/doc/en/reference/sage/combinat/partition.rst'
    598919        """
    599920        return self.dir + os.path.sep + module_name.replace('.',os.path.sep) + '.rst'
    class ReferenceBuilder(DocBuilder): 
    7051026
    7061027def get_builder(name):
    7071028    """
    708     Returns a either a AllBuilder or DocBuilder object depending
    709     on whether ``name`` is 'all' or not.  These are the objects
    710     which do all the real work in building the documentation.
     1029    Returns an appropriate *Builder object for the document ``name``.
     1030    DocBuilder and its subclasses do all the real work in building the
     1031    documentation.
    7111032    """
    7121033    if name == 'all':
    7131034        return AllBuilder()
    7141035    elif name.endswith('reference'):
    7151036        return ReferenceBuilder(name)
     1037    elif 'reference' in name:
     1038        return ReferenceSubBuilder(name)
    7161039    elif name.endswith('website'):
    7171040        return WebsiteBuilder(name)
    7181041    elif name in get_documents() or name in AllBuilder().get_all_documents():
    def help_documents(s=u""): 
    8021125    shortcut 'all' for all documents, available to the Sage
    8031126    documentation builder.
    8041127    """
     1128    docs = get_documents()
    8051129    s += "DOCUMENTs:\n"
    806     s += format_columns(get_documents() + ['all  (!)'])
    807     s += "(!) Builds everything.\n"
     1130    s += format_columns(docs + ['all  (!)'])
     1131    s += "(!) Builds everything.\n\n"
     1132    if 'reference' in docs:
     1133        s+= "Other valid document names take the form 'reference/DIR', where\n"
     1134        s+= "DIR is a subdirectory of SAGE_ROOT/devel/sage/doc/en/reference/.\n"
     1135        s+= "This builds just the specified part of the reference manual.\n"
    8081136    return s
    8091137
    8101138def get_formats():
  • doc/common/conf.py

    diff --git a/doc/common/conf.py b/doc/common/conf.py
    a b sys.path.append(get_doc_abspath('common' 
    1919
    2020# Add any Sphinx extension module names here, as strings. They can be extensions
    2121# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
    22 extensions = ['sage_autodoc',  'sphinx.ext.graphviz',
     22extensions = ['inventory_builder', 'multidocs',
     23              'sage_autodoc',  'sphinx.ext.graphviz',
    2324              'sphinx.ext.inheritance_diagram', 'sphinx.ext.todo',
    2425              'sphinx.ext.extlinks']
    2526# We do *not* fully initialize intersphinx since we call it by hand
    extlinks = { 
    124125    'trac': ('http://trac.sagemath.org/%s', 'trac ticket #'),
    125126    'wikipedia': ('http://en.wikipedia.org/wiki/%s', 'Wikipedia article ')}
    126127
     128# By default document are not master.
     129multidocs_is_master = True
     130
    127131# Options for HTML output
    128132# -----------------------
    129133
    else: 
    213217# If false, no module index is generated.
    214218#html_use_modindex = True
    215219
     220# A list of prefixes that are ignored for sorting the Python module index ( if
     221# this is set to ['foo.'], then foo.bar is shown under B, not F). Works only
     222# for the HTML builder currently.
     223modindex_common_prefix = ['sage.']
     224
    216225# If false, no index is generated.
    217226#html_use_index = True
    218227
  • new file doc/common/inventory_builder.py

    diff --git a/doc/common/inventory_builder.py b/doc/common/inventory_builder.py
    new file mode 100644
    - +  
     1# -*- coding: utf-8 -*-
     2"""
     3    inventory builder
     4    ~~~~~~~~~~~~~~~~~
     5
     6    A customized HTML builder which only generates intersphinx "object.inv"
     7    inventory files and pickle files. The documentation files are not written.
     8"""
     9from sphinx.builders.html import StandaloneHTMLBuilder
     10from sphinx.util.console import bold
     11
     12class InventoryBuilder(StandaloneHTMLBuilder):
     13    """
     14    A customized HTML builder which only generates intersphinx "object.inv"
     15    inventory files and pickle files. The documentation files are not written.
     16    """
     17    name = "inventory"
     18
     19    def write_doc(self, docname, doctree):
     20        """
     21        Don't write any doc
     22        """
     23
     24    def finish(self):
     25        """
     26        Only write the inventory files.
     27        """
     28        self.write_buildinfo()
     29        self.dump_inventory()
     30
     31    def removed_method_error(self):
     32        """
     33        Raise an error if this method is called.
     34
     35        This is just for making sure that some writer methods are indeed
     36        deactivated.
     37        """
     38        raise RuntimeError, "This function shouldn't be called in \"%s\" builder"%(self.name)
     39
     40    copy_image_files = removed_method_error
     41    copy_download_files = removed_method_error
     42    copy_static_files = removed_method_error
     43    handle_finish = removed_method_error
     44
     45def setup(app):
     46    app.add_builder(InventoryBuilder)
     47
  • new file doc/common/multidocs.py

    diff --git a/doc/common/multidocs.py b/doc/common/multidocs.py
    new file mode 100644
    - +  
     1# -*- coding: utf-8 -*-
     2"""
     3    multi documentation in Sphinx
     4    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     5
     6    The goal of this extension is to manage a multi documentation in Sphinx.
     7    To be able to compile Sage's huge documentation in parallel, the
     8    documentation is cut into a bunch of independent documentations called
     9    "subdocs", which are compiled separately. There is a master document which
     10    points to all the subdocs. The intersphinx extension ensures that the
     11    cross-link between the subdocs are correctly resolved. However some work
     12    is needed to build a global index. This is the goal of multidocs.
     13
     14    More precisely this extension ensures the correct merging of
     15    - the todo list if this extension is activated;
     16    - the python indexes;
     17    - the list of python modules;
     18    - the javascript index;
     19    - the citations.
     20"""
     21import cPickle, os, sys
     22import sphinx
     23from sphinx.util.console import bold
     24
     25
     26CITE_FILENAME = 'citations.pickle'
     27
     28
     29def merge_environment(app, env):
     30    """
     31    Merges the following attributes of the sub-docs environment into the main
     32    environment:
     33    - todo_all_todos              # ToDo's
     34    - indexentries                # global python index
     35    - all_docs                    # needed by the js index
     36    - citations                   # citations
     37
     38    - domaindata['py']['modules'] # list of python modules
     39    """
     40    app.info(bold('Merging environment/index files...'))
     41    for curdoc in app.env.config.multidocs_subdoc_list:
     42        app.info("    %s:"%curdoc, nonl=1)
     43        docenv = get_env(app, curdoc)
     44        if docenv is not None:
     45            fixpath = lambda path: os.path.join(curdoc, path)
     46            app.info(" %s todos, %s index, %s citations"%(
     47                    len(docenv.todo_all_todos),
     48                    len(docenv.indexentries),
     49                    len(docenv.citations)
     50                    ), nonl=1)
     51
     52            # merge the todo links
     53            for dct in docenv.todo_all_todos:
     54                dct['docname']=fixpath(dct['docname'])
     55            env.todo_all_todos += docenv.todo_all_todos
     56            # merge the html index links
     57            newindex = {}
     58            for ind in docenv.indexentries:
     59                if ind.startswith('sage/'):
     60                    newind = fixpath(ind)
     61                    newindex[newind] = docenv.indexentries[ind]
     62                else:
     63                    newindex[ind] = docenv.indexentries[ind]
     64            env.indexentries.update(newindex)
     65            # merge the all_docs links, needed by the js index
     66            newalldoc = {}
     67            for ind in docenv.all_docs:
     68                newalldoc[fixpath(ind)]=docenv.all_docs[ind]
     69            env.all_docs.update(newalldoc)
     70            # needed by env.check_consistency (sphinx.environement, line 1734)
     71            for ind in newalldoc:
     72                env.metadata[ind] = {}
     73            # merge the citations
     74            newcite = {}
     75            for ind, (path, tag) in docenv.citations.iteritems():
     76                # TODO: Warn on conflicts
     77                newcite[ind]=(fixpath(path), tag)
     78            env.citations.update(newcite)
     79            # merge the py:module indexes
     80            newmodules = {}
     81            for ind,(modpath,v1,v2,v3) in (
     82                docenv.domaindata['py']['modules'].iteritems()):
     83                newmodules[ind] = (fixpath(modpath),v1,v2,v3)
     84            env.domaindata['py']['modules'].update(newmodules)
     85            app.info(", %s modules"%(len(newmodules)))
     86    app.info('... done (%s todos, %s index, %s citations, %s modules)'%(
     87            len(env.todo_all_todos),
     88            len(env.indexentries),
     89            len(env.citations),
     90            len(env.domaindata['py']['modules'])))
     91    write_citations(app, env.citations)
     92
     93def get_env(app, curdoc):
     94    """
     95    Get the environment of a sub-doc from the pickle
     96    """
     97    from sphinx.application import ENV_PICKLE_FILENAME
     98    filename = os.path.join(
     99        app.env.doctreedir, curdoc, ENV_PICKLE_FILENAME)
     100    try:
     101        f = open(filename, 'rb')
     102    except IOError:
     103        app.info("")
     104        app.warn("Unable to fetch %s "%filename)
     105        return None
     106    docenv = cPickle.load(f)
     107    f.close()
     108    return docenv
     109
     110def merge_js_index(app):
     111    """
     112    Merge the JS indexes of the sub-docs into the main JS index
     113    """
     114    app.info('')
     115    app.info(bold('Merging js index files...'))
     116    mapping = app.builder.indexer._mapping
     117    for curdoc in app.env.config.multidocs_subdoc_list:
     118        app.info("    %s:"%curdoc, nonl=1)
     119        fixpath = lambda path: os.path.join(curdoc, path)
     120        index = get_js_index(app, curdoc)
     121        if index is not None:
     122            # merge the mappings
     123            app.info(" %s js index entries"%(len(index._mapping)))
     124            for (ref, locs) in index._mapping.iteritems():
     125                newmapping = set(map(fixpath, locs))
     126                if ref in mapping:
     127                    newmapping = mapping[ref] | newmapping
     128                mapping[unicode(ref)] = newmapping
     129            # merge the titles
     130            titles = app.builder.indexer._titles
     131            for (res, title) in index._titles.iteritems():
     132                titles[fixpath(res)] = title
     133            # TODO: merge indexer._objtypes, indexer._objnames as well
     134
     135            # Setup source symbolic links
     136            dest = os.path.join(app.outdir, "_sources", curdoc)
     137            if not os.path.exists(dest):
     138                os.symlink(os.path.join("..", curdoc, "_sources"), dest)
     139    app.info('... done (%s js index entries)'%(len(mapping)))
     140    app.info(bold('Writing js search indexes...'), nonl=1)
     141    return [] # no extra page to setup
     142
     143def get_js_index(app, curdoc):
     144    """
     145    Get the JS index of a sub-doc from the file
     146    """
     147    from sphinx.search import IndexBuilder, languages
     148    # FIXME: find the correct lang
     149    indexer = IndexBuilder(app.env, 'en',
     150                           app.config.html_search_options)
     151    indexfile = os.path.join(app.outdir, curdoc, 'searchindex.js')
     152    try:
     153        f = open(indexfile, 'rb')
     154    except IOError:
     155        app.info("")
     156        app.warn("Unable to fetch %s "%indexfile)
     157        return None
     158    indexer.load(f, sphinx.search.js_index)
     159    f.close()
     160    return indexer
     161
     162
     163mustbefixed = ['search', 'genindex', 'genindex-all'
     164               'py-modindex', 'searchindex.js']
     165def fix_path_html(app, pagename, templatename, ctx, event_arg):
     166    """
     167    Fixes the context so that the files
     168    - search.html
     169    - genindex.html
     170    - py-modindex.html
     171    point to the right place, that is in
     172        reference/
     173    instead of
     174        reference/subdocument
     175    """
     176    # sphinx/builder/html.py line 702
     177    # def pathto(otheruri, resource=False,
     178    #            baseuri=self.get_target_uri(pagename)):
     179    old_pathto = ctx['pathto']
     180    def sage_pathto(otheruri, *args, **opts):
     181        if otheruri in mustbefixed:
     182            otheruri = os.path.join("..", otheruri)
     183        return old_pathto(otheruri, *args, **opts)
     184    ctx['pathto'] = sage_pathto
     185
     186
     187def write_citations(app, citations):
     188    """
     189    Pickle the citation in a file
     190    """
     191    import cPickle
     192    file = open(os.path.join(app.outdir, CITE_FILENAME), 'wb')
     193    cPickle.dump(citations, file)
     194    file.close()
     195    app.info("Saved pickle file: %s"%CITE_FILENAME)
     196
     197
     198def fetch_citation(app, env):
     199    """
     200    Fetch the global citation index from the refman to allow for cross
     201    references.
     202    """
     203    app.builder.info(bold('loading cross citations... '), nonl=1)
     204    filename = os.path.join(app.outdir, '..', CITE_FILENAME)
     205    if not os.path.exists(filename):
     206        return
     207    import cPickle
     208    file = open(filename, 'rb')
     209    try:
     210        cache = cPickle.load(file)
     211    except:
     212        app.warn("Cache file '%s' is corrupted; ignoring it..."% filename)
     213        return
     214    else:
     215        app.builder.info("done (%s citations)."%len(cache))
     216    finally:
     217        file.close()
     218    cite = env.citations
     219    for ind, (path, tag) in cache.iteritems():
     220        if ind not in cite: # don't override local citation
     221            cite[ind]=(os.path.join("..", path), tag)
     222
     223def init_subdoc(app):
     224    """
     225    Init the merger depending on if we are compiling a subdoc or the master
     226    doc itself.
     227    """
     228    if app.config.multidocs_is_master:
     229        app.info(bold("Compiling the master document"))
     230        app.connect('env-updated', merge_environment)
     231        app.connect('html-collect-pages', merge_js_index)
     232        if app.config.multidocs_subdoc_list:
     233            # Master file with indexes computed by merging indexes:
     234            # Monkey patch index fetching to silence warning about broken index
     235            def load_indexer(docnames):
     236                app.builder.info(bold('Skipping loading of indexes'), nonl=1)
     237            app.builder.load_indexer = load_indexer
     238
     239    else:
     240        app.info(bold("Compiling a sub-document"))
     241        app.connect('env-updated', fetch_citation)
     242        app.connect('html-page-context', fix_path_html)
     243
     244        # Monkey patch copy_static_files to make a symlink to "../"
     245        def link_static_files():
     246            """
     247            Instead of copying static files, make a link to the master static file.
     248            See sphinx/builder/html.py line 536::
     249
     250                class StandaloneHTMLBuilder(Builder):
     251                [...]
     252                    def copy_static_files(self):
     253                    [...]
     254            """
     255            app.builder.info(bold('linking _static directory.'))
     256            static_dir = os.path.join(app.builder.outdir, '_static')
     257            master_static_dir = os.path.join('..', '_static')
     258            if not os.path.isdir(static_dir):
     259                os.symlink(master_static_dir, static_dir)
     260
     261        app.builder.copy_static_files = link_static_files
     262
     263    if app.config.multidoc_first_pass == 1:
     264        app.config.intersphinx_mapping = {}
     265
     266
     267def setup(app):
     268    app.add_config_value('multidocs_is_master', True, True)
     269    app.add_config_value('multidocs_subdoc_list', [], True)
     270    app.add_config_value('multidoc_first_pass', 0, False)   # 1 = deactivate the loading of the inventory
     271    app.connect('builder-inited', init_subdoc)
  • doc/common/themes/sage/layout.html

    diff --git a/doc/common/themes/sage/layout.html b/doc/common/themes/sage/layout.html
    a b  
    77    {% if pathto(master_doc).endswith('.html') %}
    88      <a href="{{ '../' + pathto(master_doc) }}"><img src="{{ pathto('_static/sagelogo.png', 1) }}" style="vertical-align: middle" title="Sage Logo"></a>
    99    {% else %}
    10       <a href="{{ '../' + pathto(master_doc) + 'index.html' }}"><img src="{{ pathto('_static/sagelogo.png', 1) }}" style="vertical-align: middle" title="Sage Logo"></a>
     10      <a href="{{ '../' + pathto(master_doc, 1) + '.html' }}"><img src="{{ pathto('_static/sagelogo.png', 1) }}" style="vertical-align: middle" title="Sage Logo"></a>
    1111    {% endif %}
    1212  {% endif %}
    1313  {{ super() }}
  • new file doc/common/themes/sageref/layout.html

    diff --git a/doc/common/themes/sageref/layout.html b/doc/common/themes/sageref/layout.html
    new file mode 100644
    - +  
     1{% extends "basic/layout.html" %}
     2
     3{% block rootrellink %}
     4  {% if docstitle.startswith('Sage Documentation') %}
     5    <a href="http://www.sagemath.org"><img src="{{ pathto('_static/sagelogo.png', 1) }}" style="vertical-align: middle" title="Sage Logo"></a>
     6  {% else %}
     7    {% if pathto(master_doc).endswith('.html') %}
     8      <a href="{{ '../../' + pathto(master_doc) }}"><img src="{{ pathto('_static/sagelogo.png', 1) }}" style="vertical-align: middle" title="Sage Logo"></a>
     9    {% else %}
     10      <a href="{{ '../../' + pathto(master_doc,1) + '.html' }}"><img src="{{ pathto('_static/sagelogo.png', 1) }}" style="vertical-align: middle" title="Sage Logo"></a>
     11      <a href="{{ '../' + 'index.html' }}"> Sage Reference Manual </a> &raquo;
     12    {% endif %}
     13  {% endif %}
     14  {{ super() }}
     15{% endblock %}
     16
     17{% block extrahead %}
     18    <link rel="icon" href="{{ pathto('_static/sageicon.png', 1) }}" type="image/x-icon" />
     19{% endblock %}
     20
     21{%- block footer %}
     22    {{ super() }}
     23    <script type="text/javascript">
     24/*global jQuery, window */
     25/* Sphinx sidebar toggle.  Putting this code at the end of the body
     26 * enables the toggle for the live, static, and offline docs.  Note:
     27 * sage.misc.html.math_parse() eats jQuery's dollar-sign shortcut. */
     28var jq = jQuery; 
     29jq(document).ready(function () {
     30    var bar, bod, bg, fg, key, tog, wid_old, wid_new, resize, get_state, set_state;
     31    bod = jq('div.bodywrapper');
     32    bar = jq('div.sphinxsidebar');
     33    tog = jq('<div class="sphinxsidebartoggle"></div>');
     34   
     35    /* Delayed resize helper.  Not perfect but good enough. */
     36    resize = function () {
     37        setTimeout(function () {
     38            tog.height(bod.height());
     39        }, 100);
     40    };
     41    jq(window).resize(function () {
     42        resize();
     43    });
     44   
     45    /* Setup and add the toggle. See Sphinx v0.5.1 default.css. */
     46    fg = jq('div.sphinxsidebar p a').css('color') || 'rgb(152, 219, 204)';
     47    bg = jq('div.document').css('background-color') || 'rgb(28, 78, 99)';
     48    wid_old = '230px';
     49    wid_new = '5px';
     50    tog.css('background-color', bg)
     51        .css('border-width', '0px')
     52        .css('border-right', wid_new + ' ridge ' + bg)
     53        .css('cursor', 'pointer')
     54        .css('position', 'absolute')
     55        .css('left', '-' + wid_new)
     56        .css('top', '0px')
     57        .css('width', wid_new);
     58    bod.css('position', 'relative');
     59    bod.prepend(tog);
     60    resize();
     61   
     62    /* Cookie helpers. */
     63    key = 'sphinxsidebar=';
     64    set_state = function (s) {
     65        var date = new Date();
     66        /* Expiry in 7 days. */
     67        date.setTime(date.getTime() + (7 * 24 * 3600 * 1000));
     68        document.cookie = key + encodeURIComponent(s) + '; expires=' +
     69            date.toUTCString() + '; path=/';
     70    };
     71    get_state = function () {
     72        var i, c, crumbs = document.cookie.split(';');
     73        for (i = 0; i < crumbs.length; i += 1) {
     74            c = crumbs[i].replace(/^\s+/, '');
     75            if (c.indexOf(key) === 0) {
     76                return decodeURIComponent(c.substring(key.length, c.length));
     77            }
     78        }
     79        return null;
     80    };
     81   
     82    /* Event handlers. */
     83    tog.mouseover(function (ev) {
     84        tog.css('border-right-color', fg);
     85    }).mouseout(function (ev) {
     86        tog.css('border-right-color', bg);
     87    }).click(function (ev) {
     88        if (bod.hasClass('wide')) {
     89            bod.removeClass('wide');
     90            bod.css('margin-left', wid_old);
     91            bar.css('width', wid_old);
     92            bar.show();
     93            set_state('visible');
     94        } else {
     95            set_state('hidden');
     96            bar.hide();
     97            bar.css('width', '0px');
     98            bod.css('margin-left', wid_new);
     99            bod.addClass('wide');
     100        }
     101        resize();
     102    });
     103   
     104    /* Hide the normally visible sidebar? */
     105    if (get_state() === 'hidden') {
     106        tog.trigger('click');
     107    } else {
     108        set_state('visible');
     109    }
     110});
     111    </script>
     112{%- endblock %}
     113
     114<!-- This macro block for the sidebar is heavily borrowed from the basic -->
     115<!-- theme of Sphinx 0.6.3. In particular, we borrowed from the file -->
     116<!-- themes/basic/layout.html distributed with Sphinx 0.6.3. -->
     117{%- macro sidebar() %}
     118      {%- if not embedded %}{% if not theme_nosidebar|tobool %}
     119      <div class="sphinxsidebar">
     120        <div class="sphinxsidebarwrapper">
     121          {%- block sidebarlogo %}
     122          {%- if logo %}
     123            <p class="logo"><a href="{{ pathto(master_doc) }}">
     124              <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
     125            </a></p>
     126          {%- endif %}
     127          {%- endblock %}
     128          {%- block sidebartoc %}
     129          {%- if display_toc %}
     130            <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
     131            {{ toc }}
     132          {%- endif %}
     133          {%- endblock %}
     134          {%- block sidebarrel %}
     135          {%- if prev %}
     136            <h4>{{ _('Previous topic') }}</h4>
     137            <p class="topless"><a href="{{ prev.link|e }}"
     138                                  title="{{ _('previous chapter') }}">{{ prev.title }}</a></p>
     139          {%- endif %}
     140          {%- if next %}
     141            <h4>{{ _('Next topic') }}</h4>
     142            <p class="topless"><a href="{{ next.link|e }}"
     143                                  title="{{ _('next chapter') }}">{{ next.title }}</a></p>
     144          {%- endif %}
     145          {%- endblock %}
     146          {%- block sidebarsourcelink %}
     147          {%- if show_source and has_source and sourcename %}
     148            <h3>{{ _('This Page') }}</h3>
     149            <ul class="this-page-menu">
     150              <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
     151                     rel="nofollow">{{ _('Show Source') }}</a></li>
     152            </ul>
     153          {%- endif %}
     154          {%- endblock %}
     155          {%- if customsidebar %}
     156          {% include customsidebar %}
     157          {%- endif %}
     158          {%- block sidebarsearch %}
     159          {%- if pagename != "search" %}
     160          <div id="searchbox" style="display: none">
     161            <h3>{{ _('Quick search') }}</h3>
     162              <form class="search" action="{{ pathto('search') }}" method="get">
     163                <input type="text" name="q" size="18" />
     164                <!-- The shading of the "Go" button should be consistent -->
     165                <!-- with the colour of the header and footer. See the file -->
     166                <!-- doc/common/themes/sage/theme.conf for colours used by -->
     167                <!-- the Sage theme. -->
     168                <input type="submit" style="background-color: #B8B9F6" value="{{ _('Go') }}" />
     169                <input type="hidden" name="check_keywords" value="yes" />
     170                <input type="hidden" name="area" value="default" />
     171              </form>
     172              <p class="searchtip" style="font-size: 90%">
     173              {{ _('Enter search terms or a module, class or function name.') }}
     174              </p>
     175          </div>
     176          <script type="text/javascript">$('#searchbox').show(0);</script>
     177          {%- endif %}
     178          {%- endblock %}
     179        </div>
     180      </div>
     181      {%- endif %}{% endif %}
     182{%- endmacro %}
  • new file doc/common/themes/sageref/static/favicon.ico

    diff --git a/doc/common/themes/sageref/static/favicon.ico b/doc/common/themes/sageref/static/favicon.ico
    new file mode 100644
    index 0000000000000000000000000000000000000000..51775bc542a5d8653935c5223b9ecd616cb1e085
    GIT binary patch
    literal 1150
    zc$}q^KT88a5XI-z_zxqeVh|AtA|eQ4DMCcCv$3+X(Mmr+K(M%gtyrWLECfYJC)n9o
    z2^L9_A}A@u;z;mAoNv5$FsyefxZxKzGy7&|XC@*ZKE5ybF3Mq_NI^sv0Zg#O_OAtB
    zD<6}rC<s1McmwC)IK%%FZEyfIb}twP^NdybMf(mm!6+C31yBduU=`%R7<kFhuY(c@
    zK^06pv2TH&@vdF41-j<^lyjy7YM^LruRLe92?LB{ZA~y^YH<lXzD>`sfF0)Ou?8KZ
    z*SC#>vU5*`xjcdku*4oHdG;Ux&%D26^mB}B^IT)x9^S9I1uzSSm|L4?m%)+Imd)F>
    zkN3vcWo{FuUUy)F`|Bv4n+AVtE%uE5lzMk=^bHTx){O6l_0s(l_ij%Vozs4B=Ga5V
    z)c?dJ>+5Pm*280*EA~0@YrS-4PExc9nw!q&KHsNz4KgR~VJ`YUUw=XG)ETR$`Q@MM
    E6WVp2FaQ7m
  • new file doc/common/themes/sageref/static/mathjax_sage.js_t

    diff --git a/doc/common/themes/sageref/static/mathjax_sage.js_t b/doc/common/themes/sageref/static/mathjax_sage.js_t
    new file mode 100644
    - +  
     1MathJax.Hub.Config({
     2  imageFont: null,
     3  tex2jax: {
     4    inlineMath: [['$','$'],['\\(','\\)']],
     5    processEscapes: true,
     6  },
     7  styles: {
     8    ".MathJax .mo, .MathJax .mi": {
     9      color: "inherit ! important"
     10    }
     11  },
     12  TeX: {
     13    Macros: {
     14     {{ theme_mathjax_macros|join(',\n') }}
     15    }
     16  }
     17});
     18
     19// This path is a little funny because we have to load our local
     20// config file as '../mathjax_sage' in the theme conf.py
     21MathJax.Ajax.loadComplete("[MathJax]/config/../mathjax_sage.js")
  • new file doc/common/themes/sageref/static/sage.css_t

    diff --git a/doc/common/themes/sageref/static/sage.css_t b/doc/common/themes/sageref/static/sage.css_t
    new file mode 100644
    - +  
     1/**
     2 * Sage stylesheet theme. This stylesheet is heavily borrowed from the
     3 * Sphinx stylesheet default theme distributed as the file
     4 * themes/default/static/default.css_t in Sphinx 0.6.3.
     5 */
     6
     7@import url("basic.css");
     8
     9/* -- page layout ----------------------------------------------------------- */
     10
     11body {
     12    font-family: {{ theme_bodyfont }};
     13    font-size: 100%;
     14    background-color: {{ theme_footerbgcolor }};
     15    color: #000;
     16    margin: 0;
     17    padding: 0;
     18}
     19
     20div.document {
     21    background-color: {{ theme_sidebarbgcolor }};
     22}
     23
     24div.documentwrapper {
     25    float: left;
     26    width: 100%;
     27}
     28
     29div.bodywrapper {
     30    margin: 0 0 0 230px;
     31}
     32
     33div.body {
     34    background-color: {{ theme_bgcolor }};
     35    color: {{ theme_textcolor }};
     36    padding: 0 20px 30px 20px;
     37}
     38
     39{%- if theme_rightsidebar|tobool %}
     40div.bodywrapper {
     41    margin: 0 230px 0 0;
     42}
     43{%- endif %}
     44
     45div.footer {
     46    color: {{ theme_footertextcolor }};
     47    width: 100%;
     48    padding: 9px 0 9px 0;
     49    text-align: center;
     50    font-size: 75%;
     51}
     52
     53div.footer a {
     54    color: {{ theme_footertextcolor }};
     55    text-decoration: underline;
     56}
     57
     58div.related {
     59    background-color: {{ theme_relbarbgcolor }};
     60    line-height: 30px;
     61    color: {{ theme_relbartextcolor }};
     62}
     63
     64div.related a {
     65    color: {{ theme_relbarlinkcolor }};
     66}
     67
     68div.sphinxsidebar {
     69    {%- if theme_stickysidebar|tobool %}
     70    top: 30px;
     71    margin: 0;
     72    position: fixed;
     73    overflow: auto;
     74    height: 100%;
     75    {%- endif %}
     76    {%- if theme_rightsidebar|tobool %}
     77    float: right;
     78    {%- if theme_stickysidebar|tobool %}
     79    right: 0;
     80    {%- endif %}
     81    {%- endif %}
     82}
     83
     84{%- if theme_stickysidebar|tobool %}
     85/* this is nice, but it it leads to hidden headings when jumping
     86   to an anchor */
     87/*
     88div.related {
     89    position: fixed;
     90}
     91
     92div.documentwrapper {
     93    margin-top: 30px;
     94}
     95*/
     96{%- endif %}
     97
     98div.sphinxsidebar h3 {
     99    font-family: {{ theme_headfont }};
     100    color: {{ theme_sidebartextcolor }};
     101    font-size: 1.4em;
     102    font-weight: normal;
     103    margin: 0;
     104    padding: 0;
     105}
     106
     107div.sphinxsidebar h3 a {
     108    color: {{ theme_sidebartextcolor }};
     109}
     110
     111div.sphinxsidebar h4 {
     112    font-family: {{ theme_headfont }};
     113    color: {{ theme_sidebartextcolor }};
     114    font-size: 1.3em;
     115    font-weight: normal;
     116    margin: 5px 0 0 0;
     117    padding: 0;
     118}
     119
     120div.sphinxsidebar p {
     121    color: {{ theme_sidebartextcolor }};
     122}
     123
     124div.sphinxsidebar p.topless {
     125    margin: 5px 10px 10px 10px;
     126}
     127
     128div.sphinxsidebar ul {
     129    margin: 10px;
     130    padding: 0;
     131    color: {{ theme_sidebartextcolor }};
     132}
     133
     134div.sphinxsidebar a {
     135    color: {{ theme_sidebarlinkcolor }};
     136}
     137
     138div.sphinxsidebar input {
     139    border: 1px solid {{ theme_sidebarlinkcolor }};
     140    font-family: sans-serif;
     141    font-size: 1em;
     142}
     143
     144/* -- body styles ----------------------------------------------------------- */
     145
     146a {
     147    color: {{ theme_linkcolor }};
     148    text-decoration: none;
     149}
     150
     151a:hover {
     152    text-decoration: underline;
     153}
     154
     155div.body p, div.body dd, div.body li {
     156    text-align: justify;
     157    line-height: 130%;
     158}
     159
     160div.body h1,
     161div.body h2,
     162div.body h3,
     163div.body h4,
     164div.body h5,
     165div.body h6 {
     166    font-family: {{ theme_headfont }};
     167    background-color: {{ theme_headbgcolor }};
     168    font-weight: normal;
     169    color: {{ theme_headtextcolor }};
     170    border-bottom: 1px solid #ccc;
     171    margin: 20px -20px 10px -20px;
     172    padding: 3px 0 3px 10px;
     173}
     174
     175div.body h1 { margin-top: 0; font-size: 200%; }
     176div.body h2 { font-size: 160%; }
     177div.body h3 { font-size: 140%; }
     178div.body h4 { font-size: 120%; }
     179div.body h5 { font-size: 110%; }
     180div.body h6 { font-size: 100%; }
     181
     182a.headerlink {
     183    color: {{ theme_headlinkcolor }};
     184    font-size: 0.8em;
     185    padding: 0 4px 0 4px;
     186    text-decoration: none;
     187}
     188
     189a.headerlink:hover {
     190    background-color: {{ theme_headlinkcolor }};
     191    color: white;
     192}
     193
     194div.body p, div.body dd, div.body li {
     195    text-align: justify;
     196    line-height: 130%;
     197}
     198
     199div.admonition p.admonition-title + p {
     200    display: inline;
     201}
     202
     203div.note {
     204    background-color: #eee;
     205    border: 1px solid #ccc;
     206}
     207
     208div.seealso {
     209    background-color: #ffc;
     210    border: 1px solid #ff6;
     211}
     212
     213div.topic {
     214    background-color: #eee;
     215}
     216
     217div.warning {
     218    background-color: #ffe4e4;
     219    border: 1px solid #f66;
     220}
     221
     222p.admonition-title {
     223    display: inline;
     224}
     225
     226p.admonition-title:after {
     227    content: ":";
     228}
     229
     230/**
     231 * Code block.
     232 * The border colour should be a darker shade of the background colour.
     233 * The hex code #E8D898 used below is a pale, light grayish amber.
     234 */
     235pre {
     236    padding: 5px;
     237    background-color: {{ theme_codebgcolor }};
     238    color: {{ theme_codetextcolor }};
     239    line-height: 120%;
     240    border: 1px solid #E8D898;
     241    border-left: none;
     242    border-right: none;
     243}
     244
     245/**
     246 * Commands or code within text. The hex code #EAEAF8 used below is a
     247 * pale, light grayish blue.
     248 */
     249tt {
     250    background-color: #EAEAF8;
     251    padding: 0 1px 0 1px;
     252    font-size: 0.95em;
     253}
  • new file doc/common/themes/sageref/theme.conf

    diff --git a/doc/common/themes/sageref/theme.conf b/doc/common/themes/sageref/theme.conf
    new file mode 100644
    - +  
     1[theme]
     2inherit = default
     3stylesheet = sage.css
     4pygments_style = sphinx
     5
     6[options]
     7# Custom Sage theme options
     8
     9# MathJax settings filled in by conf.py
     10mathjax_macros =
     11
     12# Sphinx default theme options
     13
     14#nosidebar = false
     15#rightsidebar = false
     16#stickysidebar = false
     17
     18# Background color for the footer line: pale, light grayish blue (CSS color):
     19footerbgcolor    = #B8B9F6
     20# Text color for the footer line: black (CSS color):
     21footertextcolor  = #000000
     22# Background color for the sidebar: light bluish gray (CSS color):
     23sidebarbgcolor   = #EAEAF8
     24# Text color for the sidebar: black (CSS color):
     25sidebartextcolor = #000000
     26# Link color for the sidebar: dark blue (CSS color):
     27sidebarlinkcolor = #090999
     28# Background color for the relation bar: pale, light grayish blue (CSS color):
     29relbarbgcolor    = #B8B9F6
     30# Text color for the relation bar: black (CSS color):
     31relbartextcolor  = #000000
     32# Link color for the relation bar: dark blue (CSS color):
     33relbarlinkcolor  = #090999
     34# Body background color (CSS color):
     35#bgcolor          = #ffffff
     36# Body text color: black (CSS color):
     37textcolor        = #000000
     38# Background color for headings: light bluish gray (CSS color):
     39headbgcolor      = #EAEAF8
     40# Text color for headings (CSS color):
     41#headtextcolor    = #20435c
     42# Link color for headings (CSS color):
     43#headlinkcolor    = #c60f0f
     44# Body link color: dark greenish blue (CSS color):
     45linkcolor        = #45529B
     46# Background color for code blocks: very pale yellow (CSS color):
     47codebgcolor      = #FFFFE5
     48# Default text color for code blocks, if not set differently by the highlighting style (CSS color):
     49#codetextcolor    = #333333
     50
     51# Font for normal text (CSS font-family):
     52#bodyfont = sans-serif
     53# Font for headings (CSS font-family):
     54#headfont = 'Trebuchet MS', sans-serif
  • doc/en/reference/arithgroup/index.rst

    diff --git a/doc/en/reference/arithgroup/index.rst b/doc/en/reference/arithgroup/index.rst
    a b  
    1 Arithmetic Subgroups of `{\rm SL}_2(\ZZ)`
    2 ================================================
     1Arithmetic Subgroups of `{\rm SL}_2({\bf Z})`
     2=============================================
    33
    44This chapter describes the basic functionality for finite index subgroups of
    55the modular group `{\rm SL}_2(\ZZ)`.
  • doc/en/reference/conf.py

    diff --git a/doc/en/reference/conf.py b/doc/en/reference/conf.py
    a b import sys, os 
    1515sys.path.append(os.environ['SAGE_DOC'])
    1616from common.conf import *
    1717
     18# settings for the intersphinx extension:
     19
     20ref_src = os.path.join(SAGE_DOC, 'en', 'reference')
     21ref_out = os.path.join(SAGE_DOC, 'output', 'html', 'en', 'reference')
     22intersphinx_mapping[ref_out] = None
     23
     24for doc in os.listdir(ref_src):
     25    if os.path.exists(os.path.join(ref_src, doc, 'index.rst')):
     26        intersphinx_mapping[os.path.join(ref_out, doc)] = None
     27
    1828# General information about the project.
    1929project = u"Sage Reference Manual"
    2030name = "reference"
    latex_elements['preamble'] += r''' 
    5060
    5161#Ignore all .rst in the _sage subdirectory
    5262exclude_trees = exclude_trees + ['_sage']
     63
     64multidocs_is_master = True
     65
     66# List of subdocs
     67multidocs_subdoc_list = [
     68    'algebras',
     69    'arithgroup',
     70    'calculus',
     71    'categories',
     72    'cmd',
     73    'coding',
     74    'coercion',
     75    'combinat',
     76    'constants',
     77    'cryptography',
     78    'databases',
     79    'finance',
     80    'function_fields',
     81    'functions',
     82    'games',
     83    'geometry',
     84    'graphs',
     85    'groups',
     86    'hecke',
     87    'history_and_license',
     88    'homology',
     89    'interfaces',
     90    'lfunctions',
     91    'libs',
     92    'logic',
     93    'matrices',
     94    'misc',
     95    'modabvar',
     96    'modfrm',
     97    'modmisc',
     98    'modsym',
     99    'modules',
     100    'monoids',
     101    'notebook',
     102    'number_fields',
     103    'numerical',
     104    'padics',
     105    'parallel',
     106    'plane_curves',
     107    'plot3d',
     108    'plotting',
     109    'polynomial_rings',
     110    'power_series',
     111    'probability',
     112    'quadratic_forms',
     113    'quat_algebras',
     114    'rings',
     115    'rings_numerical',
     116    'rings_standard',
     117    'schemes',
     118    'semirings',
     119    'stats',
     120    'structure',
     121    'tensor'
     122    ]
     123
     124# List of directories, relative to source directory, that shouldn't be
     125# searched for source files.
     126exclude_trees += multidocs_subdoc_list + [
     127    'sage', 'sagenb', 'options'
     128    ]
  • new file doc/en/reference/conf_sub.py

    diff --git a/doc/en/reference/conf_sub.py b/doc/en/reference/conf_sub.py
    new file mode 100644
    - +  
     1# -*- coding: utf-8 -*-
     2#
     3# Sage documentation build configuration file, created by
     4# sphinx-quickstart on Thu Aug 21 20:15:55 2008.
     5#
     6# This file is execfile()d with the current directory set to its containing dir.
     7#
     8# The contents of this file are pickled, so don't put values in the namespace
     9# that aren't pickleable (module imports are okay, they're removed automatically).
     10#
     11# All configuration values have a default; values that are commented out
     12# serve to show the default.
     13
     14import sys, os
     15sys.path.append(os.environ['SAGE_DOC'])
     16from common.conf import *
     17
     18# settings for the intersphinx extension:
     19
     20ref_src = os.path.join(SAGE_DOC, 'en', 'reference')
     21ref_out = os.path.join(SAGE_DOC, 'output', 'html', 'en', 'reference')
     22intersphinx_mapping[ref_out] = None
     23
     24for doc in os.listdir(ref_src):
     25    if os.path.exists(os.path.join(ref_src, doc, 'index.rst')):
     26        intersphinx_mapping[os.path.join(ref_out, doc)] = None
     27
     28# We use the main document's title, if we can find it.
     29rst_file = open('index.rst', 'r')
     30rst_lines = rst_file.read().splitlines()
     31rst_file.close()
     32
     33title = u''
     34for i in xrange(len(rst_lines)):
     35    if rst_lines[i].startswith('==') and i > 0:
     36        title = rst_lines[i-1].strip()
     37        break
     38
     39# Otherwise, we use this directory's name.
     40name = os.path.basename(os.path.abspath('.'))
     41if not title:
     42    title = name.capitalize()
     43title = title.replace(u'`', u'$')
     44
     45# General information about the project.
     46project = u'Sage Reference Manual: ' + title
     47
     48# The name for this set of Sphinx documents.  If None, it defaults to
     49# "<project> v<release> documentation".
     50html_title = u'Sage Reference Manual v' + release + ': ' + title
     51
     52# A shorter title for the navigation bar.  Default is the same as html_title.
     53html_short_title = title
     54
     55# HTML theme (e.g., 'default', 'sphinxdoc').  The pages for the
     56# reference manual use a custom theme, a slight variant on the 'sage'
     57# theme, to set the links in the top line.
     58html_theme = 'sageref'
     59
     60# Output file base name for HTML help builder.
     61htmlhelp_basename = name
     62
     63# Grouping the document tree into LaTeX files. List of tuples (source
     64# start file, target name, title, author, document class
     65# [howto/manual]).
     66latex_documents = [
     67('index', name + '.tex', project, u'The Sage Development Team', 'manual')
     68]
     69
     70#Ignore all .rst in the _sage subdirectory
     71exclude_trees = exclude_trees + ['_sage']
     72
     73multidocs_is_master = False
  • new file doc/en/reference/footer.txt

    diff --git a/doc/en/reference/footer.txt b/doc/en/reference/footer.txt
    new file mode 100644
    - +  
     1Indices and Tables
     2==================
     3
     4* `Index <../genindex.html>`_
     5* `Module Index <../py-modindex.html>`_
     6* `Search Page <../search.html>`_
  • doc/en/reference/games/index.rst

    diff --git a/doc/en/reference/games/index.rst b/doc/en/reference/games/index.rst
    a b Games 
    22=====
    33
    44Sage includes a sophisticated Sudoku solver.  It also has a
    5 Rubik's cube solver (see :ref:`Rubik's Cube Group <sec-rubik>`).
     5Rubik's cube solver (see
     6`Rubik's Cube Group <../groups/sage/groups/perm_gps/cubegroup.html>`_).
    67
    78.. toctree::
    89   :maxdepth: 2
  • doc/en/reference/hecke/index.rst

    diff --git a/doc/en/reference/hecke/index.rst b/doc/en/reference/hecke/index.rst
    a b General Hecke Algebras and Hecke Modules 
    33
    44This chapter describes the basic functionality for modules over Hecke
    55algebras, including decompositions, degeneracy maps and so on. For specific
    6 examples of Hecke algebras that use this functionality see :ref:`ch:modsym` and
    7 :ref:`ch:modular`.
     6examples of Hecke algebras that use this functionality see `Modular
     7Symbols <../modsym/index.html>`_ and `Modular Forms
     8<../modfrm/index.html>`_.
    89
    910.. toctree::
    1011   :maxdepth: 2
  • doc/en/reference/index.rst

    diff --git a/doc/en/reference/index.rst b/doc/en/reference/index.rst
    a b  
    1 .. Sage Reference Manual documentation master file, created by sphinx-quickstart on Sun Sep 28 03:34:37 2008.
    2    You can adapt this file completely to your liking, but it should at least
    3    contain the root `toctree` directive.
    4 
    5 .. _ch:intro:
    6 
    71Welcome to Sage's Reference Manual!
    82=================================================
    93
    usage of Sage. The examples are all test 
    2014Sage, and should produce exactly the same output as in this manual,
    2115except for line breaks.
    2216
    23 The Sage command line is briefly described in :ref:`ch:cmdline`, which
    24 lists the command line options. For more details about the command
    25 line, see the Sage tutorial.
     17The Sage command line is briefly described in :doc:`The Sage Command Line
     18<cmd/index>`, which lists the command line options. For more
     19details about the command line, see the Sage tutorial.
    2620
    27 The Sage graphical user interface is described in
    28 :ref:`ch:notebook`. This graphical user interface is unusual in that
    29 it operates via your web browser. It provides you with Sage worksheets
    30 that you can edit and evaluate, which contain scalable typeset
    31 mathematics and beautiful antialiased images.
     21The Sage graphical user interface is described in :doc:`The Sage Notebook
     22<notebook/index>`. This graphical user interface is unusual in
     23that it operates via your web browser. It provides you with Sage
     24worksheets that you can edit and evaluate, which contain scalable
     25typeset mathematics and beautiful antialiased images.
    3226
    3327This work is licensed under a `Creative Commons Attribution-Share Alike
    34283.0 License`__.
    3.0 License`__. 
    3731
    3832Enjoy Sage!
    3933
     34Table of Contents
     35=================
     36
     37* :doc:`The Sage Command Line <cmd/index>`
     38* :doc:`The Sage Notebook <notebook/index>`
     39
     40Calculus, Plotting
     41------------------
     42
     43* :doc:`Symbolic Calculus <calculus/index>`
     44* :doc:`Constants <constants/index>`
     45* :doc:`Functions <functions/index>`
     46* :doc:`2D Graphics <plotting/index>`
     47* :doc:`3D Graphics <plot3d/index>`
     48
     49Combinatorics, Discrete Mathematics
     50-----------------------------------
     51
     52* :doc:`Combinatorics <combinat/index>`
     53* :doc:`Graph Theory <graphs/index>`
     54
     55Structures, Coercion, Categories
     56--------------------------------
     57
     58* :doc:`Basic Structures <structure/index>`
     59* :doc:`Coercion <coercion/index>`
     60* :doc:`Category Theory and Categories <categories/index>`
     61
     62Rings, Fields, Algebras
     63-----------------------
     64
     65* :doc:`General Rings, Ideals, and Morphisms <rings/index>`
     66* :doc:`Standard Commutative Rings <rings_standard/index>`
     67* :doc:`Fixed and Arbitrary Precision Numerical Fields <rings_numerical/index>`
     68* :doc:`Algebraic Number Fields <number_fields/index>`
     69* :doc:`Function Fields <function_fields/index>`
     70* :doc:`p-Adics <padics/index>`
     71* :doc:`Polynomial Rings <polynomial_rings/index>`
     72* :doc:`Power Series Rings <power_series/index>`
     73* :doc:`Standard Semirings <semirings/index>`
     74* :doc:`Algebras <algebras/index>`
     75* :doc:`Quaternion Algebras <quat_algebras/index>`
     76
     77Groups, Monoids, Matrices, Modules
     78----------------------------------
     79
     80* :doc:`Groups <groups/index>`
     81* :doc:`Monoids <monoids/index>`
     82* :doc:`Matrices and Spaces of Matrices <matrices/index>`
     83* :doc:`Modules <modules/index>`
     84
     85Geometry and Topology
     86---------------------
     87
     88* :doc:`Combinatorial Geometry <geometry/index>`
     89* :doc:`Cell Complexes and their Homology <homology/index>`
     90* :doc:`Differential Forms <tensor/index>`
     91
     92Number Theory, Algebraic Geometry
     93---------------------------------
     94
     95* :doc:`Quadratic Forms <quadratic_forms/index>`
     96* :doc:`L-Functions <lfunctions/index>`
     97* :doc:`Schemes <schemes/index>`
     98* :doc:`Elliptic, Plane, and Hyperelliptic Curves <plane_curves/index>`
     99* :doc:`Arithmetic Subgroups of SL_2(Z) <arithgroup/index>`
     100* :doc:`General Hecke Algebras and Hecke Modules <hecke/index>`
     101* :doc:`Modular Symbols <modsym/index>`
     102* :doc:`Modular Forms <modfrm/index>`
     103* :doc:`Modular Abelian Varieties <modabvar/index>`
     104* :doc:`Miscellaneous Modular-Form-Related Modules <modmisc/index>`
     105
     106Miscellaneous Mathematics
     107-------------------------
     108
     109* :doc:`Games <games/index>`
     110* :doc:`Symbolic Logic <logic/index>`
     111* :doc:`SAT solvers <sat/index>`
     112* :doc:`Cryptography <cryptography/index>`
     113* :doc:`Numerical Optimization <numerical/index>`
     114* :doc:`Probability <probability/index>`
     115* :doc:`Statistics <stats/index>`
     116* :doc:`Quantitative Finance <finance/index>`
     117* :doc:`Coding Theory <coding/index>`
     118
     119Interfaces, Databases, Miscellany
     120---------------------------------
     121
     122* :doc:`Interpreter Interfaces <interfaces/index>`
     123* :doc:`C/C++ Library Interfaces <libs/index>`
     124* :doc:`Databases <databases/index>`
     125* :doc:`Parallel Computing <parallel/index>`
     126* :doc:`Miscellaneous <misc/index>`
     127
     128Other
     129-----
     130
    40131.. toctree::
    41132   :maxdepth: 2
    42133
    43    cmd
    44    notebook
    45    calculus
    46    plotting
    47    plot3d
    48    games
    49    graphs
    50    constants
    51    functions
    52    parallel
    53    structure
    54    coercion
    55    misc
    56    databases
    57    interfaces
    58    libs
    59    cryptography
    60    logic
    61    sat
    62    combinat/index
    63    numerical
    64    probability
    65    stats
    66    finance
    67    categories
    68    monoids
    69    groups
    70    rings
    71    rings_standard
    72    rings_numerical
    73    number_fields
    74    function_fields
    75    padics
    76    polynomial_rings
    77    power_series
    78    semirings
    79    algebras
    80    quadratic_forms
    81    quat_algebras
    82    matrices
    83    modules
    84    geometry
    85    homology
    86    lfunctions
    87    schemes
    88    plane_curves
    89    coding
    90    arithgroup
    91    hecke
    92    modsym
    93    modfrm
    94    modabvar
    95    modmisc
    96    tensor
    97 
    98134   todolist
    99135
    100    history_and_license
     136* :doc:`History and License <history_and_license/index>`
    101137
    102 Indices and tables
    103 ==================
     138Indices and Tables
     139------------------
    104140
    105141* :ref:`genindex`
    106142* :ref:`modindex`
    107143* :ref:`search`
    108 
  • doc/en/reference/interfaces/index.rst

    diff --git a/doc/en/reference/interfaces/index.rst b/doc/en/reference/interfaces/index.rst
    a b Interpreter Interfaces 
    33
    44Sage provides a unified interface to the best computational
    55software. This is accomplished using both C-libraries (see
    6 :ref:`ch:libraries`) and interpreter interfaces, which are
     6`C/C++ Library Interfaces <../libs/index.html>`_)
     7and interpreter interfaces, which are
    78implemented using pseudo-tty's, system files, etc. This chapter is
    89about these interpreter interfaces.
    910
    about these interpreter interfaces. 
    1819    There is overhead associated with each call to one of these
    1920    systems. For example, computing ``2+2`` thousands of times using
    2021    the GAP interface will be slower than doing it directly in
    21     Sage. In contrast, the C-library interfaces of :ref:`ch:libraries`
     22    Sage. In contrast, the C-library interfaces of
     23    `C/C++ Library Interfaces <../libs/index.html>`_
    2224    incur less overhead.
    2325
    2426
  • doc/en/reference/misc/index.rst

    diff --git a/doc/en/reference/misc/index.rst b/doc/en/reference/misc/index.rst
    a b LaTeX 
    5555.. toctree::
    5656   :maxdepth: 2
    5757
    58    other/sagetex
     58   sagetex
    5959   sage/misc/latex
    6060   sage/misc/latex_macros
    6161
  • doc/en/reference/todolist.rst

    diff --git a/doc/en/reference/todolist.rst b/doc/en/reference/todolist.rst
    a b There is still some work to do :-) : 
    1515        Rewrite the hand-written TODOs by using the correct ``.. todo::``
    1616        markup.
    1717
     18The combined to do list is only available in the html version of the reference manual.
     19
    1820.. todolist::
  • doc/en/website/conf.py

    diff --git a/doc/en/website/conf.py b/doc/en/website/conf.py
    a b latex_documents = [ 
    3333   u'The Sage Development Team', 'manual'),
    3434]
    3535
    36 
    37 
    3836html_additional_pages = {
    3937    'index': 'index.html',
    4038}
  • doc/en/website/templates/index.html

    diff --git a/doc/en/website/templates/index.html b/doc/en/website/templates/index.html
    a b  
    137137        <a class="biglink" href="reference/index.html">
    138138          Reference Manual
    139139        </a>
    140         <a title="Download PDF" class="pdf" href="../../pdf/en/reference/reference.pdf">
     140        <a title="Link to PDF" class="pdf" href="../../pdf/en/reference/index.html">
    141141          <img class="icon" src="_static/pdf.png"></img>
    142142        </a>
    143143        <br>
  • sage/combinat/tutorial.py

    diff --git a/sage/combinat/tutorial.py b/sage/combinat/tutorial.py
    a b node to which two complete binary trees  
    209209
    210210.. _figure-examples-catalan-trees:
    211211
    212 .. figure:: ../../media/combinat/complete-binary-trees-4.png
     212.. figure:: ../../media/complete-binary-trees-4.png
    213213    :scale: 150 %
    214214
    215215    Figure: The five complete binary trees with four leaves
    Partial orders on a set of `8` elements, 
    866866
    867867    sage: C.unrank(20).plot()
    868868
    869 .. image:: ../../media/combinat/a_poset.png
     869.. image:: ../../media/a_poset.png
    870870
    871871One can iterate through all graphs up to isomorphism. For example,
    872872there are 34 simple graphs with 5 vertices::
    Here are those with at most `4` edges:: 
    878878
    879879    sage: show(graphs(5, lambda G: G.size() <= 4))
    880880
    881 .. image:: ../../media/combinat/graphs-5.png
     881.. image:: ../../media/graphs-5.png
    882882
    883883However, the *set* ``C`` of these graphs is not yet available in
    884884``Sage``; as a result, the following commands are not yet
    prefix tree on the elements of `S`: a no 
    16091609
    16101610.. _figure-prefix-tree-partitions:
    16111611
    1612 .. figure:: ../../media/combinat/prefix-tree-partitions-5.png
     1612.. figure:: ../../media/prefix-tree-partitions-5.png
    16131613    :scale: 150%
    16141614
    16151615    Figure: The prefix tree of the partitions of 5.
    This polytope can be visualized in 3D wi 
    16741674
    16751675.. _figure-polytope:
    16761676
    1677 .. figure:: ../../media/combinat/polytope.png
     1677.. figure:: ../../media/polytope.png
    16781678    :scale: 75%
    16791679
    16801680    Figure: The polytope `L` and its integer points, in cross-eyed stereographic perspective.
    the possible ways to `G`, and then selec 
    18401840the ones that are still canonical [4]_. Recursively, one obtains all
    18411841the canonical graphs.
    18421842
    1843 .. figure:: ../../media/combinat/prefix-tree-graphs-4.png
     1843.. figure:: ../../media/prefix-tree-graphs-4.png
    18441844
    18451845   Figure: The generation tree of simple graphs with `4` vertices.
    18461846
  • sage/graphs/base/static_sparse_graph.pyx

    diff --git a/sage/graphs/base/static_sparse_graph.pyx b/sage/graphs/base/static_sparse_graph.pyx
    a b Author: 
    2424Data structure
    2525--------------
    2626
    27 .. image:: ../../../media/graphs/structure.png
     27.. image:: ../../../media/structure.png
    2828
    2929The data structure is actually pretty simple and compact. ``short_digraph`` has
    3030three fields
  • sage/graphs/graph_decompositions/graph_products.pyx

    diff --git a/sage/graphs/graph_decompositions/graph_products.pyx b/sage/graphs/graph_decompositions/graph_products.pyx
    a b we must ensure several things. 
    6464
    6565  A contradiction indeed.
    6666
    67   .. image:: ../../../media/graphs/cycle.png
     67  .. image:: ../../../media/cycle.png
    6868
    6969  That means that, for instance, the edges of a triangle necessarily have the
    7070  same color.
    we must ensure several things. 
    7676  In this situation, opposed edges necessarily have the same colors because of
    7777  the previous remark.
    7878
    79   .. image:: ../../../media/graphs/square.png
     79  .. image:: ../../../media/square.png
    8080
    8181  **1st criterion** : As a corollary, we know that:
    8282
  • sage/graphs/graph_latex.py

    diff --git a/sage/graphs/graph_latex.py b/sage/graphs/graph_latex.py
    a b AUTHORS: 
    1616LaTeX Versions of Graphs
    1717-------------------------------------
    1818
    19 .. image:: ../../media/graphs/heawood-graph-latex.png
     19.. image:: ../../media/heawood-graph-latex.png
    2020   :align: center
    2121
    2222Many mathematical objects in Sage have LaTeX representations, and graphs are no exception.  For a graph ``g``, the command ``view(g)``, issued at the Sage command line or in the notebook, will create a graphic version of ``g``.  Similarly, ``latex(g)`` will return a (long) string that is a representation of the graph in LaTeX.  Other ways of employing LaTeX in Sage, such as ``%latex`` in a notebook cell, or the Typeset checkbox in the notebook, will handle ``g`` appropriately.
  • sage/homology/delta_complex.py

    diff --git a/sage/homology/delta_complex.py b/sage/homology/delta_complex.py
    a b class DeltaComplex(GenericCellComplex): 
    149149      first in the prescribed way.  The three edges each start and end
    150150      at the single vertex, ``Simplex(0)``.
    151151
    152       .. image:: ../../media/homology/torus_labelled.png
     152      .. image:: ../../media/torus_labelled.png
    153153
    154154    - ``data`` may be nested lists or tuples.  The nth entry in the
    155155      list is a list of the n-simplices in the complex, and each
    class DeltaComplex(GenericCellComplex): 
    178178      If one draws two triangles and identifies them according to this
    179179      description, the result is the real projective plane.
    180180
    181       .. image:: ../../media/homology/rp2.png
     181      .. image:: ../../media/rp2.png
    182182
    183183      ::
    184184
    class DeltaComplexExamples(): 
    14831483        A `\Delta`-complex representation of the torus, consisting of one
    14841484        vertex, three edges, and two triangles.
    14851485
    1486         .. image:: ../../media/homology/torus.png
     1486        .. image:: ../../media/torus.png
    14871487
    14881488        EXAMPLES::
    14891489
    class DeltaComplexExamples(): 
    14971497        A `\Delta`-complex representation of the real projective plane,
    14981498        consisting of two vertices, three edges, and two triangles.
    14991499
    1500         .. image:: ../../media/homology/rp2.png
     1500        .. image:: ../../media/rp2.png
    15011501
    15021502        EXAMPLES::
    15031503
    class DeltaComplexExamples(): 
    15181518        A `\Delta`-complex representation of the Klein bottle, consisting
    15191519        of one vertex, three edges, and two triangles.
    15201520
    1521         .. image:: ../../media/homology/klein.png
     1521        .. image:: ../../media/klein.png
    15221522
    15231523        EXAMPLES::
    15241524
  • sage/homology/simplicial_complex.py

    diff --git a/sage/homology/simplicial_complex.py b/sage/homology/simplicial_complex.py
    a b simplices of `K`. Frequently, one abuse 
    3434denote both the simplicial complex and the associated topological
    3535space.
    3636
    37 .. image:: ../../media/homology/simplices.png
     37.. image:: ../../media/simplices.png
    3838
    3939For any simplicial complex `K` and any commutative ring `R` there is
    4040an associated chain complex, with differential of degree `-1`.  The
  • sage/misc/sagedoc.py

    diff --git a/sage/misc/sagedoc.py b/sage/misc/sagedoc.py
    a b TESTS: 
    1818Check that argspecs of extension function/methods appear correctly,
    1919see :trac:`12849`::
    2020   
    21     sage: docfilename = os.path.join(SAGE_ROOT, 'devel', 'sage', 'doc', 'output', 'html', 'en', 'reference', 'sage', 'symbolic', 'expression.html')
     21    sage: docfilename = os.path.join(SAGE_ROOT, 'devel', 'sage', 'doc', 'output', 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html')
    2222    sage: for line in open(docfilename):
    2323    ...       if "#sage.symbolic.expression.Expression.N" in line:
    2424    ...           print line
  • sage/modular/arithgroup/farey_symbol.pyx

    diff --git a/sage/modular/arithgroup/farey_symbol.pyx b/sage/modular/arithgroup/farey_symbol.pyx
    a b cdef class Farey: 
    419419        Farey symbol of the arithmetic group. The sides of the
    420420        hyperbolic polygon are numbered 0, 1, ... from left to right.
    421421
    422         .. image:: ../../../media/modular/arithgroup/pairing.png
     422        .. image:: ../../../media/pairing.png
    423423
    424424        EXAMPLES::
    425425