SfePy
X.Y
|
00001 # -*- coding: utf-8 -*- 00002 # 00003 # SfePy documentation build configuration file, created by 00004 # sphinx-quickstart on Wed Oct 14 00:02:22 2009. 00005 # 00006 # This file is execfile()d with the current directory set to its containing dir. 00007 # 00008 # Note that not all possible configuration values are present in this 00009 # autogenerated file. 00010 # 00011 # All configuration values have a default; values that are commented out 00012 # serve to show the default. 00013 00014 import sys, os 00015 00016 # If extensions (or modules to document with autodoc) are in another directory, 00017 # add these directories to sys.path here. If the directory is relative to the 00018 # documentation root, use os.path.abspath to make it absolute, like shown here. 00019 #sys.path.append(os.path.abspath('.')) 00020 00021 ## LS: Below walks parent directory and adds all non-excluded to sys.path 00022 #def add_to_sys_path(arg, dirname, fnames): 00023 # excludes = ('.git',) 00024 # for exclude in excludes: 00025 # if exclude not in dirname: 00026 # sys.path.append(os.path.abspath(dirname)) 00027 # 00028 #doc_dir,conf_file = os.path.split(__file__) 00029 #sfepy_dir = os.path.abspath(os.path.join(doc_dir, os.path.pardir)) 00030 #os.path.walk(sfepy_dir, add_to_sys_path, None) 00031 sys.path.append(os.path.abspath('sphinxext')) 00032 00033 # This is needed for gen_term_table. 00034 sys.path.append(os.path.abspath('../script')) 00035 00036 import sfepy 00037 00038 numpydoc_path = sfepy.Config().numpydoc_path() 00039 00040 if numpydoc_path is not None: 00041 sys.path.append(os.path.abspath(numpydoc_path)) 00042 00043 # -- General configuration ----------------------------------------------------- 00044 00045 # Add any Sphinx extension module names here, as strings. They can be extensions 00046 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 00047 extensions = ['sphinx.ext.autosummary', 'sphinx.ext.autodoc', 00048 'sphinx.ext.doctest', 'sphinx.ext.pngmath', 00049 'sphinx.ext.viewcode', 'numpydoc', 00050 'ipython_console_highlighting', 'sfepy.script.gen_term_table'] 00051 #extensions = ['sphinx.ext.autodoc'] 00052 00053 # Add any paths that contain templates here, relative to this directory. 00054 templates_path = ['_templates'] 00055 00056 # The suffix of source filenames. 00057 source_suffix = '.rst' 00058 00059 # The encoding of source files. 00060 #source_encoding = 'utf-8' 00061 00062 # The master toctree document. 00063 master_doc = 'index' 00064 00065 # General information about the project. 00066 project = u'SfePy' 00067 copyright = u'2010, Robert Cimrman and Contributors' 00068 00069 # The version info for the project you're documenting, acts as replacement for 00070 # |version| and |release|, also used in various other places throughout the 00071 # built documents. 00072 # 00073 # The short X.Y version. 00074 version = sfepy.__version__ 00075 # The full version, including alpha/beta/rc tags. 00076 release = version 00077 00078 # The language for content autogenerated by Sphinx. Refer to documentation 00079 # for a list of supported languages. 00080 #language = None 00081 00082 # There are two options for replacing |today|: either, you set today to some 00083 # non-false value, then it is used: 00084 #today = '' 00085 # Else, today_fmt is used as the format for a strftime call. 00086 today_fmt = '%B %d, %Y' 00087 00088 # List of documents that shouldn't be included in the build. 00089 #unused_docs = [] 00090 00091 # List of directories, relative to source directory, that shouldn't be searched 00092 # for source files. 00093 exclude_trees = ['_build'] 00094 00095 # The reST default role (used for this markup: `text`) to use for all documents. 00096 #default_role = None 00097 00098 # If true, '()' will be appended to :func: etc. cross-reference text. 00099 #add_function_parentheses = True 00100 00101 # If true, the current module name will be prepended to all description 00102 # unit titles (such as .. function::). 00103 add_module_names = True 00104 00105 # If true, sectionauthor and moduleauthor directives will be shown in the 00106 # output. They are ignored by default. 00107 show_authors = True 00108 00109 # The name of the Pygments (syntax highlighting) style to use. 00110 pygments_style = 'sphinx' 00111 00112 # A list of ignored prefixes for module index sorting. 00113 #modindex_common_prefix = [] 00114 00115 00116 # -- Options for HTML output --------------------------------------------------- 00117 00118 # The theme to use for HTML and HTML Help pages. Major themes that come with 00119 # Sphinx are currently 'default' and 'sphinxdoc'. 00120 html_theme = 'sfepy_theme' 00121 # Theme options are theme-specific and customize the look and feel of a theme 00122 # further. For a list of options available for each theme, see the 00123 # documentation. 00124 #html_theme_options = {} 00125 00126 # Add any paths that contain custom themes here, relative to this directory. 00127 html_theme_path = ["."] 00128 00129 # The name for this set of Sphinx documents. If None, it defaults to 00130 # "<project> v<release> documentation". 00131 #html_title = None 00132 00133 # A shorter title for the navigation bar. Default is the same as html_title. 00134 #html_short_title = None 00135 00136 # The name of an image file (relative to this directory) to place at the top 00137 # of the sidebar. 00138 #html_logo = None 00139 00140 # The name of an image file (within the static path) to use as favicon of the 00141 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 00142 # pixels large. 00143 #html_favicon = None 00144 00145 # Add any paths that contain custom static files (such as style sheets) here, 00146 # relative to this directory. They are copied after the builtin static files, 00147 # so a file named "default.css" will overwrite the builtin "default.css". 00148 html_static_path = ['_static'] 00149 00150 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 00151 # using the given strftime format. 00152 html_last_updated_fmt = '%b %d, %Y' 00153 00154 # If true, SmartyPants will be used to convert quotes and dashes to 00155 # typographically correct entities. 00156 html_use_smartypants = True 00157 00158 # Custom sidebar templates, maps document names to template names. 00159 #html_sidebars = {} 00160 00161 # Additional templates that should be rendered to pages, maps page names to 00162 # template names. 00163 html_additional_pages = {} 00164 #html_additional_pages = {'index': 'index.html', 'gallery':'gallery.html'} 00165 00166 # If false, no module index is generated. 00167 html_use_modindex = True 00168 00169 # If false, no index is generated. 00170 html_use_index = True 00171 00172 # If true, the index is split into individual pages for each letter. 00173 html_split_index = True 00174 00175 # If true, links to the reST sources are added to the pages. 00176 #html_show_sourcelink = True 00177 00178 # If true, an OpenSearch description file will be output, and all pages will 00179 # contain a <link> tag referring to it. The value of this option must be the 00180 # base URL from which the finished HTML is served. 00181 html_use_opensearch = '../objects.inv' 00182 00183 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). 00184 #html_file_suffix = '' 00185 00186 # Output file base name for HTML help builder. 00187 htmlhelp_basename = 'SfePydoc' 00188 00189 00190 # -- Options for LaTeX output -------------------------------------------------- 00191 00192 # The paper size ('letter' or 'a4'). 00193 latex_paper_size = 'a4' 00194 00195 # The font size ('10pt', '11pt' or '12pt'). 00196 latex_font_size = '12pt' 00197 00198 # Grouping the document tree into LaTeX files. List of tuples 00199 # (source start file, target name, title, author, documentclass [howto/manual]). 00200 latex_documents = [ 00201 ('index', 'SfePy.tex', u'SfePy Documentation', 00202 u'Robert Cimrman and Contributors', 'manual'), 00203 ] 00204 00205 # The name of an image file (relative to this directory) to place at the top of 00206 # the title page. 00207 #latex_logo = None 00208 00209 # For "manual" documents, if this is true, then toplevel headings are parts, 00210 # not chapters. 00211 #latex_use_parts = False 00212 00213 # Additional stuff for the LaTeX preamble. 00214 #latex_preamble = '' 00215 latex_preamble = r""" 00216 \usepackage{bm} 00217 \usepackage{amsfonts} 00218 \def\dt{{\Delta t}} 00219 \def\pdiff#1#2{\frac{\partial {#1}}{\partial {#2}}} 00220 \def\tdiff#1#2{\frac{{\rm d} {#1}}{{\rm d} {#2}}} 00221 \def\difd#1{\ {\rm d}#1} 00222 \def\intl#1#2{\int \limits_{#1}^{#2}} 00223 \def\eff{^{\rm eff}} 00224 \def\sunm{^{(n-1)}} 00225 \def\suz{^{(0)}} 00226 \newcommand{\dvg}{\mathop{\rm div}} 00227 \newcommand{\tr}{\mathop{\rm tr}} 00228 \newcommand{\ul}[1]{\underline{#1}} 00229 \newcommand{\uld}[1]{\dot{\underline{#1}}} 00230 \newcommand{\ull}[1]{\underline{\underline{#1}}} 00231 \newcommand{\dev}{\mathop{\rm dev}} 00232 \newcommand{\skewop}{\mathop{\rm skew}} 00233 \def\from{\leftarrow} 00234 \def\Vcal{\mathcal{V}} 00235 \def\Tcal{\mathcal{T}} 00236 \def\Ical{\mathcal{I}} 00237 \def\Hcal{\mathcal{H}} 00238 \def\Fcal{\mathcal{F}} 00239 \def\Gcal{\mathcal{G}} 00240 \def\pd{\partial} 00241 \def\ub{\bm{u}} 00242 \def\vb{\bm{v}} 00243 \def\Mb{\bm{M}} 00244 \def\vphib{\bm{\varphi}} 00245 """ 00246 # LS: Are the following needed as well? 00247 #\def\Vcal{\mathcal{V}} 00248 #\def\Tcal{\mathcal{T}} 00249 #\def\figDir{../doc/tex/figures} 00250 #""" 00251 00252 # Documents to append as an appendix to all manuals. 00253 #latex_appendices = [] 00254 00255 # If false, no module index is generated. 00256 latex_use_modindex = True 00257 00258 # Preamble for pngmath images 00259 pngmath_latex_preamble = latex_preamble 00260 00261 # Turn off numpydoc autosummary tables 00262 numpydoc_show_class_members = False 00263 00264 def process_terms(app, what_, name, obj, options, lines): 00265 """ 00266 Prepend term call signature(s) into term docstrings. 00267 """ 00268 from types import TypeType 00269 from sfepy.terms.terms import Term 00270 00271 if isinstance(obj, TypeType): 00272 if issubclass(obj, Term) and len(obj.name): 00273 arg_types = obj.arg_types 00274 if ((len(arg_types) > 1) and not isinstance(arg_types[0], str)): 00275 arg_types = [u', '.join(['%s' % arg for arg in arg_type]) 00276 for arg_type in arg_types] 00277 at_lines = [u'``(%s)``' % arg_type for arg_type in arg_types] 00278 00279 else: 00280 arg_types = u', '.join(['%s' % arg for arg in arg_types]) 00281 at_lines = [u'``(%s)``' % arg_types] 00282 00283 for ii, line in enumerate(lines): 00284 if line.startswith(':Arguments'): 00285 i0 = ii - 1 00286 break 00287 00288 else: 00289 i0 = 0 00290 00291 len0 = len(obj.name) + 4 00292 lines.insert(i0+0, u'') 00293 lines.insert(i0+1, u':Call signature:') 00294 lines.insert(i0+2, u'') 00295 lines.insert(i0+3, (u'=' * len0) + u' ===') 00296 lines.insert(i0+4, u'**%s** %s' % (obj.name, at_lines[0])) 00297 for ii, line in enumerate(at_lines[1:]): 00298 lines.insert(i0+5+ii, u'..' + (' ' * (len0 - 1)) + line) 00299 lines.insert(i0+4+len(at_lines), (u'=' * len0) + u' ===') 00300 lines.insert(i0+5+len(at_lines), u'') 00301 00302 # make sure there is a blank line at the end 00303 if lines and lines[-1]: 00304 lines.append(u'') 00305 00306 00307 def setup(app): 00308 app.connect('autodoc-process-docstring', process_terms)