conf.py 12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'Krita Manual'
propername = 'Krita Manual'
description = 'The official Krita Documentation'
Wolthera van Hövell's avatar
Wolthera van Hövell committed
25
copyright = 'licensed under the GNU Free Documentation License 1.3+ unless stated otherwise'
26 27
author = 'Krita Foundation'

Wolthera van Hövell's avatar
Wolthera van Hövell committed
28
import os
29 30 31 32 33 34 35 36 37 38 39 40 41 42
import subprocess

# Get the git description if possible, to put it in the footer.

try:
    gitcommitfriendly = subprocess.check_output(["git", "describe", "--always"]).decode("utf-8").strip()
except subprocess.CalledProcessError as exc:
    gitcommitfriendly = None

# We use the full githash for the epub identifier, if not, use the release number.
try:
    gitcommithash = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode("utf-8").strip()
except subprocess.CalledProcessError as exc:
    gitcommithash = release
Wolthera van Hövell's avatar
Wolthera van Hövell committed
43

44
# The short X.Y version
45
version = '4.2'
46
# The full version, including alpha/beta/rc tags
47
release = '4.2.0'
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


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.coverage',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
92
html_extra_path = ['.htaccess', '404.php'] # copy over .htaccess file to each langaguge
93 94 95 96

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

97 98 99 100 101 102 103 104 105 106 107 108 109
# languages to exclude from smartquotes transformation. Requested by catalan translators due l':ref:`<crop_tool>` getting rendered as l"crop tool.
smartquotes_excludes = {'languages':[
                                    'ja',
                                    'ca',
                                    'fr'
                                    ],
                        'builders': [
                                    'man',
                                    'text'
                                    ]
                        }


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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
# A string of reStructuredText that will be included at the end of every source file that is read.
# This is a possible place to add substitutions that should be available in every file (another being rst_prolog).
rst_epilog = """
.. |mouseleft| image:: /images/icons/Krita_mouse_left.png 

.. |mouseright| image:: /images/icons/Krita_mouse_right.png 

.. |mousemiddle| image:: /images/icons/Krita_mouse_middle.png 

.. |mousescroll| image:: /images/icons/Krita_mouse_scroll.png

.. |toolshapeselection| image:: /images/icons/shape_select_tool.svg

.. |toolshapeedit| image:: /images/icons/shape_edit_tool.svg

.. |tooltext| image:: /images/icons/text-tool.svg

.. |toolcalligraphy| image:: /images/icons/calligraphy_tool.svg

.. |toolgradientedit| image:: /images/icons/gradient_edit_tool.svg

.. |toolpatternedit| image:: /images/icons/pattern_tool.svg

.. |toolfreehandbrush| image:: /images/icons/freehand_brush_tool.svg

.. |toolline| image:: /images/icons/line_tool.svg

.. |toolrectangle| image:: /images/icons/rectangle_tool.svg

.. |toolellipse| image:: /images/icons/ellipse_tool.svg

.. |toolpolygon| image:: /images/icons/polygon_tool.svg

.. |toolpolyline| image:: /images/icons/polyline_tool.svg

.. |toolbeziercurve| image:: /images/icons/bezier_curve.svg

.. |toolfreehandpath| image:: /images/icons/freehand_path_tool.svg

.. |tooldyna| image:: /images/icons/dyna_tool.svg

.. |toolmultibrush| image:: /images/icons/multibrush_tool.svg

.. |toolassistant| image:: /images/icons/assistant_tool.svg

.. |toolmove| image:: /images/icons/move_tool.svg

.. |tooltransform| image:: /images/icons/transform_tool.svg

.. |toolgrid| image:: /images/icons/grid_tool.svg

.. |toolperspectivegrid| image:: /images/icons/perspectivegrid_tool.svg

.. |toolmeasure| image:: /images/icons/measure_tool.svg

.. |toolcolorpicker| image:: /images/icons/color_picker_tool.svg

.. |toolfill| image:: /images/icons/fill_tool.svg

.. |toolgradient| image:: /images/icons/gradient_drawing_tool.svg

.. |toolcolorizemask| image:: /images/icons/colorizemask_tool.svg

.. |toolsmartpatch| image:: /images/icons/smart_patch_tool.svg

.. |toolcrop| image:: /images/icons/crop_tool.svg

.. |toolselectrect| image:: /images/icons/rectangular_select_tool.svg

.. |toolselectellipse| image:: /images/icons/elliptical_select_tool.svg

.. |toolselectpolygon| image:: /images/icons/polygonal_select_tool.svg

183 184
.. |toolselectmagnetic| image:: /images/icons/magnetic_select_tool.svg

185 186 187 188 189 190 191 192 193 194 195 196
.. |toolselectpath| image:: /images/icons/path_select_tool.svg

.. |toolselectoutline| image:: /images/icons/outline_select_tool.svg

.. |toolselectcontiguous| image:: /images/icons/contiguous_select_tool.svg

.. |toolselectsimilar| image:: /images/icons/similar_select_tool.svg

.. |toolpan| image:: /images/icons/pan_tool.svg

.. |toolzoom| image:: /images/icons/zoom_tool.svg

197 198
.. |toolreference| image:: /images/icons/reference_images_tool.svg

199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
"""

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'theme'
html_theme_path = ['.'] # make sphinx search for themes in current dir

