Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sage
Path: blob/develop/src/doc/en/reference/conf_sub.py
4112 views
1
# nodoctest
2
# Sage documentation build configuration file, created by
3
# sphinx-quickstart on Thu Aug 21 20:15:55 2008.
4
#
5
# This file is execfile()d with the current directory set to its containing dir.
6
#
7
# The contents of this file are pickled, so don't put values in the namespace
8
# that aren't pickleable (module imports are okay, they're removed automatically).
9
#
10
# All configuration values have a default; values that are commented out
11
# serve to show the default.
12
13
import os
14
15
from sage.env import SAGE_DOC, SAGE_DOC_SRC
16
from sage_docbuild.conf import *
17
from sage_docbuild.conf import exclude_patterns
18
19
# Add any paths that contain custom static files (such as style sheets),
20
# relative to this directory to html_static_path. They are copied after the
21
# builtin static files, so a file named "default.css" will overwrite the
22
# builtin "default.css". html_common_static_path imported from sage_docbuild.conf
23
# contains common paths.
24
html_static_path = [] + html_common_static_path
25
26
ref_src = os.path.join(SAGE_DOC_SRC, 'en', 'reference')
27
ref_out = os.path.join(SAGE_DOC, 'html', 'en', 'reference')
28
29
# We use the main document's title, if we can find it.
30
rst_file = open('index.rst', 'r', encoding='utf-8')
31
rst_lines = rst_file.read().splitlines()
32
rst_file.close()
33
34
title = ''
35
for i in range(len(rst_lines)):
36
if rst_lines[i].startswith('==') and i > 0:
37
title = rst_lines[i-1].strip()
38
break
39
40
# Otherwise, we use this directory's name.
41
name = os.path.basename(os.path.abspath('.'))
42
if not title:
43
title = name.capitalize()
44
title = title.replace('`', '$')
45
46
# We use the directory's name to add small view/edit buttons.
47
html_theme_options.update({
48
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/en/reference/{name}', '{filename}'),
49
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/en/reference/{name}', '{filename}'),
50
})
51
52
# General information about the project.
53
project = title
54
55
# The name for this set of Sphinx documents.
56
html_title = title
57
html_short_title = title
58
59
# Output file base name for HTML help builder.
60
htmlhelp_basename = name
61
62
# Grouping the document tree into LaTeX files. List of tuples (source
63
# start file, target name, title, author, document class
64
# [howto/manual]).
65
latex_documents = [
66
('index', name + '.tex', title,
67
'The Sage Development Team', 'manual')
68
]
69
70
latex_elements['hyperref'] = r"""
71
\usepackage{xr}
72
\externaldocument[../references/]{../references/references}
73
% Include hyperref last.
74
\usepackage{hyperref}
75
% Fix anchor placement for figures with captions.
76
\usepackage{hypcap}% it must be loaded after hyperref.
77
% Set up styles of URL: it should be placed after hyperref.
78
\urlstyle{same}"""
79
80
#Ignore all .rst in the _sage subdirectory
81
exclude_patterns = exclude_patterns + ['_sage']
82
83
multidocs_is_master = False
84
85