forked from mongodb/docs-primer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
135 lines (108 loc) · 4.3 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# -*- coding: utf-8 -*-
#
# MongoDB documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 3 09:58:40 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
import sys
import os
import datetime
from sphinx.errors import SphinxError
from giza.config.runtime import RuntimeStateConfig
from giza.config.helper import fetch_config, get_versions, get_manual_path
conf = fetch_config(RuntimeStateConfig())
sconf = conf.system.files.data.sphinx_local
sys.path.append(os.path.join(conf.paths.projectroot, conf.paths.buildsystem, 'sphinxext'))
try:
tags
except NameError:
class Tags(object):
def has(self, *args):
return False
tags = Tags()
# -- General configuration ----------------------------------------------------
needs_sphinx = '1.0'
extensions = [
'sphinx.ext.extlinks',
'sphinx.ext.todo',
'mongodb',
'directives',
'intermanual',
]
locale_dirs = [ os.path.join(conf.paths.projectroot, conf.paths.locale) ]
gettext_compact = False
templates_path = ['.templates']
exclude_patterns = []
source_suffix = '.txt'
master_doc = sconf.master_doc
language = 'en'
project = sconf.project
copyright = u'2008-{0}'.format(datetime.date.today().year)
version = conf.version.branch
release = conf.version.release
rst_epilog = '\n'.join([
'.. |copy| unicode:: U+000A9',
'.. |ent-build| replace:: MongoDB Enterprise',
'.. |year| replace:: {0}'.format(datetime.date.today().year),
'.. |hardlink| replace:: {0}/{1}'.format(conf.project.url, conf.git.branches.current),
'.. |branch| replace:: ``{0}``'.format(conf.git.branches.current),
])
pygments_style = 'sphinx'
extlinks = {
'hardlink' : ( 'http://docs.mongodb.org/{0}/%s'.format(conf.git.branches.current), ''),
'issue': ('https://jira.mongodb.org/browse/%s', '' ),
'api': ('http://api.mongodb.org/%s', ''),
'manual': ('http://docs.mongodb.org/manual%s', ''),
'ecosystem': ('http://docs.mongodb.org/ecosystem%s', ''),
'about': ('http://www.mongodb.org/about%s', ''),
### We could use the already defined :api: but if we need to specify a particular driver,
### we could just change here
'csharp-api': ('http://api.mongodb.org/csharp/current/html%s.htm', ''),
}
## add `extlinks` for each published version.
for i in conf.git.branches.published:
extlinks[i] = ( ''.join([ conf.project.url, '/', i, '%s' ]), '' )
intersphinx_mapping = {}
for i in conf.system.files.data.intersphinx:
intersphinx_mapping[i.name] = ( i.url, os.path.join(conf.paths.projectroot,
conf.paths.output,
i.path))
# -- Options for HTML output ---------------------------------------------------
html_theme = sconf.theme.name
html_theme_path = [ os.path.join(conf.paths.buildsystem, 'themes') ]
html_title = conf.project.title
htmlhelp_basename = 'MongoDBdoc'
html_logo = sconf.logo
html_static_path = sconf.paths.static
html_copy_source = False
html_use_smartypants = True
html_domain_indices = True
html_use_index = True
html_split_index = False
html_show_sourcelink = False
html_show_sphinx = True
html_show_copyright = True
manual_edition_path = '{0}/{1}/{2}'.format(conf.project.url,
conf.git.branches.current,
sconf.theme.book_path_base)
html_theme_options = {
'branch': conf.git.branches.current,
'manual_path': get_manual_path(conf),
'language': language,
'repo_name': sconf.theme.repo,
'jira_project': sconf.theme.jira,
'google_analytics': sconf.theme.google_analytics,
'project': sconf.theme.project,
'version': version,
'version_selector': [{'text':'Shell','path':'getting-started/shell'},
{'text':'Python','path':'getting-started/python'},
{'text':'Node.js','path':'getting-started/node'},
{'text':'C++','path':'getting-started/cpp'},
{'text':'Java','path':'getting-started/java'},
{'text':'C#','path':'getting-started/csharp'}],
# 'version_selector': get_versions(conf),
'stable': conf.version.stable,
'sitename': sconf.theme.sitename,
'nav_excluded': sconf.theme.nav_excluded,
}
html_sidebars = sconf.sidebars