1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# LVGL documentation build configuration file, created by
5# sphinx-quickstart on Wed Jun 12 16:38:40 2019.
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
22import subprocess
23sys.path.insert(0, os.path.abspath('./_ext'))
24
25import recommonmark
26from recommonmark.transform import AutoStructify
27from sphinx.builders.html import StandaloneHTMLBuilder
28from subprocess import Popen, PIPE
29
30# -- General configuration ------------------------------------------------
31
32# If your documentation needs a minimal Sphinx version, state it here.
33#
34# needs_sphinx = '1.0'
35
36# Add any Sphinx extension module names here, as strings. They can be
37# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
38# ones.
39extensions = ['sphinx.ext.autodoc',
40    'sphinx.ext.intersphinx',
41    'sphinx.ext.todo',
42    'recommonmark',
43    'sphinx_markdown_tables',
44    'breathe',
45    'sphinx_sitemap',
46    'lv_example'
47    ]
48
49# Add any paths that contain templates here, relative to this directory.
50templates_path = ['_templates']
51
52# The default language to highlight source code in. The default is 'python'.
53# The value should be a valid Pygments lexer name, see Showing code examples for more details.
54
55
56highlight_language = 'c'
57
58# The suffix(es) of source filenames.
59# You can specify multiple suffix as a list of string:
60#
61source_suffix = ['.rst', '.md']
62
63
64# The master toctree document.
65master_doc = 'index'
66
67# General information about the project.
68project = 'LVGL'
69copyright = '2021, LVGL Kft'
70author = 'LVGL community'
71
72# The version info for the project you're documenting, acts as replacement for
73# |version| and |release|, also used in various other places throughout the
74# built documents.
75#
76# The short X.Y version.
77# embeddedt: extract using scripts/find_version.sh
78
79version = subprocess.run(["../scripts/find_version.sh"], capture_output=True).stdout.decode("utf-8").strip()
80
81# The language for content autogenerated by Sphinx. Refer to documentation
82# for a list of supported languages.
83#
84# This is also used if you do content translation via gettext catalogs.
85# Usually you set "language" from the command line for these cases.
86language = None
87
88# List of patterns, relative to source directory, that match files and
89# directories to ignore when looking for source files.
90# This patterns also effect to html_static_path and html_extra_path
91exclude_patterns = ['_build', 'doxygen_html', 'Thumbs.db', '.DS_Store',
92                    'README.md', 'lv_examples', 'out_html' ]
93
94# The name of the Pygments (syntax highlighting) style to use.
95pygments_style = 'sphinx'
96
97# If true, `todo` and `todoList` produce output, else they produce nothing.
98todo_include_todos = True
99
100
101# -- Options for HTML output ----------------------------------------------
102
103# The theme to use for HTML and HTML Help pages.  See the documentation for
104# a list of builtin themes.
105#
106html_theme = 'sphinx_rtd_theme'
107
108# Theme options are theme-specific and customize the look and feel of a theme
109# further.  For a list of options available for each theme, see the
110# documentation.
111#
112html_theme_options = {
113    'collapse_navigation' : False,
114    'logo_only': True,
115}
116# For site map generation
117html_baseurl = 'https://docs.lvgl.io/' + version + "/"
118sitemap_url_scheme = "{link}"
119
120# Add any paths that contain custom static files (such as style sheets) here,
121# relative to this directory. They are copied after the builtin static files,
122# so a file named "default.css" will overwrite the builtin "default.css".
123html_static_path = ['_static']
124
125# Custom sidebar templates, must be a dictionary that maps document names
126# to template names.
127#
128# This is required for the alabaster theme
129# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
130html_sidebars = {
131    '**': [
132        'relations.html',  # needs 'show_related': True theme option to display
133        'searchbox.html',
134    ]
135}
136
137html_favicon = 'favicon.png'
138html_logo = 'logo_lvgl.png'
139
140# -- Options for HTMLHelp output ------------------------------------------
141
142# Output file base name for HTML help builder.
143htmlhelp_basename = 'LVGLdoc'
144
145html_last_updated_fmt = ''
146
147# -- Options for LaTeX output ---------------------------------------------
148
149latex_engine = 'xelatex'
150latex_use_xindy = False
151latex_elements = {
152    # The paper size ('letterpaper' or 'a4paper').
153    #
154    # 'papersize': 'letterpaper',
155
156    # The font size ('10pt', '11pt' or '12pt').
157    #
158    # 'pointsize': '10pt',
159
160    # Additional stuff for the LaTeX preamble.
161    #
162    # 'preamble': '',
163
164    # Latex figure (float) alignment
165    #
166    # 'figure_align': 'htbp',
167
168    'inputenc': '',
169    'utf8extra': '',
170    'classoptions': ',openany,oneside',
171    'babel': '\\usepackage{babel}',
172    'passoptionstopackages': r'''
173\PassOptionsToPackage{bookmarksdepth=5}{hyperref}% depth of pdf bookmarks
174''',
175    'preamble': r'''
176\usepackage{fontspec}
177\setmonofont{DejaVu Sans Mono}
178\usepackage{silence}
179\WarningsOff*
180''',
181}
182
183# Grouping the document tree into LaTeX files. List of tuples
184# (source start file, target name, title,
185#  author, documentclass [howto, manual, or own class]).
186latex_documents = [
187    (master_doc, 'LVGL.tex', 'LVGL Documentation ' + version,
188     'LVGL community', 'manual'),
189]
190
191
192# -- Options for manual page output ---------------------------------------
193
194# One entry per manual page. List of tuples
195# (source start file, name, description, authors, manual section).
196man_pages = [
197    (master_doc, 'lvgl', 'LVGL Documentation ' + version,
198     [author], 1)
199]
200
201
202# -- Options for Texinfo output -------------------------------------------
203
204# Grouping the document tree into Texinfo files. List of tuples
205# (source start file, target name, title, author,
206#  dir menu entry, description, category)
207texinfo_documents = [
208    (master_doc, 'LVGL', 'LVGL Documentation ' + version,
209     author, 'Contributors of LVGL', 'One line description of project.',
210     'Miscellaneous'),
211]
212
213
214breathe_projects = {
215  "lvgl":"xml/",
216}
217
218StandaloneHTMLBuilder.supported_image_types = [
219    'image/svg+xml',
220    'image/gif',  #prefer gif over png
221    'image/png',
222    'image/jpeg'
223]
224
225smartquotes = False
226
227_, repo_commit_hash = subprocess.getstatusoutput("git rev-parse HEAD")
228
229
230# Example configuration for intersphinx: refer to the Python standard library.
231
232def setup(app):
233    app.add_config_value('recommonmark_config', {
234            'enable_eval_rst': True,
235            'enable_auto_toc_tree': 'True',
236            }, True)
237    app.add_transform(AutoStructify)
238    app.add_css_file('css/custom.css')
239    app.add_css_file('css/fontawesome.min.css')
240