| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# ============================================================================= |
| 3 |
# SPHINX CONFIGURATION: behave documentation build configuration file |
| 4 |
# ============================================================================= |
| 5 |
|
| 6 |
import os.path |
| 7 |
import sys |
| 8 |
import importlib |
| 9 |
|
| 10 |
# -- ENSURE: Local workspace is used (for sphinx apidocs). |
| 11 |
# If extensions (or modules to document with autodoc) are in another directory, |
| 12 |
# add these directories to sys.path here. If the directory is relative to the |
| 13 |
# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 14 |
sys.path.insert(0, os.path.abspath("..")) |
| 15 |
|
| 16 |
# ------------------------------------------------------------------------------ |
| 17 |
# EXTENSIONS CONFIGURATION |
| 18 |
# ------------------------------------------------------------------------------ |
| 19 |
# If your documentation needs a minimal Sphinx version, state it here. |
| 20 |
needs_sphinx = "1.3" |
| 21 |
|
| 22 |
# Add any Sphinx extension module names here, as strings. They can be extensions |
| 23 |
# coming with Sphinx (named "sphinx.ext.*") or your custom ones. |
| 24 |
extensions = [ |
| 25 |
"sphinx.ext.autodoc", |
| 26 |
"sphinx.ext.ifconfig", |
| 27 |
"sphinx.ext.extlinks", |
| 28 |
"sphinx.ext.todo", |
| 29 |
"sphinx.ext.intersphinx", |
| 30 |
] |
| 31 |
optional_extensions = [ |
| 32 |
# -- DISABLED: "sphinxcontrib.youtube", |
| 33 |
# http://www.sphinx-doc.org/en/stable/faq.html |
| 34 |
"rinoh.frontend.sphinx", # ALTERNATIVE FOR: LATEX-PDF |
| 35 |
"rst2pdf.pdfbuilder", # PDF |
| 36 |
|
| 37 |
] |
| 38 |
for optional_module_name in optional_extensions: |
| 39 |
try: |
| 40 |
importlib.import_module(optional_module_name) |
| 41 |
extensions.append(optional_module_name) |
| 42 |
except ImportError: |
| 43 |
pass |
| 44 |
|
| 45 |
|
| 46 |
extlinks = { |
| 47 |
"pypi": ("https://pypi.python.org/pypi/%s", ""), |
| 48 |
"github": ("https://github.com/%s", "github:/"), |
| 49 |
"issue": ("https://github.com/behave/behave/issue/%s", "issue #"), |
| 50 |
"youtube": ("https://www.youtube.com/watch?v=%s", "youtube:video="), |
| 51 |
"behave": ("https://github.com/behave/behave", None), |
| 52 |
} |
| 53 |
|
| 54 |
intersphinx_mapping = { |
| 55 |
"python": ('https://docs.python.org/3', None) |
| 56 |
} |
| 57 |
|
| 58 |
# -- SUPPORT: Documentation variation-points with sphinx.ext.ifconfig |
| 59 |
def setup(app): |
| 60 |
# -- VARIATION-POINT: supports_video |
| 61 |
# BASED-ON: installed("sphinxcontrib-youtube") and output-mode |
| 62 |
# TODO: Check for output-mode, too (supported on: HTML, ...) |
| 63 |
supports_video = "sphinxcontrib.youtube" in extensions |
| 64 |
app.add_config_value("supports_video", supports_video, "env") |
| 65 |
|
| 66 |
|
| 67 |
# ----------------------------------------------------------------------------- |
| 68 |
# BASIC CONFIGURATION |
| 69 |
# ----------------------------------------------------------------------------- |
| 70 |
# Add any paths that contain templates here, relative to this directory. |
| 71 |
templates_path = ["_templates"] |
| 72 |
|
| 73 |
# The suffix of source filenames. |
| 74 |
source_suffix = ".rst" |
| 75 |
|
| 76 |
# The encoding of source files. |
| 77 |
source_encoding = "utf-8" |
| 78 |
|
| 79 |
# The master toctree document. |
| 80 |
master_doc = "index" |
| 81 |
|
| 82 |
# ----------------------------------------------------------------------------- |
| 83 |
# GENERAL CONFIGURATION |
| 84 |
# ----------------------------------------------------------------------------- |
| 85 |
project = u"behave" |
| 86 |
authors = u"Benno Rice, Richard Jones and Jens Engel" |
| 87 |
copyright = u"2012-2017, %s" % authors |
| 88 |
|
| 89 |
# The version info for the project you're documenting, acts as replacement for |
| 90 |
# |version| and |release|, also used in various other places throughout the |
| 91 |
# built documents. |
| 92 |
# |
| 93 |
# The short X.Y version. |
| 94 |
from behave import __version__ |
| 95 |
version = __version__ |
| 96 |
# The full version, including alpha/beta/rc tags. |
| 97 |
release = __version__ |
| 98 |
|
| 99 |
# The language for content autogenerated by Sphinx. Refer to documentation |
| 100 |
# for a list of supported languages. |
| 101 |
#language = None |
| 102 |
|
| 103 |
# There are two options for replacing |today|: either, you set today to some |
| 104 |
# non-false value, then it is used: |
| 105 |
#today = "" |
| 106 |
# Else, today_fmt is used as the format for a strftime call. |
| 107 |
today_fmt = "%Y-%m-%d" |
| 108 |
|
| 109 |
# List of patterns, relative to source directory, that match files and |
| 110 |
# directories to ignore when looking for source files. |
| 111 |
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| 112 |
|
| 113 |
# The reST default role (used for this markup: `text`) to use for all documents. |
| 114 |
#default_role = None |
| 115 |
|
| 116 |
# If true, "()" will be appended to :func: etc. cross-reference text. |
| 117 |
#add_function_parentheses = True |
| 118 |
|
| 119 |
# If true, the current module name will be prepended to all description |
| 120 |
# unit titles (such as .. function::). |
| 121 |
#add_module_names = True |
| 122 |
|
| 123 |
# If true, sectionauthor and moduleauthor directives will be shown in the |
| 124 |
# output. They are ignored by default. |
| 125 |
#show_authors = False |
| 126 |
|
| 127 |
# The name of the Pygments (syntax highlighting) style to use. |
| 128 |
pygments_style = "sphinx" |
| 129 |
# MAYBE STYLES: friendly, vs, xcode, vs, tango |
| 130 |
|
| 131 |
# If true, `todo` and `todoList` produce output, else they produce nothing. |
| 132 |
todo_include_todos = False |
| 133 |
|
| 134 |
# A list of ignored prefixes for module index sorting. |
| 135 |
#modindex_common_prefix = [] |
| 136 |
|
| 137 |
|
| 138 |
# ------------------------------------------------------------------------------ |
| 139 |
# OPTIONS FOR: HTML OUTPUT |
| 140 |
# ------------------------------------------------------------------------------ |
| 141 |
# The theme to use for HTML and HTML Help pages. See the documentation for |
| 142 |
# a list of builtin themes. |
| 143 |
html_theme = "kr" |
| 144 |
html_theme = "bootstrap" |
| 145 |
|
| 146 |
on_rtd = os.environ.get("READTHEDOCS", None) == "True" |
| 147 |
if on_rtd: |
| 148 |
html_theme = "default" |
| 149 |
|
| 150 |
if html_theme == "bootstrap": |
| 151 |
# See sphinx-bootstrap-theme for documentation of these options |
| 152 |
# https://github.com/ryan-roemer/sphinx-bootstrap-theme |
| 153 |
import sphinx_bootstrap_theme |
| 154 |
html_theme_options = { |
| 155 |
'navbar_site_name': 'Document', |
| 156 |
'navbar_pagenav': True |
| 157 |
} |
| 158 |
|
| 159 |
# Add any paths that contain custom themes here, relative to this directory. |
| 160 |
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() |
| 161 |
|
| 162 |
elif html_theme in ("default", "kr"): |
| 163 |
html_theme_path = ["_themes"] |
| 164 |
html_logo = "_static/behave_logo1.png" |
| 165 |
|
| 166 |
|
| 167 |
# Theme options are theme-specific and customize the look and feel of a theme |
| 168 |
# further. For a list of options available for each theme, see the |
| 169 |
# documentation. |
| 170 |
# |
| 171 |
# html_theme_options = {} |
| 172 |
|
| 173 |
# Add any paths that contain custom themes here, relative to this directory. |
| 174 |
|
| 175 |
# The name for this set of Sphinx documents. If None, it defaults to |
| 176 |
# "<project> v<release> documentation". |
| 177 |
#html_title = None |
| 178 |
|
| 179 |
# A shorter title for the navigation bar. Default is the same as html_title. |
| 180 |
#html_short_title = None |
| 181 |
|
| 182 |
# The name of an image file (relative to this directory) to place at the top |
| 183 |
# of the sidebar. |
| 184 |
# html_logo = "_static/behave_logo1.png" |
| 185 |
|
| 186 |
# The name of an image file (within the static path) to use as favicon of the |
| 187 |
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
| 188 |
# pixels large. |
| 189 |
#html_favicon = None |
| 190 |
|
| 191 |
# Add any paths that contain custom static files (such as style sheets) here, |
| 192 |
# relative to this directory. They are copied after the builtin static files, |
| 193 |
# so a file named "default.css" will overwrite the builtin "default.css". |
| 194 |
html_static_path = ["_static"] |
| 195 |
|
| 196 |
# If not "", a "Last updated on:" timestamp is inserted at every page bottom, |
| 197 |
# using the given strftime format. |
| 198 |
html_last_updated_fmt = "%Y-%m-%d" |
| 199 |
|
| 200 |
# If true, SmartyPants will be used to convert quotes and dashes to |
| 201 |
# typographically correct entities. |
| 202 |
# html_use_smartypants = True |
| 203 |
|
| 204 |
# Custom sidebar templates, maps document names to template names. |
| 205 |
#html_sidebars = {} |
| 206 |
|
| 207 |
# Additional templates that should be rendered to pages, maps page names to |
| 208 |
# template names. |
| 209 |
#html_additional_pages = {} |
| 210 |
|
| 211 |
# If false, no module index is generated. |
| 212 |
# html_domain_indices = True |
| 213 |
|
| 214 |
# If false, no index is generated. |
| 215 |
# html_use_index = True |
| 216 |
|
| 217 |
# If true, the index is split into individual pages for each letter. |
| 218 |
# html_split_index = False |
| 219 |
|
| 220 |
# If true, links to the reST sources are added to the pages. |
| 221 |
# html_show_sourcelink = True |
| 222 |
|
| 223 |
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. |
| 224 |
# html_show_sphinx = True |
| 225 |
|
| 226 |
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. |
| 227 |
html_show_copyright = True |
| 228 |
|
| 229 |
# If true, an OpenSearch description file will be output, and all pages will |
| 230 |
# contain a <link> tag referring to it. The value of this option must be the |
| 231 |
# base URL from which the finished HTML is served. |
| 232 |
#html_use_opensearch = "" |
| 233 |
|
| 234 |
# This is the file name suffix for HTML files (e.g. ".xhtml"). |
| 235 |
html_file_suffix = ".html" |
| 236 |
|
| 237 |
# ------------------------------------------------------------------------------ |
| 238 |
# OPTIONS FOR: HTML HELP |
| 239 |
# ------------------------------------------------------------------------------ |
| 240 |
# Output file base name for HTML help builder. |
| 241 |
htmlhelp_basename = "behavedoc" |
| 242 |
|
| 243 |
|
| 244 |
# ------------------------------------------------------------------------------ |
| 245 |
# OPTIONS FOR: LATEX OUTPUT |
| 246 |
# ------------------------------------------------------------------------------ |
| 247 |
latex_elements = { |
| 248 |
# The paper size ("letterpaper" or "a4paper"). |
| 249 |
"papersize": "a4paper", |
| 250 |
|
| 251 |
# The font size ("10pt", "11pt" or "12pt"). |
| 252 |
# "pointsize": "10pt", |
| 253 |
|
| 254 |
# Additional stuff for the LaTeX preamble. |
| 255 |
# "preamble": "", |
| 256 |
} |
| 257 |
|
| 258 |
# Grouping the document tree into LaTeX files. List of tuples |
| 259 |
# (source start file, target name, title, author, documentclass [howto/manual]). |
| 260 |
latex_documents = [ |
| 261 |
("index", "behave.tex", u"behave Documentation", authors, "manual"), |
| 262 |
] |
| 263 |
|
| 264 |
# latex_logo = None |
| 265 |
|
| 266 |
# ------------------------------------------------------------------------------ |
| 267 |
# OPTIONS FOR: MANUAL PAGE (man page) OUTPUT |
| 268 |
# ------------------------------------------------------------------------------ |
| 269 |
# One entry per manual page. List of tuples |
| 270 |
# (source start file, name, description, authors, manual section). |
| 271 |
man_pages = [ |
| 272 |
("index", "behave", u"behave Documentation", [authors], 1) |
| 273 |
] |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
# ------------------------------------------------------------------------------ |
| 278 |
# OPTIONS FOR: Texinfo output |
| 279 |
# ------------------------------------------------------------------------------ |
| 280 |
# Grouping the document tree into Texinfo files. List of tuples |
| 281 |
# (source start file, target name, title, author, |
| 282 |
# dir menu entry, description, category) |
| 283 |
texinfo_documents = [ |
| 284 |
("index", "behave", u"behave Documentation", authors, |
| 285 |
"behave", "A test runner for behave (feature tests).", "Miscellaneous"), |
| 286 |
] |
| 287 |
|
| 288 |
# ----------------------------------------------------------------------------- |
| 289 |
# RST2PDF OUTPUT CONFIGURATION: builder=pdf (prepared) |
| 290 |
# ----------------------------------------------------------------------------- |
| 291 |
# Grouping the document tree into PDF files. List of tuples |
| 292 |
# (source start file, target name, title, author, options). |
| 293 |
# |
| 294 |
# If there is more than one author, separate them with \\. |
| 295 |
# For example: r'Guido van Rossum\\Fred L. Drake, Jr., editor' |
| 296 |
# |
| 297 |
# The options element is a dictionary that lets you override |
| 298 |
# this config per-document. |
| 299 |
# For example, |
| 300 |
# ('index', u'MyProject', u'My Project', u'Author Name', |
| 301 |
# dict(pdf_compressed = True)) |
| 302 |
# would mean that specific document would be compressed |
| 303 |
# regardless of the global pdf_compressed setting. |
| 304 |
pdf_documents = [ |
| 305 |
('index', project, project, authors), |
| 306 |
] |
| 307 |
# A comma-separated list of custom stylesheets. Example: |
| 308 |
pdf_stylesheets = ['sphinx','kerning','a4'] |
| 309 |
# Create a compressed PDF |
| 310 |
# Use True/False or 1/0 |
| 311 |
# Example: compressed=True |
| 312 |
pdf_compressed = True |
| 313 |
# A colon-separated list of folders to search for fonts. Example: |
| 314 |
# pdf_font_path = ['/usr/share/fonts', '/usr/share/texmf-dist/fonts/'] |
| 315 |
# Language to be used for hyphenation support |
| 316 |
pdf_language = "en_US" |
| 317 |
# Mode for literal blocks wider than the frame. Can be overflow, shrink or truncate |
| 318 |
pdf_fit_mode = "shrink" |
| 319 |
# Section level that forces a break page. |
| 320 |
# For example: 1 means top-level sections start in a new page |
| 321 |
# 0 means disabled |
| 322 |
# pdf_break_level = 0 XXX |
| 323 |
pdf_break_level = 1 |
| 324 |
|
| 325 |
# When a section starts in a new page, force it to be 'even', 'odd', |
| 326 |
# or just use 'any' |
| 327 |
#pdf_breakside = 'any' |
| 328 |
|
| 329 |
# Insert footnotes where they are defined instead of |
| 330 |
# at the end. |
| 331 |
#pdf_inline_footnotes = True |
| 332 |
# verbosity level. 0 1 or 2 |
| 333 |
#pdf_verbosity = 0 |
| 334 |
# If false, no index is generated. |
| 335 |
#pdf_use_index = True |
| 336 |
# If false, no modindex is generated. |
| 337 |
#pdf_use_modindex = True |
| 338 |
pdf_use_modindex = False |
| 339 |
|
| 340 |
# If false, no coverpage is generated. |
| 341 |
#pdf_use_coverpage = True |
| 342 |
# Name of the cover page template to use |
| 343 |
#pdf_cover_template = 'sphinxcover.tmpl' |
| 344 |
# Documents to append as an appendix to all manuals. |
| 345 |
#pdf_appendices = [] |
| 346 |
# Enable experimental feature to split table cells. Use it |
| 347 |
# if you get "DelayedTable too big" errors |
| 348 |
# pdf_splittables = True XXX |
| 349 |
pdf_splittables = False |
| 350 |
|
| 351 |
# Set the default DPI for images |
| 352 |
#pdf_default_dpi = 72 |
| 353 |
# Enable rst2pdf extension modules (default is empty list) |
| 354 |
# you need vectorpdf for better sphinx's graphviz support |
| 355 |
#pdf_extensions = ['vectorpdf'] |
| 356 |
|
| 357 |
# Page template name for "regular" pages |
| 358 |
pdf_page_template = 'cutePage' |