# the favicon has a property to set it in the documentation, but we don't need to use this
# sphinx appears to automatically search in the theme folder and find the file
#html_favicon = './theme/static/images/favicon.ico'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
	'sticky_navigation': True,
	'collapse_navigation': True,
	'prev_next_buttons_location': 'bottom'
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['theme/static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself.  Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

html_title = project + " version " + release

Wolthera van Hövell's avatar
Wolthera van Hövell committed
240
html_context = {
241 242 243
    'build_id': os.getenv('BUILD_NUMBER', None),
    'build_url': os.getenv('BUILD_URL', None),
    'commit' : gitcommitfriendly
Wolthera van Hövell's avatar
Wolthera van Hövell committed
244 245
}

246 247 248 249 250 251 252 253 254

# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'documentationProjectNamedoc'


# -- Options for LaTeX output ------------------------------------------------

255
latex_engine = 'xelatex'
256 257 258 259
latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #
    # 'papersize': 'letterpaper',
260 261
    'maxlistdepth': '8',
    'figure_align':'ht!',
262 263 264 265 266 267 268

    # The font size ('10pt', '11pt' or '12pt').
    #
    # 'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #
269 270 271 272 273 274 275 276
    'preamble': r'''
\usepackage[export]{adjustbox}
\let\oincludegraphics\includegraphics
\renewcommand{\includegraphics}[2][]{
    \oincludegraphics[#1,max width=\linewidth,max height=\textheight]{#2}
}
    ''',
    'tableofcontents':'\sphinxtableofcontents',
277 278 279 280 281 282 283 284 285 286 287 288 289

    # Latex figure (float) alignment
    #
    # 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
    (master_doc, 'kritaManual.tex', project,
     author, 'manual'),
]
290 291 292 293 294
latex_show_pagerefs=True
# copy latex scripts to build dir
latex_additional_files = [
    "latexImageMakefile",
]
295 296 297 298 299

# -- Internationalization Options --------------------------------------------

locale_dirs = ['locale/']   # Where the PO files will be stored at
gettext_compact = False     # optional.
300
gettext_additional_targets = ['image', 'index', 'literal-block'] # allows images to be translatable
301
figure_language_filename = "{path}{language}/{basename}{ext}"
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329



# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, project, propername,
     [author], 1)
]


# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
    (master_doc, project, propername,
     author, project, description,
     'Manual'),
]


# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
330 331
# filename
# epub_basename = project.replace(' ', '_') + '_' + language
Wolthera van Hövell's avatar
Wolthera van Hövell committed
332
epub_title = project+" "+version
333 334 335 336
epub_description = description

# Technically speaking dublincore accepts multiple author and contributor elements, but
# the sphinx builder only accepts one.
337 338 339
epub_author = author
epub_publisher = author
epub_copyright = copyright
340

Wolthera van Hövell's avatar
Wolthera van Hövell committed
341 342

epub_cover = ('_static/images/manual_cover.png', '')
343 344 345

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
346 347 348 349 350 351
# The above is false and perhaps a mistake in sphinx' documentation.
# epub_uid maps to id, which is the dc identifier id
# which in turn should be the used scheme.

if os.getenv('BUILD_ID', None) is None:
    # There is no uniform resource name for git, but just randomly pasting a githash is bad form.
Wolthera van Hövell's avatar
Wolthera van Hövell committed
352
    epub_identifier = 'git:'+gitcommithash
353 354 355 356 357 358 359 360 361 362
    epub_uid = 'githash'
    if gitcommithash == release:
        epub_uid = 'release'
        # there's also no urn for releases, as technically some database thing should be used for that.
        epub_identifier = '_'.join(['Krita_Manual_Build', language, release])
else:
    epub_uid = 'url'
    epub_identifier = os.getenv('BUILD_URL', '')

# Not actually used anywhere? Docs say that this should be what the epub uid is used for but...
Wolthera van Hövell's avatar
Wolthera van Hövell committed
363
epub_scheme = 'URL'
364 365

# A list of files that should not be packed into the epub file.
366
epub_exclude_files = ['search.html', '.htaccess', '404.xhtml']
367

Wolthera van Hövell's avatar
Wolthera van Hövell committed
368
epub_tocscope = 'includehidden'
369 370 371 372 373 374 375

# -- Extension configuration -------------------------------------------------

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}