Debian Codegraph @

doc/source/conf.py

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # -*- coding: utf-8 -*-
2 #
3 # Groonga documentation build configuration file, created by
4 # sphinx-quickstart on Thu Oct 22 15:42:37 2009.
5 #
6 # This file is execfile()d with the current directory set to its containing dir.
7 #
8 # Note that not all possible configuration values are present in this
9 # autogenerated file.
10 #
11 # All configuration values have a default; values that are commented out
12 # serve to show the default.
13
14 import docutils.parsers.rst.directives.misc
15 import re
16 import sphinx
17 import sys, os
18 import gettext
19 from datetime import datetime
20
21 # Workaround to allow the include directive to contain content when using
22 # Markdown (MyST-Parser).
23 #
24 # This is necessary only when using Markdown through the MyST-Parser. If we
25 # stop using Markdown or switch to a different parser in the future, this
26 # workaround could be removed.
27 #
28 # Without this change, we encounter warnings during documentation generation
29 # when using include directives with content. For example:
30 #
31 # ```{include} filename.md
32 # plugin_register functions/language_model
33 # ```
34 #
35 # This results in the warning:
36 # WARNING: include: Has content, but none permitted [myst.directive_parse]
37 #
38 # We considered the following approaches but chose this workaround for ease of
39 # maintenance:
40 # - Implementing a new directive in Python that allows content:
41 # - This would be increasing maintenance costs since our team primarily uses
42 # Ruby or C, not Python.
43 # - Modifying the Ruby script that updates execution examples:
44 # - This could be hard to figure out how to do and increase maintenance costs
45 # because it might be a complex approach.
46 #
47 # This workaround functions by setting `Include.has_content = True`, which
48 # modifies the default behavior of the include directive to accept content. This
49 # suppresses the warnings and allows us to embed Groonga execution commands
50 # within include blocks as needed.
51 docutils.parsers.rst.directives.misc.Include.has_content = True
52
53 # If extensions (or modules to document with autodoc) are in another directory,
54 # add these directories to sys.path here. If the directory is relative to the
55 # documentation root, use os.path.abspath to make it absolute, like shown here.
56 #sys.path.append(os.path.abspath('.'))
57
58 # -- General configuration -----------------------------------------------------
59
60 # Add any Sphinx extension module names here, as strings. They can be extensions
61 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
62 extensions = [
63 'myst_parser'
64 ]
65 # extensions.append("source.rdoc")
66 # extensions.append("source.textile")
67
68 # Add any paths that contain templates here, relative to this directory.
69 #templates_path = ['templates']
70
71 # The suffix of source filenames.
72 source_suffix = {
73 '.rst': 'restructuredtext',
74 '.md': 'markdown',
75 }
76
77 myst_enable_extensions = [
78 "amsmath",
79 "attrs_inline",
80 # "colon_fence",
81 "deflist",
82 "dollarmath",
83 "fieldlist",
84 "html_admonition",
85 "html_image",
86 "linkify",
87 # "replacements",
88 # "smartquotes",
89 "strikethrough",
90 "substitution",
91 "tasklist",
92 ]
93
94 # The encoding of source files.
95 #source_encoding = 'utf-8'
96
97 # The master toctree document.
98 master_doc = 'index'
99
100 # General information about the project.
101 project = 'Groonga'
102 copyright = '2009-' + str(datetime.today().year) + ' Groonga Project'
103
104 # The version info for the project you're documenting, acts as replacement for
105 # |version| and |release|, also used in various other places throughout the
106 # built documents.
107 #
108
109 # The short X.Y version.
110 version = os.environ["DOCUMENT_VERSION"]
111 # The full version, including alpha/beta/rc tags.
112 release = os.environ["DOCUMENT_VERSION_FULL"]
113
114 # The directories that has *.mo files.
115 locale_dirs = ["../locale"]
116
117 gettext_compact = False
118
119 # The language for content autogenerated by Sphinx. Refer to documentation
120 # for a list of supported languages.
121 language = os.environ['LOCALE']
122
123 locale_dir = os.path.dirname(__file__) + "/../locale"
124 try:
125 catalog = gettext.Catalog("conf", localedir=locale_dir, languages=[language])
126 _ = catalog.gettext
127 except:
128 _ = lambda msgid: msgid
129
130 # There are two options for replacing |today|: either, you set today to some
131 # non-false value, then it is used:
132 #today = ''
133 # Else, today_fmt is used as the format for a strftime call.
134 #today_fmt = '%B %d, %Y'
135
136 # List of patterns, relative to source directory, that match files and
137 # directories to ignore when looking for source files.
138 exclude_patterns = [
139 '**/.#*',
140 'example/**/*.md',
141 'install/server-use.md',
142 'install/server-use.rst',
143 'reference/commands/compress_filter.rst',
144 'reference/scoring_note.rst',
145 ]
146
147 # The reST default role (used for this markup: `text`) to use for all documents.
148 #default_role = None
149
150 # If true, '()' will be appended to :func: etc. cross-reference text.
151 #add_function_parentheses = True
152
153 # If true, the current module name will be prepended to all description
154 # unit titles (such as .. function::).
155 #add_module_names = True
156
157 # If true, sectionauthor and moduleauthor directives will be shown in the
158 # output. They are ignored by default.
159 #show_authors = False
160
161 # The name of the Pygments (syntax highlighting) style to use.
162 #pygments_style = 'sphinx'
163
164 # A list of ignored prefixes for module index sorting.
165 #modindex_common_prefix = []
166
167 # The myst-parser assigns header anchors for h1-h2.
168 myst_heading_anchors = 2
169
170 # -- Options for HTML output ---------------------------------------------------
171
172 # The theme to use for HTML and HTML Help pages. Major themes that come with
173 # Sphinx are currently 'default' and 'sphinxdoc'.
174 html_theme = "pydata_sphinx_theme"
175
176 # Theme options are theme-specific and customize the look and feel of a theme
177 # further. For a list of options available for each theme, see the
178 # documentation.
179 if language == "en":
180 language_prefix = "/"
181 switcher_version = "english"
182 use_edit_page_button = True
183 else:
184 language_prefix = f"/{language}/"
185 switcher_version = "japanese"
186 use_edit_page_button = False
187
188 html_theme_options = {
189 "logo": {
190 "link": f"https://groonga.org{language_prefix}",
191 },
192 "github_url": "https://github.com/groonga/groonga",
193 "twitter_url": "https://twitter.com/groonga",
194 "icon_links": [
195 {
196 "name": "Blog",
197 "url": f"{language_prefix}blog",
198 "icon": "fas fa-blog",
199 },
200 ],
201 "switcher": {
202 # "json_url": "/_static/switcher.json",
203 "json_url": "https://groonga.org/docs/_static/switcher.json",
204 "version_match": switcher_version,
205 },
206 "navbar_center": [
207 ],
208 "navbar_end": [
209 "theme-switcher.html",
210 "navbar-icon-links.html",
211 "version-switcher.html",
212 ],
213 "use_edit_page_button": use_edit_page_button,
214 "analytics": {
215 "google_analytics_id": "G-MDK38RHNPW"
216 },
217 "show_nav_level": 2,
218 }
219
220 html_context = {
221 "language": language,
222 "github_user": "groonga",
223 "github_repo": "groonga",
224 "github_version": "main",
225 "doc_path": "doc/source",
226 }
227
228 html_copy_source = False
229
230 # Add any paths that contain custom themes here, relative to this directory.
231 #html_theme_path = []
232
233 # The name for this set of Sphinx documents. If None, it defaults to
234 # "<project> v<release> documentation".
235 html_title_format = _("%(project)s v%(release)s documentation")
236 html_title = html_title_format % {"project": project,
237 "release": release}
238
239 # A shorter title for the navigation bar. Default is the same as html_title.
240 #html_short_title = None
241
242 # The name of an image file (relative to this directory) to place at the top
243 # of the sidebar.
244 html_logo = "_static/groonga.png"
245
246 # The name of an image file (within the static path) to use as favicon of the
247 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
248 # pixels large.
249 html_favicon = "_static/favicon.ico"
250
251 # Add any paths that contain custom static files (such as style sheets) here,
252 # relative to this directory. They are copied after the builtin static files,
253 # so a file named "default.css" will overwrite the builtin "default.css".
254 html_static_path = ['_static']
255
256 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
257 # using the given strftime format.
258 #html_last_updated_fmt = '%b %d, %Y'
259
260 # If true, SmartyPants will be used to convert quotes and dashes to
261 # typographically correct entities.
262 html_use_smartypants = False
263
264 # Custom sidebar templates, maps document names to template names.
265 #html_sidebars = {}
266
267 # Additional templates that should be rendered to pages, maps page names to
268 # template names.
269 #html_additional_pages = {}
270
271 # If false, no module index is generated.
272 #html_use_modindex = True
273
274 # If false, no index is generated.
275 #html_use_index = True
276
277 # If true, the index is split into individual pages for each letter.
278 #html_split_index = False
279
280 # If true, links to the reST sources are added to the pages.
281 #html_show_sourcelink = True
282
283 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
284 html_show_sphinx = False
285
286 # If true, an OpenSearch description file will be output, and all pages will
287 # contain a <link> tag referring to it. The value of this option must be the
288 # base URL from which the finished HTML is served.
289 #html_use_opensearch = ''
290
291 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
292 #html_file_suffix = ''