1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# MiniZinc documentation build configuration file, created by
5# sphinx-quickstart on Sat Nov 26 18:22:59 2016.
6#
7# This file is execfile()d with the current directory set to its
8# containing dir.
9#
10# Note that not all possible configuration values are present in this
11# autogenerated file.
12#
13# All configuration values have a default; values that are commented out
14# serve to show the default.
15
16# If extensions (or modules to document with autodoc) are in another directory,
17# add these directories to sys.path here. If the directory is relative to the
18# documentation root, use os.path.abspath to make it absolute, like shown here.
19#
20import os
21import sys
22sys.path.insert(0, os.path.abspath('../utils'))
23
24# -- General configuration ------------------------------------------------
25
26# If your documentation needs a minimal Sphinx version, state it here.
27#
28# needs_sphinx = '1.0'
29
30import defblock
31import inlinesyntaxhighlight
32
33# Add any Sphinx extension module names here, as strings. They can be
34# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35# ones.
36extensions = [
37    'sphinx.ext.todo',
38    'sphinx.ext.mathjax',
39    'defblock',
40    'inlinesyntaxhighlight',
41    'sphinxtogithub'
42]
43
44inline_highlight_respect_highlight = False
45
46inline_highlight_literals = False
47
48# Add any paths that contain templates here, relative to this directory.
49templates_path = ['_templates']
50
51# The suffix(es) of source filenames.
52# You can specify multiple suffix as a list of string:
53#
54# source_suffix = ['.rst', '.md']
55source_suffix = '.rst'
56
57# The encoding of source files.
58#
59# source_encoding = 'utf-8-sig'
60
61# The master toctree document.
62master_doc = 'index'
63
64# General information about the project.
65project = 'The MiniZinc Handbook'
66copyright = '2016, 2017, 2018, 2019, 2020 Peter J. Stuckey, Kim Marriott, Guido Tack'
67author = 'Peter J. Stuckey, Kim Marriott, Guido Tack'
68
69# The version info for the project you're documenting, acts as replacement for
70# |version| and |release|, also used in various other places throughout the
71# built documents.
72#
73# The short X.Y version.
74version = '2.5'
75# The full version, including alpha/beta/rc tags.
76release = '2.5.5'
77
78# The language for content autogenerated by Sphinx. Refer to documentation
79# for a list of supported languages.
80#
81# This is also used if you do content translation via gettext catalogs.
82# Usually you set "language" from the command line for these cases.
83language = None
84
85# There are two options for replacing |today|: either, you set today to some
86# non-false value, then it is used:
87#
88# today = ''
89#
90# Else, today_fmt is used as the format for a strftime call.
91#
92# today_fmt = '%B %d, %Y'
93
94# List of patterns, relative to source directory, that match files and
95# directories to ignore when looking for source files.
96# This patterns also effect to html_static_path and html_extra_path
97exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'api_interfacing.rst']
98
99# The reST default role (used for this markup: `text`) to use for all
100# documents.
101#
102# default_role = None
103
104# If true, '()' will be appended to :func: etc. cross-reference text.
105#
106# add_function_parentheses = True
107
108# If true, the current module name will be prepended to all description
109# unit titles (such as .. function::).
110#
111# add_module_names = True
112
113# If true, sectionauthor and moduleauthor directives will be shown in the
114# output. They are ignored by default.
115#
116# show_authors = False
117
118# The name of the Pygments (syntax highlighting) style to use.
119pygments_style = 'manni'
120
121# A list of ignored prefixes for module index sorting.
122# modindex_common_prefix = []
123
124# If true, keep warnings as "system message" paragraphs in the built documents.
125# keep_warnings = False
126
127# If true, `todo` and `todoList` produce output, else they produce nothing.
128todo_include_todos = True
129
130
131# -- Options for HTML output ----------------------------------------------
132
133import sphinx_rtd_theme
134
135# The theme to use for HTML and HTML Help pages.  See the documentation for
136# a list of builtin themes.
137#
138# html_theme = 'alabaster'
139
140html_theme = 'sphinx_rtd_theme'
141html_theme_path = ["_themes", ]
142# html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
143
144# Theme options are theme-specific and customize the look and feel of a theme
145# further.  For a list of options available for each theme, see the
146# documentation.
147#
148html_theme_options = {
149  'logo_only' : False,
150  'canonical_url' : 'http://www.minizinc.org/doc-latest/en/'
151}
152
153# Add any paths that contain custom themes here, relative to this directory.
154# html_theme_path = []
155
156# The name for this set of Sphinx documents.
157# "<project> v<release> documentation" by default.
158#
159html_title = project+" "+release
160
161# A shorter title for the navigation bar.  Default is the same as html_title.
162#
163# html_short_title = None
164
165# The name of an image file (relative to this directory) to place at the top
166# of the sidebar.
167#
168html_logo = 'figures/MiniZn_logo_2.svg'
169
170# The name of an image file (relative to this directory) to use as a favicon of
171# the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
172# pixels large.
173#
174# html_favicon = None
175
176# Add any paths that contain custom static files (such as style sheets) here,
177# relative to this directory. They are copied after the builtin static files,
178# so a file named "default.css" will overwrite the builtin "default.css".
179html_static_path = ['_static']
180
181html_js_files = ['js/doc-links.js']
182
183# Add any extra paths that contain custom files (such as robots.txt or
184# .htaccess) here, relative to this directory. These files are copied
185# directly to the root of the documentation.
186#
187# html_extra_path = []
188
189# If not None, a 'Last updated on:' timestamp is inserted at every page
190# bottom, using the given strftime format.
191# The empty string is equivalent to '%b %d, %Y'.
192#
193# html_last_updated_fmt = None
194
195# If true, SmartyPants will be used to convert quotes and dashes to
196# typographically correct entities.
197#
198# html_use_smartypants = True
199
200# Custom sidebar templates, maps document names to template names.
201#
202# html_sidebars = {}
203
204# Additional templates that should be rendered to pages, maps page names to
205# template names.
206#
207# html_additional_pages = {}
208
209# If false, no module index is generated.
210#
211# html_domain_indices = True
212
213# If false, no index is generated.
214#
215# html_use_index = True
216
217# If true, the index is split into individual pages for each letter.
218#
219html_split_index = False
220
221# If true, links to the reST sources are added to the pages.
222#
223html_show_sourcelink = False
224html_copy_source = False
225
226# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
227#
228html_show_sphinx = False
229
230# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
231#
232# html_show_copyright = True
233
234# If true, an OpenSearch description file will be output, and all pages will
235# contain a <link> tag referring to it.  The value of this option must be the
236# base URL from which the finished HTML is served.
237#
238# html_use_opensearch = ''
239
240# This is the file name suffix for HTML files (e.g. ".xhtml").
241# html_file_suffix = None
242
243# Language to be used for generating the HTML full-text search index.
244# Sphinx supports the following languages:
245#   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
246#   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
247#
248# html_search_language = 'en'
249
250# A dictionary with options for the search language support, empty by default.
251# 'ja' uses this config value.
252# 'zh' user can custom change `jieba` dictionary path.
253#
254# html_search_options = {'type': 'default'}
255
256# The name of a javascript file (relative to the configuration directory) that
257# implements a search results scorer. If empty, the default will be used.
258#
259# html_search_scorer = 'scorer.js'
260
261# Output file base name for HTML help builder.
262htmlhelp_basename = 'MiniZincdoc'
263
264# -- Options for LaTeX output ---------------------------------------------
265
266latex_engine = 'xelatex'
267
268latex_elements = {
269     # The paper size ('letterpaper' or 'a4paper').
270     #
271     'papersize': 'a4paper',
272'fontpkg': r'''
273\usepackage{fontspec}
274\setmainfont{Charter}
275\setsansfont{Lato}
276\setmonofont{Inconsolata}
277\usepackage{ctex}
278''',
279     # The font size ('10pt', '11pt' or '12pt').
280     #
281     'pointsize': '11pt',
282
283     # Additional stuff for the LaTeX preamble.
284     #
285     # 'preamble': '',
286     'preamble': r'\usepackage{../../../utils/mznstyle}',
287     # Latex figure (float) alignment
288     #
289     # 'figure_align': 'htbp',
290     'fncychap': r'\usepackage[Sonny]{fncychap}',
291}
292
293# Grouping the document tree into LaTeX files. List of tuples
294# (source start file, target name, title,
295#  author, documentclass [howto, manual, or own class]).
296latex_documents = [
297    (master_doc, 'MiniZinc.tex', 'MiniZinc Handbook',
298     'Peter J. Stuckey, Kim Marriott, Guido Tack', 'manual'),
299]
300
301# The name of an image file (relative to this directory) to place at the top of
302# the title page.
303#
304latex_logo = 'figures/MiniZn_logo_2_small.pdf'
305
306# For "manual" documents, if this is true, then toplevel headings are parts,
307# not chapters.
308#
309latex_toplevel_sectioning = "part"
310
311# If true, show page references after internal links.
312#
313latex_show_pagerefs = True
314
315# If true, show URL addresses after external links.
316#
317latex_show_urls = "footnote"
318
319# Documents to append as an appendix to all manuals.
320#
321# latex_appendices = []
322
323# It false, will not define \strong, \code, 	itleref, \crossref ... but only
324# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
325# packages.
326#
327# latex_keep_old_macro_names = True
328
329# If false, no module index is generated.
330#
331# latex_domain_indices = True
332
333
334# -- Options for manual page output ---------------------------------------
335
336# One entry per manual page. List of tuples
337# (source start file, name, description, authors, manual section).
338man_pages = [
339    (master_doc, 'minizinc', 'MiniZinc Documentation',
340     [author], 1)
341]
342
343# If true, show URL addresses after external links.
344#
345# man_show_urls = False
346
347
348# -- Options for Texinfo output -------------------------------------------
349
350# Grouping the document tree into Texinfo files. List of tuples
351# (source start file, target name, title, author,
352#  dir menu entry, description, category)
353texinfo_documents = [
354    (master_doc, 'MiniZinc', 'MiniZinc Documentation',
355     author, 'MiniZinc', 'One line description of project.',
356     'Miscellaneous'),
357]
358
359# Documents to append as an appendix to all manuals.
360#
361# texinfo_appendices = []
362
363# If false, no module index is generated.
364#
365# texinfo_domain_indices = True
366
367# How to display URL addresses: 'footnote', 'no', or 'inline'.
368#
369# texinfo_show_urls = 'footnote'
370
371# If true, do not generate a @detailmenu in the "Top" node's menu.
372#
373# texinfo_no_detailmenu = False
374
375
376# -- Options for Epub output ----------------------------------------------
377
378# Bibliographic Dublin Core info.
379epub_title = project
380epub_author = author
381epub_publisher = author
382epub_copyright = copyright
383
384# The basename for the epub file. It defaults to the project name.
385# epub_basename = project
386
387# The HTML theme for the epub output. Since the default themes are not
388# optimized for small screen space, using the same theme for HTML and epub
389# output is usually not wise. This defaults to 'epub', a theme designed to save
390# visual space.
391#
392# epub_theme = 'epub'
393
394# The language of the text. It defaults to the language option
395# or 'en' if the language is not set.
396#
397# epub_language = ''
398
399# The scheme of the identifier. Typical schemes are ISBN or URL.
400# epub_scheme = ''
401
402# The unique identifier of the text. This can be a ISBN number
403# or the project homepage.
404#
405# epub_identifier = ''
406
407# A unique identification for the text.
408#
409# epub_uid = ''
410
411# A tuple containing the cover image and cover page html template filenames.
412#
413# epub_cover = ()
414
415# A sequence of (type, uri, title) tuples for the guide element of content.opf.
416#
417# epub_guide = ()
418
419# HTML files that should be inserted before the pages created by sphinx.
420# The format is a list of tuples containing the path and title.
421#
422# epub_pre_files = []
423
424# HTML files that should be inserted after the pages created by sphinx.
425# The format is a list of tuples containing the path and title.
426#
427# epub_post_files = []
428
429# A list of files that should not be packed into the epub file.
430epub_exclude_files = ['search.html']
431
432# The depth of the table of contents in toc.ncx.
433#
434# epub_tocdepth = 3
435
436# Allow duplicate toc entries.
437#
438# epub_tocdup = True
439
440# Choose between 'default' and 'includehidden'.
441#
442# epub_tocscope = 'default'
443
444# Fix unsupported image types using the Pillow.
445#
446# epub_fix_images = False
447
448# Scale large images.
449#
450# epub_max_image_width = 0
451
452# How to display URL addresses: 'footnote', 'no', or 'inline'.
453#
454# epub_show_urls = 'inline'
455
456# If false, no index is generated.
457#
458# epub_use_index = True
459
460numfig = True
461numfig_secnum_depth = 2
462
463rst_prolog = """
464.. role:: mzn(code)
465  :language: minizinc
466
467.. role:: mzndef(code)
468  :language: minizincdef
469"""
470
471sphinx_to_github = True
472sphinx_to_github_verbose = True
473sphinx_to_github_encoding = "utf-8"
474
475def setup(sphinx):
476    from minizinc_lexer import MznLexer, MznDefLexer
477    sphinx.add_lexer("minizinc", MznLexer())
478    sphinx.add_lexer("minizincdef", MznDefLexer())
479    sphinx.add_stylesheet("style.css")
480