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