1 | # -*- coding: utf-8 -*- |
---|
2 | # |
---|
3 | # ZOO Project documentation build configuration file |
---|
4 | |
---|
5 | import re |
---|
6 | import sphinx |
---|
7 | |
---|
8 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo','sphinx.ext.autosummary', 'sphinx.ext.extlinks','sphinx.ext.viewcode'] |
---|
9 | master_doc = 'index' |
---|
10 | templates_path = ['_templates'] |
---|
11 | exclude_patterns = ['_build'] |
---|
12 | |
---|
13 | # General information |
---|
14 | |
---|
15 | project = 'ZOO-Project' |
---|
16 | copyright = '2009-2015, ZOO-Project team' |
---|
17 | version = '1.0' |
---|
18 | release = '1.5' |
---|
19 | show_authors = True |
---|
20 | |
---|
21 | # Options for HTML output |
---|
22 | |
---|
23 | html_theme = 'sphinx_rtd_theme' |
---|
24 | html_theme_path = ['_themes'] |
---|
25 | modindex_common_prefix = ['sphinx.'] |
---|
26 | html_static_path = ['_static'] |
---|
27 | html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']} |
---|
28 | #html_additional_pages = {'index': 'index.html'} |
---|
29 | html_use_opensearch = 'http://sphinx-doc.org' |
---|
30 | htmlhelp_basename = 'Sphinxdoc' |
---|
31 | |
---|
32 | # Options for epub output |
---|
33 | |
---|
34 | epub_theme = 'epub' |
---|
35 | epub_basename = 'ZOO-Project' |
---|
36 | epub_author = 'ZOO-Project team' |
---|
37 | epub_publisher = 'http://zoo-project.org/' |
---|
38 | epub_scheme = 'url' |
---|
39 | epub_identifier = 'http://zoo-project.org' |
---|
40 | epub_pre_files = [('index.html', 'ZOO-Project documentation')] |
---|
41 | epub_post_files = [('install.html', 'Installing Sphinx'),('develop.html', 'Sphinx development')] |
---|
42 | epub_exclude_files = ['_static/opensearch.xml', '_static/doctools.js','_static/jquery.js', '_static/searchtools.js','_static/underscore.js', '_static/basic.css','search.html', '_static/websupport.js'] |
---|
43 | epub_fix_images = False |
---|
44 | epub_max_image_width = 0 |
---|
45 | epub_show_urls = 'inline' |
---|
46 | epub_use_index = False |
---|
47 | epub_guide = (('toc', 'index.html', u'Table of Contents'),) |
---|
48 | |
---|
49 | # Options for LaTeX output |
---|
50 | |
---|
51 | latex_documents = [('contents', 'ZOO-Project.tex', 'ZOO-Project Documentation','ZOO-Project team', 'manual', 1)] |
---|
52 | latex_logo = '_static/zoo_simple.png' |
---|
53 | latex_elements = {'fontpkg': '\\usepackage{palatino}'} |
---|
54 | latex_show_urls = 'footnote' |
---|
55 | todo_include_todos = True |
---|
56 | man_pages = [('index', 'zooproject', 'ZOO-Project Documentation','ZOO-Project team', 1)] |
---|
57 | |
---|
58 | # -- Extension interface ------------------------------------------------------- |
---|
59 | |
---|
60 | from sphinx import addnodes # noqa |
---|
61 | |
---|
62 | event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)') |
---|
63 | |
---|
64 | |
---|
65 | def parse_event(env, sig, signode): |
---|
66 | m = event_sig_re.match(sig) |
---|
67 | if not m: |
---|
68 | signode += addnodes.desc_name(sig, sig) |
---|
69 | return sig |
---|
70 | name, args = m.groups() |
---|
71 | signode += addnodes.desc_name(name, name) |
---|
72 | plist = addnodes.desc_parameterlist() |
---|
73 | for arg in args.split(','): |
---|
74 | arg = arg.strip() |
---|
75 | plist += addnodes.desc_parameter(arg, arg) |
---|
76 | signode += plist |
---|
77 | return name |
---|
78 | |
---|
79 | |
---|
80 | def setup(app): |
---|
81 | from sphinx.ext.autodoc import cut_lines |
---|
82 | from sphinx.util.docfields import GroupedField |
---|
83 | app.connect('autodoc-process-docstring', cut_lines(4, what=['module'])) |
---|
84 | app.add_object_type('confval', 'confval', |
---|
85 | objname='configuration value', |
---|
86 | indextemplate='pair: %s; configuration value') |
---|
87 | fdesc = GroupedField('parameter', label='Parameters', |
---|
88 | names=['param'], can_collapse=True) |
---|
89 | app.add_object_type('event', 'event', 'pair: %s; event', parse_event, |
---|
90 | doc_field_types=[fdesc]) |
---|