summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-root/conf.py
blob: 25c723b8cca47a8387bf93585909c7a764d8f7a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import os
import sys

from docutils import nodes
from docutils.parsers.rst import Directive

from sphinx import addnodes

sys.path.append(os.path.abspath('.'))

extensions = ['sphinx.ext.autodoc',
              'sphinx.ext.todo',
              'sphinx.ext.coverage',
              'sphinx.ext.extlinks']

jsmath_path = 'dummy.js'

templates_path = ['_templates']

source_suffix = {
    '.txt': 'restructuredtext',
    '.foo': 'foo',
}

project = 'Sphinx <Tests>'
copyright = '1234-6789, copyright text credits'
# If this is changed, remember to update the versionchanges!
version = '0.6'
release = '0.6alpha1'
today_fmt = '%B %d, %Y'
exclude_patterns = ['_build', '**/excluded.*']
keep_warnings = True
pygments_style = 'sphinx'
show_authors = True
numfig = True

html_sidebars = {'**': ['localtoc.html', 'relations.html', 'sourcelink.html',
                        'customsb.html', 'searchbox.html'],
                 'index': ['contentssb.html', 'localtoc.html', 'globaltoc.html']}
html_last_updated_fmt = '%b %d, %Y'
html_context = {'hckey': 'hcval', 'hckey_co': 'wrong_hcval_co'}

latex_additional_files = ['svgimg.svg']
# some random pdf layout parameters to check they don't break build
latex_elements = {
    'sphinxsetup': """
  verbatimwithframe,
  verbatimwrapslines,
  verbatimforcewraps,
  verbatimmaxoverfull=1,
  verbatimmaxunderfull=5,
  verbatimhintsturnover=true,
  verbatimcontinuesalign=l,
  VerbatimColor={RGB}{242,242,242},
  VerbatimBorderColor={RGB}{32,32,32},
  VerbatimHighlightColor={RGB}{200,200,200},
  pre_box-decoration-break=slice,
  pre_border-top-left-radius=20pt,
  pre_border-top-right-radius=0pt,
  pre_border-bottom-right-radius=20pt,
  pre_border-bottom-left-radius=0pt,
  verbatimsep=1pt,
  pre_padding=5pt,% alias to verbatimsep
  pre_border-top-width=5pt,
  pre_border-right-width=10pt,
  pre_border-bottom-width=15pt,
  pre_border-left-width=20pt,
  pre_border-width=3pt,% overrides all previous four
  verbatimborder=2pt,% alias to pre_border-width
%
  shadowrule=1pt,
  shadowsep=10pt,
  shadowsize=10pt,
  div.topic_border-width=2pt,% alias to shadowrule
  div.topic_padding=6pt,% alias to shadowsep
  div.topic_box-shadow=5pt,% overrides/alias shadowsize
%
  noteBorderColor={RGB}{204,204,204},
  hintBorderColor={RGB}{204,204,204},
  importantBorderColor={RGB}{204,204,204},
  tipBorderColor={RGB}{204,204,204},
%
  noteborder=5pt,
  hintborder=5pt,
  importantborder=5pt,
  tipborder=5pt,
%
  warningborder=3pt,
  cautionborder=3pt,
  attentionborder=3pt,
  errorborder=3pt,
%
  dangerborder=3pt,
  div.danger_border-width=10pt,
  div.danger_background-TeXcolor={rgb}{0,1,0},
  div.danger_border-TeXcolor={rgb}{0,0,1},
  div.danger_box-shadow=20pt -20pt,
  div.danger_box-shadow-TeXcolor={rgb}{0.5,0.5,0.5},
%
  warningBorderColor={RGB}{255,119,119},
  cautionBorderColor={RGB}{255,119,119},
  attentionBorderColor={RGB}{255,119,119},
  dangerBorderColor={RGB}{255,119,119},
  errorBorderColor={RGB}{255,119,119},
  warningBgColor={RGB}{255,238,238},
  cautionBgColor={RGB}{255,238,238},
  attentionBgColor={RGB}{255,238,238},
  dangerBgColor={RGB}{255,238,238},
  errorBgColor={RGB}{255,238,238},
%
  TableRowColorHeader={rgb}{0,1,0},
  TableRowColorOdd={rgb}{0.5,0,0},
  TableRowColorEven={rgb}{0.1,0.1,0.1},
""",
}

coverage_c_path = ['special/*.h']
coverage_c_regexes = {'function': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'}

extlinks = {'issue': ('https://bugs.python.org/issue%s', 'issue %s'),
            'pyurl': ('https://python.org/%s', None)}

# modify tags from conf.py
tags.add('confpytag')


# -- extension API
def userdesc_parse(env, sig, signode):
    x, y = sig.split(':')
    signode += addnodes.desc_name(x, x)
    signode += addnodes.desc_parameterlist()
    signode[-1] += addnodes.desc_parameter(y, y)
    return x


class ClassDirective(Directive):
    option_spec = {'opt': lambda x: x}

    def run(self):
        return [nodes.strong(text='from class: %s' % self.options['opt'])]


def setup(app):
    import parsermod

    app.add_directive('clsdir', ClassDirective)
    app.add_object_type('userdesc', 'userdescrole', '%s (userdesc)',
                        userdesc_parse, objname='user desc')
    app.add_js_file('file://moo.js')
    app.add_source_suffix('.foo', 'foo')
    app.add_source_parser(parsermod.Parser)