conf.py 7.3 KB

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