]>
Commit | Line | Data |
---|---|---|
42fc5d26 QY |
1 | # -*- coding: utf-8 -*- |
2 | # | |
3 | # FRR documentation build configuration file, created by | |
4 | # sphinx-quickstart on Tue Jan 31 16:00:52 2017. | |
5 | # | |
6 | # This file is execfile()d with the current directory set to its | |
7 | # containing dir. | |
8 | # | |
9 | # Note that not all possible configuration values are present in this | |
10 | # autogenerated file. | |
11 | # | |
12 | # All configuration values have a default; values that are commented out | |
13 | # serve to show the default. | |
14 | ||
15 | import sys | |
16 | import os | |
17 | import re | |
d5403d4f QY |
18 | import pygments |
19 | from sphinx.highlighting import lexers | |
42fc5d26 QY |
20 | |
21 | # If extensions (or modules to document with autodoc) are in another directory, | |
22 | # add these directories to sys.path here. If the directory is relative to the | |
23 | # documentation root, use os.path.abspath to make it absolute, like shown here. | |
24 | #sys.path.insert(0, os.path.abspath('.')) | |
25 | ||
26 | # -- General configuration ------------------------------------------------ | |
27 | ||
28 | # If your documentation needs a minimal Sphinx version, state it here. | |
964b3662 QY |
29 | needs_sphinx = '1.0' |
30 | ||
31 | # prolog for various variable substitutions | |
32 | rst_prolog = '' | |
42fc5d26 QY |
33 | |
34 | # Add any Sphinx extension module names here, as strings. They can be | |
35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | |
36 | # ones. | |
37 | extensions = ['sphinx.ext.todo'] | |
38 | ||
39 | # Add any paths that contain templates here, relative to this directory. | |
40 | templates_path = ['_templates'] | |
41 | ||
42 | # The suffix(es) of source filenames. | |
43 | # You can specify multiple suffix as a list of string: | |
964b3662 | 44 | # source_suffix = ['.rst'] |
42fc5d26 QY |
45 | source_suffix = '.rst' |
46 | ||
47 | # The encoding of source files. | |
48 | #source_encoding = 'utf-8-sig' | |
49 | ||
50 | # The master toctree document. | |
51 | master_doc = 'index' | |
52 | ||
53 | # General information about the project. | |
54 | project = u'FRR' | |
55 | copyright = u'2017, FRR' | |
aef62d25 | 56 | author = u'FRR authors' |
42fc5d26 QY |
57 | |
58 | # The version info for the project you're documenting, acts as replacement for | |
59 | # |version| and |release|, also used in various other places throughout the | |
60 | # built documents. | |
61 | ||
62 | # The short X.Y version. | |
63 | version = u'?.?' | |
64 | # The full version, including alpha/beta/rc tags. | |
65 | release = u'?.?-?' | |
66 | ||
be46d288 QY |
67 | |
68 | # ----------------------------------------------------------------------------- | |
69 | # Extract values from codebase for substitution into docs. | |
70 | # ----------------------------------------------------------------------------- | |
71 | ||
aef62d25 QY |
72 | # Various installation prefixes. Values are extracted from config.status. |
73 | # Reasonable defaults are set in case that file does not exist. | |
be46d288 | 74 | replace_vars = { |
aef62d25 | 75 | 'AUTHORS': author, |
be46d288 | 76 | 'COPYRIGHT_YEAR': '1999-2005', |
aef62d25 | 77 | 'COPYRIGHT_STR': 'Copyright (c) 1999-2005', |
be46d288 QY |
78 | 'PACKAGE_NAME': project.lower(), |
79 | 'PACKAGE_TARNAME': project.lower(), | |
aef62d25 | 80 | 'PACKAGE_STRING': project.lower() + ' latest', |
be46d288 | 81 | 'PACKAGE_URL': 'https://frrouting.org/', |
aef62d25 QY |
82 | 'PACKAGE_VERSION': 'latest', |
83 | 'INSTALL_PREFIX_ETC': '/etc/frr', | |
84 | 'INSTALL_PREFIX_SBIN': '/usr/lib/frr', | |
85 | 'INSTALL_PREFIX_STATE': '/var/run/frr', | |
86 | 'INSTALL_PREFIX_MODULES': '/usr/lib/frr/modules', | |
87 | 'INSTALL_USER': 'frr', | |
88 | 'INSTALL_GROUP': 'frr', | |
89 | 'INSTALL_VTY_GROUP': 'frrvty', | |
90 | 'GROUP': 'frr', | |
91 | 'USER': 'frr', | |
be46d288 | 92 | } |
964b3662 QY |
93 | |
94 | # extract version information, installation location, other stuff we need to | |
95 | # use when building final documents | |
42fc5d26 | 96 | val = re.compile('^S\["([^"]+)"\]="(.*)"$') |
aef62d25 QY |
97 | try: |
98 | with open('../../config.status', 'r') as cfgstatus: | |
99 | for ln in cfgstatus.readlines(): | |
100 | m = val.match(ln) | |
101 | if not m or m.group(1) not in replace_vars.keys(): continue | |
102 | replace_vars[m.group(1)] = m.group(2) | |
103 | except IOError: | |
104 | # if config.status doesn't exist, just ignore it | |
105 | pass | |
964b3662 | 106 | |
be46d288 | 107 | # manually fill out some of these we can't get from config.status |
fd810097 | 108 | replace_vars['COPYRIGHT_STR'] = "Copyright (c)" |
6c749456 QY |
109 | replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['COPYRIGHT_YEAR']) |
110 | replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['AUTHORS']) | |
fd810097 QY |
111 | release = replace_vars['PACKAGE_VERSION'] |
112 | version = release.split('-')[0] | |
964b3662 QY |
113 | |
114 | # add substitutions to prolog | |
be46d288 QY |
115 | for key, value in replace_vars.items(): |
116 | rst_prolog += '.. |{0}| replace:: {1}\n'.format(key, value) | |
964b3662 | 117 | |
42fc5d26 QY |
118 | |
119 | # The language for content autogenerated by Sphinx. Refer to documentation | |
120 | # for a list of supported languages. | |
121 | # | |
122 | # This is also used if you do content translation via gettext catalogs. | |
123 | # Usually you set "language" from the command line for these cases. | |
124 | language = None | |
125 | ||
126 | # There are two options for replacing |today|: either, you set today to some | |
127 | # non-false value, then it is used: | |
128 | #today = '' | |
129 | # Else, today_fmt is used as the format for a strftime call. | |
130 | #today_fmt = '%B %d, %Y' | |
131 | ||
132 | # List of patterns, relative to source directory, that match files and | |
133 | # directories to ignore when looking for source files. | |
00458d01 | 134 | exclude_patterns = ['_build', 'rpki.rst', 'routeserver.rst', |
be11dfbf | 135 | 'ospf_fundamentals.rst', 'flowspec.rst', 'snmptrap.rst'] |
42fc5d26 QY |
136 | |
137 | # The reST default role (used for this markup: `text`) to use for all | |
138 | # documents. | |
139 | #default_role = None | |
140 | ||
141 | # If true, '()' will be appended to :func: etc. cross-reference text. | |
142 | #add_function_parentheses = True | |
143 | ||
144 | # If true, the current module name will be prepended to all description | |
145 | # unit titles (such as .. function::). | |
146 | #add_module_names = True | |
147 | ||
148 | # If true, sectionauthor and moduleauthor directives will be shown in the | |
149 | # output. They are ignored by default. | |
150 | #show_authors = False | |
151 | ||
152 | # The name of the Pygments (syntax highlighting) style to use. | |
153 | pygments_style = 'sphinx' | |
154 | ||
155 | # A list of ignored prefixes for module index sorting. | |
156 | #modindex_common_prefix = [] | |
157 | ||
158 | # If true, keep warnings as "system message" paragraphs in the built documents. | |
159 | #keep_warnings = False | |
160 | ||
161 | # If true, `todo` and `todoList` produce output, else they produce nothing. | |
162 | todo_include_todos = True | |
163 | ||
164 | ||
165 | # -- Options for HTML output ---------------------------------------------- | |
166 | ||
167 | # The theme to use for HTML and HTML Help pages. See the documentation for | |
168 | # a list of builtin themes. | |
37ba370b | 169 | html_theme = 'default' |
42fc5d26 | 170 | |
856d02a5 DL |
171 | try: |
172 | import sphinx_rtd_theme | |
173 | ||
174 | html_theme = 'sphinx_rtd_theme' | |
175 | except ImportError: | |
176 | pass | |
177 | ||
42fc5d26 QY |
178 | # Theme options are theme-specific and customize the look and feel of a theme |
179 | # further. For a list of options available for each theme, see the | |
180 | # documentation. | |
856d02a5 DL |
181 | #html_theme_options = { |
182 | # 'sidebarbgcolor': '#374249' | |
183 | #} | |
42fc5d26 QY |
184 | |
185 | # Add any paths that contain custom themes here, relative to this directory. | |
186 | #html_theme_path = [] | |
187 | ||
188 | # The name for this set of Sphinx documents. If None, it defaults to | |
189 | # "<project> v<release> documentation". | |
190 | #html_title = None | |
191 | ||
192 | # A shorter title for the navigation bar. Default is the same as html_title. | |
193 | #html_short_title = None | |
194 | ||
195 | # The name of an image file (relative to this directory) to place at the top | |
196 | # of the sidebar. | |
2f8c365e | 197 | html_logo = '../figures/frr-icon.svg' |
42fc5d26 QY |
198 | |
199 | # The name of an image file (within the static path) to use as favicon of the | |
200 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 | |
201 | # pixels large. | |
5a32c424 | 202 | html_favicon = '../figures/frr-logo-icon.png' |
42fc5d26 QY |
203 | |
204 | # Add any paths that contain custom static files (such as style sheets) here, | |
205 | # relative to this directory. They are copied after the builtin static files, | |
206 | # so a file named "default.css" will overwrite the builtin "default.css". | |
4386f129 | 207 | html_static_path = ['_static'] |
42fc5d26 QY |
208 | |
209 | # Add any extra paths that contain custom files (such as robots.txt or | |
210 | # .htaccess) here, relative to this directory. These files are copied | |
211 | # directly to the root of the documentation. | |
212 | #html_extra_path = [] | |
213 | ||
214 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, | |
215 | # using the given strftime format. | |
216 | #html_last_updated_fmt = '%b %d, %Y' | |
217 | ||
218 | # If true, SmartyPants will be used to convert quotes and dashes to | |
219 | # typographically correct entities. | |
220 | #html_use_smartypants = True | |
221 | ||
222 | # Custom sidebar templates, maps document names to template names. | |
223 | #html_sidebars = {} | |
224 | ||
225 | # Additional templates that should be rendered to pages, maps page names to | |
226 | # template names. | |
227 | #html_additional_pages = {} | |
228 | ||
229 | # If false, no module index is generated. | |
230 | #html_domain_indices = True | |
231 | ||
232 | # If false, no index is generated. | |
233 | #html_use_index = True | |
234 | ||
235 | # If true, the index is split into individual pages for each letter. | |
236 | #html_split_index = False | |
237 | ||
238 | # If true, links to the reST sources are added to the pages. | |
239 | #html_show_sourcelink = True | |
240 | ||
241 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. | |
242 | #html_show_sphinx = True | |
243 | ||
244 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. | |
245 | #html_show_copyright = True | |
246 | ||
247 | # If true, an OpenSearch description file will be output, and all pages will | |
248 | # contain a <link> tag referring to it. The value of this option must be the | |
249 | # base URL from which the finished HTML is served. | |
250 | #html_use_opensearch = '' | |
251 | ||
252 | # This is the file name suffix for HTML files (e.g. ".xhtml"). | |
253 | #html_file_suffix = None | |
254 | ||
255 | # Language to be used for generating the HTML full-text search index. | |
256 | # Sphinx supports the following languages: | |
257 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' | |
258 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' | |
259 | #html_search_language = 'en' | |
260 | ||
261 | # A dictionary with options for the search language support, empty by default. | |
262 | # Now only 'ja' uses this config value | |
263 | #html_search_options = {'type': 'default'} | |
264 | ||
265 | # The name of a javascript file (relative to the configuration directory) that | |
266 | # implements a search results scorer. If empty, the default will be used. | |
267 | #html_search_scorer = 'scorer.js' | |
268 | ||
269 | # Output file base name for HTML help builder. | |
270 | htmlhelp_basename = 'FRRdoc' | |
271 | ||
272 | # -- Options for LaTeX output --------------------------------------------- | |
273 | ||
274 | latex_elements = { | |
275 | # The paper size ('letterpaper' or 'a4paper'). | |
276 | #'papersize': 'letterpaper', | |
277 | ||
278 | # The font size ('10pt', '11pt' or '12pt'). | |
279 | #'pointsize': '10pt', | |
280 | ||
281 | # Additional stuff for the LaTeX preamble. | |
282 | #'preamble': '', | |
283 | ||
284 | # Latex figure (float) alignment | |
285 | #'figure_align': 'htbp', | |
286 | } | |
287 | ||
288 | # Grouping the document tree into LaTeX files. List of tuples | |
289 | # (source start file, target name, title, | |
290 | # author, documentclass [howto, manual, or own class]). | |
291 | latex_documents = [ | |
292 | (master_doc, 'FRR.tex', u'FRR User Manual', | |
293 | u'FRR', 'manual'), | |
294 | ] | |
295 | ||
296 | # The name of an image file (relative to this directory) to place at the top of | |
297 | # the title page. | |
5a32c424 | 298 | latex_logo = '../figures/frr-logo-medium.png' |
42fc5d26 QY |
299 | |
300 | # For "manual" documents, if this is true, then toplevel headings are parts, | |
301 | # not chapters. | |
302 | #latex_use_parts = False | |
303 | ||
304 | # If true, show page references after internal links. | |
305 | #latex_show_pagerefs = False | |
306 | ||
307 | # If true, show URL addresses after external links. | |
308 | #latex_show_urls = False | |
309 | ||
310 | # Documents to append as an appendix to all manuals. | |
311 | #latex_appendices = [] | |
312 | ||
313 | # If false, no module index is generated. | |
314 | #latex_domain_indices = True | |
315 | ||
316 | ||
317 | # -- Options for manual page output --------------------------------------- | |
318 | ||
319 | # One entry per manual page. List of tuples | |
320 | # (source start file, name, description, authors, manual section). | |
321 | man_pages = [ | |
322 | (master_doc, 'frr', u'FRR User Manual', | |
323 | [author], 1) | |
324 | ] | |
325 | ||
326 | # If true, show URL addresses after external links. | |
327 | #man_show_urls = False | |
328 | ||
329 | ||
330 | # -- Options for Texinfo output ------------------------------------------- | |
331 | ||
332 | # Grouping the document tree into Texinfo files. List of tuples | |
333 | # (source start file, target name, title, author, | |
334 | # dir menu entry, description, category) | |
335 | texinfo_documents = [ | |
b59555c6 | 336 | (master_doc, 'frr', u'FRR User Manual', |
42fc5d26 QY |
337 | author, 'FRR', 'One line description of project.', |
338 | 'Miscellaneous'), | |
339 | ] | |
340 | ||
341 | # Documents to append as an appendix to all manuals. | |
342 | #texinfo_appendices = [] | |
343 | ||
344 | # If false, no module index is generated. | |
345 | #texinfo_domain_indices = True | |
346 | ||
347 | # How to display URL addresses: 'footnote', 'no', or 'inline'. | |
348 | #texinfo_show_urls = 'footnote' | |
349 | ||
350 | # If true, do not generate a @detailmenu in the "Top" node's menu. | |
351 | #texinfo_no_detailmenu = False | |
2731b07d | 352 | |
524ada7f QY |
353 | # contents of ../extra/frrlexer.py. |
354 | # This is read here to support VPATH build. Since this section is execfile()'d | |
355 | # with the file location, we can safely use a relative path here to save the | |
356 | # contents of the lexer file for later use even if our relative path changes | |
357 | # due to VPATH. | |
358 | with open('../extra/frrlexer.py', 'rb') as lex: | |
359 | frrlexerpy = lex.read() | |
360 | ||
2731b07d QY |
361 | # custom extensions here |
362 | def setup(app): | |
363 | # object type for FRR CLI commands, can be extended to document parent CLI | |
364 | # node later on | |
365 | app.add_object_type('clicmd', 'clicmd') | |
4386f129 QY |
366 | # css overrides for HTML theme |
367 | app.add_stylesheet('overrides.css') | |
36372632 | 368 | app.add_javascript('overrides.js') |
dff213a9 QY |
369 | # load Pygments lexer for FRR config syntax |
370 | # | |
371 | # NB: in Pygments 2.2+ this can be done with `load_lexer_from_file`, but we | |
372 | # do it manually since not all of our supported build platforms have 2.2 | |
373 | # yet. | |
374 | # | |
375 | # frrlexer = pygments.lexers.load_lexer_from_file('../extra/frrlexer.py', lexername="FRRLexer") | |
376 | custom_namespace = {} | |
524ada7f | 377 | exec(frrlexerpy, custom_namespace) |
dff213a9 | 378 | lexers['frr'] = custom_namespace['FRRLexer']() |