conf.py 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Recommonmark documentation build configuration file, created by
  4. # sphinx-quickstart on Tue Jul 28 11:17:27 2015.
  5. #
  6. # This file is execfile()d with the current directory set to its
  7. # containing dir.
  8. #
  9. # Note that not all possible configuration values are present in this
  10. # autogenerated file.
  11. #
  12. # All configuration values have a default; values that are commented out
  13. # serve to show the default.
  14. import sys
  15. import os
  16. import shlex
  17. # If extensions (or modules to document with autodoc) are in another directory,
  18. # add these directories to sys.path here. If the directory is relative to the
  19. # documentation root, use os.path.abspath to make it absolute, like shown here.
  20. sys.path.insert(0, os.path.abspath('..'))
  21. import recommonmark
  22. from recommonmark.parser import CommonMarkParser
  23. from recommonmark.transform import AutoStructify
  24. source_parsers = {
  25. '.md': CommonMarkParser
  26. }
  27. source_suffix = ['.rst', '.md']
  28. # -- General configuration ------------------------------------------------
  29. # If your documentation needs a minimal Sphinx version, state it here.
  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 = [
  35. 'sphinx.ext.autodoc',
  36. 'sphinx.ext.napoleon',
  37. 'sphinx.ext.mathjax',
  38. ]
  39. # Add any paths that contain templates here, relative to this directory.
  40. templates_path = ['_templates']
  41. # The encoding of source files.
  42. #source_encoding = 'utf-8-sig'
  43. # The master toctree document.
  44. master_doc = 'index'
  45. # General information about the project.
  46. project = u'AdiDriver'
  47. copyright = u'2017, Tokyo Opensource Robotics Kyokai Association'
  48. author = u'Tokyo Opensource Robotics Kyokai Association'
  49. github_doc_root = 'https://github.com/tork-a/adi_driver/tree/master/doc/'
  50. # The version info for the project you're documenting, acts as replacement for
  51. # |version| and |release|, also used in various other places throughout the
  52. # built documents.
  53. #
  54. # # The short X.Y version.
  55. # version = recommonmark.__version__
  56. # # The full version, including alpha/beta/rc tagss
  57. # release = recommonmark.__version__
  58. import os,sys,time
  59. from xml.etree.ElementTree import ElementTree
  60. try:
  61. root = ElementTree(None, os.path.join('..', 'package.xml'))
  62. version = root.findtext('version')
  63. author_names = [a.text for a in root.findall('author')]
  64. copyright = u'2017-%s, %s' % (time.strftime('%Y'), ', '.join(author_names))
  65. except Exception as e:
  66. raise RuntimeError('Could not extract version and authors from package.xml:\n%s' % e)
  67. # The full version, including alpha/beta/rc tags.
  68. release = version
  69. # The language for content autogenerated by Sphinx. Refer to documentation
  70. # for a list of supported languages.
  71. #
  72. # This is also used if you do content translation via gettext catalogs.
  73. # Usually you set "language" from the command line for these cases.
  74. language = None
  75. # There are two options for replacing |today|: either, you set today to some
  76. # non-false value, then it is used:
  77. #today = ''
  78. # Else, today_fmt is used as the format for a strftime call.
  79. #today_fmt = '%B %d, %Y'
  80. # List of patterns, relative to source directory, that match files and
  81. # directories to ignore when looking for source files.
  82. exclude_patterns = ['_build']
  83. # The reST default role (used for this markup: `text`) to use for all
  84. # documents.
  85. #default_role = None
  86. # If true, '()' will be appended to :func: etc. cross-reference text.
  87. #add_function_parentheses = True
  88. # If true, the current module name will be prepended to all description
  89. # unit titles (such as .. function::).
  90. #add_module_names = True
  91. # If true, sectionauthor and moduleauthor directives will be shown in the
  92. # output. They are ignored by default.
  93. #show_authors = False
  94. # The name of the Pygments (syntax highlighting) style to use.
  95. pygments_style = 'sphinx'
  96. # A list of ignored prefixes for module index sorting.
  97. #modindex_common_prefix = []
  98. # If true, keep warnings as "system message" paragraphs in the built documents.
  99. #keep_warnings = False
  100. # If true, `todo` and `todoList` produce output, else they produce nothing.
  101. todo_include_todos = False
  102. # -- Options for HTML output ----------------------------------------------
  103. # The theme to use for HTML and HTML Help pages. See the documentation for
  104. # a list of builtin themes.
  105. html_theme = 'sphinx_rtd_theme'
  106. # Theme options are theme-specific and customize the look and feel of a theme
  107. # further. For a list of options available for each theme, see the
  108. # documentation.
  109. #html_theme_options = {}
  110. # Add any paths that contain custom themes here, relative to this directory.
  111. #html_theme_path = []
  112. # The name for this set of Sphinx documents. If None, it defaults to
  113. # "<project> v<release> documentation".
  114. #html_title = None
  115. # A shorter title for the navigation bar. Default is the same as html_title.
  116. #html_short_title = None
  117. # The name of an image file (relative to this directory) to place at the top
  118. # of the sidebar.
  119. #html_logo = None
  120. # The name of an image file (within the static path) to use as favicon of the
  121. # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
  122. # pixels large.
  123. #html_favicon = None
  124. # Add any paths that contain custom static files (such as style sheets) here,
  125. # relative to this directory. They are copied after the builtin static files,
  126. # so a file named "default.css" will overwrite the builtin "default.css".
  127. html_static_path = ['_static']
  128. # Add any extra paths that contain custom files (such as robots.txt or
  129. # .htaccess) here, relative to this directory. These files are copied
  130. # directly to the root of the documentation.
  131. #html_extra_path = []
  132. # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  133. # using the given strftime format.
  134. #html_last_updated_fmt = '%b %d, %Y'
  135. # If true, SmartyPants will be used to convert quotes and dashes to
  136. # typographically correct entities.
  137. #html_use_smartypants = True
  138. # Custom sidebar templates, maps document names to template names.
  139. #html_sidebars = {}
  140. # Additional templates that should be rendered to pages, maps page names to
  141. # template names.
  142. #html_additional_pages = {}
  143. # If false, no module index is generated.
  144. #html_domain_indices = True
  145. # If false, no index is generated.
  146. #html_use_index = True
  147. # If true, the index is split into individual pages for each letter.
  148. #html_split_index = False
  149. # If true, links to the reST sources are added to the pages.
  150. #html_show_sourcelink = True
  151. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
  152. #html_show_sphinx = True
  153. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
  154. #html_show_copyright = True
  155. # If true, an OpenSearch description file will be output, and all pages will
  156. # contain a <link> tag referring to it. The value of this option must be the
  157. # base URL from which the finished HTML is served.
  158. #html_use_opensearch = ''
  159. # This is the file name suffix for HTML files (e.g. ".xhtml").
  160. #html_file_suffix = None
  161. # Language to be used for generating the HTML full-text search index.
  162. # Sphinx supports the following languages:
  163. # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
  164. # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
  165. #html_search_language = 'en'
  166. # A dictionary with options for the search language support, empty by default.
  167. # Now only 'ja' uses this config value
  168. #html_search_options = {'type': 'default'}
  169. # The name of a javascript file (relative to the configuration directory) that
  170. # implements a search results scorer. If empty, the default will be used.
  171. #html_search_scorer = 'scorer.js'
  172. # Output file base name for HTML help builder.
  173. htmlhelp_basename = 'AdiDriverdoc'
  174. # -- Options for LaTeX output ---------------------------------------------
  175. latex_elements = {
  176. # The paper size ('letterpaper' or 'a4paper').
  177. #'papersize': 'a4paper,dvipdfmx', # for japanese doc
  178. 'papersize': 'a4paper',
  179. # The font size ('10pt', '11pt' or '12pt').
  180. #'pointsize': '10pt',
  181. # Additional stuff for the LaTeX preamble.
  182. 'preamble': '\usepackage{ascmac}\usepackage{fancybox}\setcounter{chapter}{0}\setcounter{tocdepth}{3}',
  183. # Latex figure (float) alignment
  184. #'figure_align': 'htbp',
  185. }
  186. # Grouping the document tree into LaTeX files. List of tuples
  187. # (source start file, target name, title,
  188. # author, documentclass [howto, manual, or own class]).
  189. latex_documents = [
  190. (master_doc, 'adi_driver.tex', u'ADI Driver Documentation',
  191. u'Tokyo Opensource Robotics Kyokai Association', 'manual'),
  192. ]
  193. # The name of an image file (relative to this directory) to place at the top of
  194. # the title page.
  195. #latex_logo = None
  196. # For "manual" documents, if this is true, then toplevel headings are parts,
  197. # not chapters.
  198. #latex_use_parts = False
  199. # If true, show page references after internal links.
  200. #latex_show_pagerefs = False
  201. # If true, show URL addresses after external links.
  202. #latex_show_urls = False
  203. # Documents to append as an appendix to all manuals.
  204. #latex_appendices = []
  205. # If false, no module index is generated.
  206. #latex_domain_indices = True
  207. # -- Options for manual page output ---------------------------------------
  208. # One entry per manual page. List of tuples
  209. # (source start file, name, description, authors, manual section).
  210. man_pages = [
  211. (master_doc, 'adi_driver', u'ADI Driver Documentation',
  212. [author], 1)
  213. ]
  214. # If true, show URL addresses after external links.
  215. #man_show_urls = False
  216. # -- Options for Texinfo output -------------------------------------------
  217. # Grouping the document tree into Texinfo files. List of tuples
  218. # (source start file, target name, title, author,
  219. # dir menu entry, description, category)
  220. texinfo_documents = [
  221. (master_doc, 'adi_driver', u'ADI Driver Documentation',
  222. author, 'adi_driver', 'ADI Driver',
  223. 'Miscellaneous'),
  224. ]
  225. # Documents to append as an appendix to all manuals.
  226. #texinfo_appendices = []
  227. # If false, no module index is generated.
  228. #texinfo_domain_indices = True
  229. # How to display URL addresses: 'footnote', 'no', or 'inline'.
  230. #texinfo_show_urls = 'footnote'
  231. # If true, do not generate a @detailmenu in the "Top" node's menu.
  232. #texinfo_no_detailmenu = False
  233. # app setup hook
  234. def setup(app):
  235. app.add_config_value('recommonmark_config', {
  236. 'url_resolver': lambda url: github_doc_root + url,
  237. 'auto_toc_tree_section': 'Contents',
  238. 'enable_eval_rst': True,
  239. 'enable_auto_doc_ref': True,
  240. }, True)
  241. app.add_transform(AutoStructify)