1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# khard documentation build configuration file, created by
5# sphinx-quickstart on Sun Jan 14 10:35:27 2018.
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 pathlib
22import sys
23sys.path.insert(0, os.path.abspath('../..'))
24from khard.version import version as original_version
25
26
27# update the template file for the docs if necessary
28def update_template_file():
29    here = pathlib.Path(__file__).parent
30    src = here.parent.parent/'khard'/'data'/'template.yaml'
31    dest = here/'examples'/'template.yaml'
32    if not dest.exists() or src.stat().st_ctime > dest.stat().st_ctime:
33        dest.write_text(src.read_text().format(
34            "\n    Jabber  : \n    Skype   : \n    Twitter : "))
35
36
37update_template_file()
38del update_template_file
39
40
41# -- General configuration ------------------------------------------------
42
43# If your documentation needs a minimal Sphinx version, state it here.
44#
45# needs_sphinx = '1.0'
46
47# Add any Sphinx extension module names here, as strings. They can be
48# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
49# ones.
50extensions = [
51    'autoapi.extension',
52    'sphinx.ext.autodoc',
53    'sphinx.ext.autosectionlabel',
54    'sphinx.ext.todo',
55    'sphinx_autodoc_typehints',
56]
57
58autoapi_type = 'python'
59autoapi_dirs = ['../../khard']
60
61# Add any paths that contain templates here, relative to this directory.
62templates_path = ['_templates']
63
64# The suffix(es) of source filenames.
65# You can specify multiple suffix as a list of string:
66#
67# source_suffix = ['.rst', '.md']
68source_suffix = '.rst'
69
70# The master toctree document.
71master_doc = 'index'
72
73# General information about the project.
74project = 'khard'
75copyright = '2020, Eric Scheibler'
76author = 'Eric Scheibler'
77
78# The version info for the project you're documenting, acts as replacement for
79# |version| and |release|, also used in various other places throughout the
80# built documents.
81#
82# The short X.Y version.
83version = '.'.join(original_version.split('.')[0:2])
84# The full version, including alpha/beta/rc tags.
85release = original_version
86
87# The language for content autogenerated by Sphinx. Refer to documentation
88# for a list of supported languages.
89#
90# This is also used if you do content translation via gettext catalogs.
91# Usually you set "language" from the command line for these cases.
92language = None
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 = []
98
99# The name of the Pygments (syntax highlighting) style to use.
100pygments_style = 'sphinx'
101
102# If true, `todo` and `todoList` produce output, else they produce nothing.
103todo_include_todos = True
104
105
106# -- Options for HTML output ----------------------------------------------
107
108# The theme to use for HTML and HTML Help pages.  See the documentation for
109# a list of builtin themes.
110#
111html_theme = 'alabaster'
112
113# Custom sidebar templates, must be a dictionary that maps document names
114# to template names.
115#
116# This is required for the alabaster theme
117# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
118html_sidebars = {
119    '**': [
120        'relations.html',  # needs 'show_related': True theme option to display
121        'searchbox.html',
122    ]
123}
124
125
126# -- Options for HTMLHelp output ------------------------------------------
127
128# Output file base name for HTML help builder.
129htmlhelp_basename = 'kharddoc'
130
131
132# -- Options for manual page output ---------------------------------------
133
134# One entry per manual page. List of tuples
135# (source start file, name, description, authors, manual section).
136man_pages = [
137    ('man/khard', 'khard', 'Console carddav client', '', 1),
138    ('man/khard.conf', 'khard.conf', 'configuration file for khard', '', 5),
139]
140
141
142# -- Options for Texinfo output -------------------------------------------
143
144# Grouping the document tree into Texinfo files. List of tuples
145# (source start file, target name, title, author,
146#  dir menu entry, description, category)
147texinfo_documents = [
148    (master_doc, 'khard', 'khard Documentation',
149     author, 'khard', 'One line description of project.',
150     'Miscellaneous'),
151]
152