conf.py.cn.in 4.9 KB
Newer Older
Z
zhangjinchao01 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# -*- coding: utf-8 -*-
#
# documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 23 19:40:08 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os, subprocess
import shlex
from recommonmark import parser, transform
Y
Yu Yang 已提交
18 19 20 21 22 23 24
try:
   import py_paddle
   import paddle
   import paddle.v2
except ImportError:
   print("Must install paddle python package before generating documentation")
   sys.exit(1)
Z
zhangjinchao01 已提交
25 26 27 28 29 30

MarkdownParser = parser.CommonMarkParser
AutoStructify = transform.AutoStructify
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
S
Shi-Liang 已提交
31
templates_path = ["@PROJ_ROOT@/doc_theme/templates"]
Z
zhangjinchao01 已提交
32 33 34 35

# -- General configuration ------------------------------------------------

# General information about the project.
36
project = u'PaddlePaddle'
Z
zhangjinchao01 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
author = u'%s developers' % project
copyright = u'2016, %s' % author
github_doc_root = ''

# add markdown parser
MarkdownParser.github_doc_root = github_doc_root
source_parsers = {
    '.md': MarkdownParser,
    '.Rmd': MarkdownParser,
}
os.environ['PADDLE_BUILD_DOC'] = '1'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.mathjax',
    'sphinx.ext.napoleon',
Y
Yu Yang 已提交
56
    'sphinx.ext.graphviz'
Z
zhangjinchao01 已提交
57
]
L
livc 已提交
58
mathjax_path="https://cdn.bootcss.com/mathjax/2.7.0/MathJax.js"
Z
zhangjinchao01 已提交
59 60 61 62 63 64 65 66 67 68 69 70 71
table_styling_embed_css = True

autodoc_member_order = 'bysource'

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = ['.rst', '.md', '.Rmd']

# The encoding of source files.
source_encoding = 'utf-8'

# The master toctree document.
L
liaogang 已提交
72
master_doc = 'index_cn'
Z
zhangjinchao01 已提交
73 74 75 76 77 78

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
Y
Yu Yang 已提交
79
language = 'zh_CN'
Z
zhangjinchao01 已提交
80 81 82 83 84 85 86 87 88

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
L
Luo Tao 已提交
89
exclude_patterns = ['_build', '**/*_en*', '*_en*']
Z
zhangjinchao01 已提交
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
S
Shi-Liang 已提交
122 123
html_theme = 'sphinx_rtd_theme'

Z
zhangjinchao01 已提交
124 125 126
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
S
Shi-Liang 已提交
127
html_static_path = ['@PROJ_ROOT@/doc_theme/static']
Z
zhangjinchao01 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154

# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'

# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
  (master_doc, '%s.tex' % project, project,
   author, 'manual'),
]

# Use the .. admonition:: directive for Notes sections.
# False to use the .. rubric:: directive instead.
napoleon_use_admonition_for_notes = True

def setup(app):
    # Add hook for building doxygen xml when needed
    # no c++ API for now
    app.add_config_value('recommonmark_config', {
            'url_resolver': lambda url: github_doc_root + url,
            }, True)
    app.add_transform(AutoStructify)