github.com/fafucoder/cilium@v1.6.11/Documentation/conf.py (about)

     1  # -*- coding: utf-8 -*-
     2  #
     3  # Cilium documentation build configuration file, created by
     4  # sphinx-quickstart on Sun Feb 12 18:34:43 2017.
     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  
    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 sys
    21  import re
    22  import subprocess
    23  # sys.path.insert(0, os.path.abspath('.'))
    24  
    25  
    26  # -- General configuration ------------------------------------------------
    27  
    28  # If your documentation needs a minimal Sphinx version, state it here.
    29  #
    30  # needs_sphinx = '1.0'
    31  
    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  html_logo = "images/logo.svg"
    36  extensions = ['sphinx.ext.ifconfig',
    37                'sphinx.ext.githubpages',
    38                'sphinx.ext.extlinks',
    39                'sphinxcontrib.openapi',
    40                'sphinx_tabs.tabs',
    41                'sphinxcontrib.spelling',
    42                'versionwarning.extension']
    43  
    44  # Add any paths that contain templates here, relative to this directory.
    45  templates_path = ['_templates']
    46  
    47  # The suffix(es) of source filenames.
    48  # You can specify multiple suffix as a list of string:
    49  #
    50  # source_suffix = ['.rst', '.md']
    51  source_suffix = ['.rst', '.md']
    52  source_parsers = {
    53      '.md': 'recommonmark.parser.CommonMarkParser',
    54  }
    55  
    56  # The master toctree document.
    57  master_doc = 'index'
    58  
    59  # General information about the project.
    60  project = u'Cilium'
    61  copyright = u'2017-2019, Cilium Authors'
    62  author = u'Cilium Authors'
    63  
    64  # The version info for the project you're documenting, acts as replacement for
    65  # |version| and |release|, also used in various other places throughout the
    66  # built documents.
    67  #
    68  # The short X.Y version.
    69  release = open("../VERSION", "r").read().strip()
    70  # Used by version warning
    71  versionwarning_body_selector = "div.document"
    72  
    73  # Fetch the docs version from an environment variable.
    74  # Map latest -> master.
    75  # Map stable -> current version number.
    76  branch = os.environ.get('READTHEDOCS_VERSION')
    77  if branch is None or branch == 'latest':
    78      branch = 'HEAD'
    79      archive_name = 'master'
    80  elif branch == 'stable':
    81      branch = release
    82      archive_name = release
    83  else:
    84      archive_name = branch
    85  githubusercontent = 'https://raw.githubusercontent.com/cilium/cilium/'
    86  scm_web = githubusercontent + branch
    87  jenkins_branch = 'https://jenkins.cilium.io/view/Cilium-v' + release[0:3]
    88  archive_filename = archive_name + '.tar.gz'
    89  archive_link = 'https://github.com/cilium/cilium/archive/' + archive_filename
    90  archive_name = 'cilium-' + archive_name.strip('v')
    91  
    92  # Store variables in the epilogue so they are globally available.
    93  rst_epilog = """
    94  .. |SCM_WEB| replace:: \{s}
    95  .. |SCM_BRANCH| replace:: \{b}
    96  .. |SCM_ARCHIVE_NAME| replace:: \{a}
    97  .. |SCM_ARCHIVE_FILENAME| replace:: \{f}
    98  .. |SCM_ARCHIVE_LINK| replace:: \{l}
    99  """.format(s=scm_web, b=branch, a=archive_name, f=archive_filename, l=archive_link)
   100  
   101  extlinks = {
   102      'git-tree': (scm_web + "/%s", ''),
   103      'jenkins-branch': (jenkins_branch + "/%s", ''),
   104  }
   105  
   106  # The language for content autogenerated by Sphinx. Refer to documentation
   107  # for a list of supported languages.
   108  #
   109  # This is also used if you do content translation via gettext catalogs.
   110  # Usually you set "language" from the command line for these cases.
   111  language = None
   112  
   113  # List of patterns, relative to source directory, that match files and
   114  # directories to ignore when looking for source files.
   115  # This patterns also effect to html_static_path and html_extra_path
   116  exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
   117  
   118  # The name of the Pygments (syntax highlighting) style to use.
   119  pygments_style = 'sphinx'
   120  
   121  # If true, `todo` and `todoList` produce output, else they produce nothing.
   122  todo_include_todos = False
   123  
   124  
   125  # -- Options for HTML output ----------------------------------------------
   126  
   127  # The theme to use for HTML and HTML Help pages.  See the documentation for
   128  # a list of builtin themes.
   129  #
   130  html_theme = "sphinx_rtd_theme_cilium"
   131  html_context = {
   132      'release': release
   133  }
   134  
   135  # Theme options are theme-specific and customize the look and feel of a theme
   136  # further.  For a list of options available for each theme, see the
   137  # documentation.
   138  #
   139  html_theme_options = {
   140      'logo_only': True
   141  }
   142  
   143  # Add any paths that contain custom static files (such as style sheets) here,
   144  # relative to this directory. They are copied after the builtin static files,
   145  # so a file named "default.css" will overwrite the builtin "default.css".
   146  html_static_path = ['images', '_static']
   147  
   148  # -- Options for HTMLHelp output ------------------------------------------
   149  
   150  # Output file base name for HTML help builder.
   151  htmlhelp_basename = 'Ciliumdoc'
   152  
   153  
   154  # -- Options for LaTeX output ---------------------------------------------
   155  
   156  latex_elements = {
   157      # The paper size ('letterpaper' or 'a4paper').
   158      #
   159      # 'papersize': 'letterpaper',
   160  
   161      # The font size ('10pt', '11pt' or '12pt').
   162      #
   163      # 'pointsize': '10pt',
   164  
   165      # Additional stuff for the LaTeX preamble.
   166      #
   167      # 'preamble': '',
   168  
   169      # Latex figure (float) alignment
   170      #
   171      # 'figure_align': 'htbp',
   172      'extraclassoptions': 'openany',
   173  }
   174  
   175  # Grouping the document tree into LaTeX files. List of tuples
   176  # (source start file, target name, title,
   177  #  author, documentclass [howto, manual, or own class]).
   178  latex_documents = [
   179      (master_doc, 'Cilium.tex', u'Cilium Documentation',
   180       u'Cilium Authors', 'manual'),
   181  ]
   182  
   183  
   184  # -- Options for manual page output ---------------------------------------
   185  
   186  # One entry per manual page. List of tuples
   187  # (source start file, name, description, authors, manual section).
   188  man_pages = [
   189      (master_doc, 'cilium', u'Cilium Documentation',
   190       [author], 1)
   191  ]
   192  
   193  
   194  # -- Options for Texinfo output -------------------------------------------
   195  
   196  # Grouping the document tree into Texinfo files. List of tuples
   197  # (source start file, target name, title, author,
   198  #  dir menu entry, description, category)
   199  texinfo_documents = [
   200      (master_doc, 'Cilium', u'Cilium Documentation',
   201       author, 'Cilium', 'One line description of project.',
   202       'Miscellaneous'),
   203  ]
   204  
   205  http_strict_mode = False
   206  
   207  # Try as hard as possible to find references
   208  default_role = 'any'
   209  
   210  
   211  def setup(app):
   212      app.add_stylesheet('parsed-literal.css')
   213      app.add_stylesheet('copybutton.css')
   214      app.add_javascript('clipboardjs.min.js')
   215      app.add_javascript("copybutton.js")