conf.py 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Configuration file for the Sphinx documentation builder.
  4. #
  5. # This file does only contain a selection of the most common options. For a
  6. # full list see the documentation:
  7. # http://www.sphinx-doc.org/en/master/config
  8. import sys, os
  9. sys.path.append(os.path.abspath("../../"))
  10. from recommonmark.parser import CommonMarkParser
  11. from recommonmark.transform import AutoStructify
  12. # -- Path setup --------------------------------------------------------------
  13. # If extensions (or modules to document with autodoc) are in another directory,
  14. # add these directories to sys.path here. If the directory is relative to the
  15. # documentation root, use os.path.abspath to make it absolute, like shown here.
  16. #
  17. # import os
  18. # import sys
  19. # sys.path.insert(0, os.path.abspath('.'))
  20. # -- Project information -----------------------------------------------------
  21. project = ""
  22. copyright = "2019, Travis Clarke"
  23. author = "Travis Clarke"
  24. # The full version, including alpha/beta/rc tags
  25. release = __import__("s3recon").__version__
  26. # The short X.Y version
  27. version = release
  28. # -- General configuration ---------------------------------------------------
  29. # If your documentation needs a minimal Sphinx version, state it here.
  30. #
  31. # needs_sphinx = '1.0'
  32. # Add any Sphinx extension module names here, as strings. They can be
  33. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  34. # ones.
  35. extensions = [
  36. "sphinx.ext.autodoc",
  37. "sphinx.ext.doctest",
  38. "sphinx.ext.intersphinx",
  39. "sphinx.ext.todo",
  40. "sphinx.ext.coverage",
  41. "sphinx.ext.mathjax",
  42. "sphinx.ext.ifconfig",
  43. "sphinx.ext.viewcode",
  44. # 'sphinx.ext.githubpages',
  45. ]
  46. # Add any paths that contain templates here, relative to this directory.
  47. templates_path = ["_templates"]
  48. # The suffix(es) of source filenames.
  49. # You can specify multiple suffix as a list of string:
  50. #
  51. # Enable Markdown
  52. source_parsers = {".md": CommonMarkParser}
  53. source_suffix = [".rst", ".md"]
  54. # source_suffix = '.rst'
  55. # The master toctree document.
  56. master_doc = "index"
  57. # The language for content autogenerated by Sphinx. Refer to documentation
  58. # for a list of supported languages.
  59. #
  60. # This is also used if you do content translation via gettext catalogs.
  61. # Usually you set "language" from the command line for these cases.
  62. language = None
  63. # List of patterns, relative to source directory, that match files and
  64. # directories to ignore when looking for source files.
  65. # This pattern also affects html_static_path and html_extra_path.
  66. exclude_patterns = []
  67. # The name of the Pygments (syntax highlighting) style to use.
  68. pygments_style = None
  69. # -- Options for HTML output -------------------------------------------------
  70. # The theme to use for HTML and HTML Help pages. See the documentation for
  71. # a list of builtin themes.
  72. #
  73. html_theme = "alabaster"
  74. # html_theme = 'default'
  75. # Theme options are theme-specific and customize the look and feel of a theme
  76. # further. For a list of options available for each theme, see the
  77. # documentation.
  78. #
  79. html_theme_options = {
  80. "github_user": "clarketm",
  81. "github_repo": "s3recon",
  82. "github_type": "star",
  83. "github_banner": "forkme_right_red_aa0000.png",
  84. "show_powered_by": False,
  85. }
  86. # Add any paths that contain custom static files (such as style sheets) here,
  87. # relative to this directory. They are copied after the builtin static files,
  88. # so a file named "default.css" will overwrite the builtin "default.css".
  89. html_static_path = ["_static"]
  90. # Custom sidebar templates, must be a dictionary that maps document names
  91. # to template names.
  92. #
  93. # The default sidebars (for documents that don't match any pattern) are
  94. # defined by theme itself. Builtin themes are using these templates by
  95. # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
  96. # 'searchbox.html']``.
  97. #
  98. # html_sidebars = {}
  99. html_sidebars = {"**": ["about.html", "localtoc.html", "searchbox.html"]}
  100. # -- Options for HTMLHelp output ---------------------------------------------
  101. # Output file base name for HTML help builder.
  102. htmlhelp_basename = "s3recondoc"
  103. # -- Options for LaTeX output ------------------------------------------------
  104. latex_elements = {
  105. # The paper size ('letterpaper' or 'a4paper').
  106. #
  107. # 'papersize': 'letterpaper',
  108. # The font size ('10pt', '11pt' or '12pt').
  109. #
  110. # 'pointsize': '10pt',
  111. # Additional stuff for the LaTeX preamble.
  112. #
  113. # 'preamble': '',
  114. # Latex figure (float) alignment
  115. #
  116. # 'figure_align': 'htbp',
  117. }
  118. # Grouping the document tree into LaTeX files. List of tuples
  119. # (source start file, target name, title,
  120. # author, documentclass [howto, manual, or own class]).
  121. latex_documents = [
  122. (master_doc, "s3recon.tex", "s3recon Documentation", "Travis Clarke", "manual")
  123. ]
  124. # -- Options for manual page output ------------------------------------------
  125. # One entry per manual page. List of tuples
  126. # (source start file, name, description, authors, manual section).
  127. man_pages = [(master_doc, "s3recon", "s3recon Documentation", [author], 1)]
  128. # -- Options for Texinfo output ----------------------------------------------
  129. # Grouping the document tree into Texinfo files. List of tuples
  130. # (source start file, target name, title, author,
  131. # dir menu entry, description, category)
  132. texinfo_documents = [
  133. (
  134. master_doc,
  135. "s3recon",
  136. "s3recon Documentation",
  137. author,
  138. "s3recon",
  139. "One line description of project.",
  140. "Miscellaneous",
  141. )
  142. ]
  143. # -- Options for Epub output -------------------------------------------------
  144. # Bibliographic Dublin Core info.
  145. epub_title = project
  146. # The unique identifier of the text. This can be a ISBN number
  147. # or the project homepage.
  148. #
  149. # epub_identifier = ''
  150. # A unique identification for the text.
  151. #
  152. # epub_uid = ''
  153. # A list of files that should not be packed into the epub file.
  154. epub_exclude_files = ["search.html"]
  155. # -- Extension configuration -------------------------------------------------
  156. # -- Options for intersphinx extension ---------------------------------------
  157. # Example configuration for intersphinx: refer to the Python standard library.
  158. intersphinx_mapping = {"https://docs.python.org/": None}
  159. # -- Options for todo extension ----------------------------------------------
  160. # If true, `todo` and `todoList` produce output, else they produce nothing.
  161. todo_include_todos = True
  162. # -- Options for todo extension ----------------------------------------------
  163. class PatchedAutoStructify(AutoStructify, object):
  164. """AutoStructify by default can't handle contents directives."""
  165. def patched_nested_parse(self, *args, **kwargs):
  166. """Sets match_titles then calls stored_nested_parse."""
  167. kwargs["match_titles"] = True
  168. return self.stored_nested_parse(*args, **kwargs)
  169. def auto_code_block(self, *args, **kwargs):
  170. """Modified auto_code_block that patches nested_parse."""
  171. self.stored_nested_parse = self.state_machine.state.nested_parse
  172. self.state_machine.state.nested_parse = self.patched_nested_parse
  173. try:
  174. return super(PatchedAutoStructify, self).auto_code_block(*args, **kwargs)
  175. finally:
  176. self.state_machine.state.nested_parse = self.stored_nested_parse
  177. def setup(app):
  178. app.add_config_value(
  179. "recommonmark_config",
  180. {
  181. "enable_auto_toc_tree": False,
  182. "enable_inline_math": False,
  183. "enable_auto_doc_ref": False,
  184. },
  185. True,
  186. )
  187. app.add_transform(PatchedAutoStructify)