1#============================================================================= 2# Copyright (c) 2017 Paul Fultz II 3# conf.py 4# Distributed under the Boost Software License, Version 1.0. (See accompanying 5# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6#============================================================================== 7# -*- coding: utf-8 -*- 8# 9# Boost.HigherOrderFunctions documentation build configuration file, created by 10# sphinx-quickstart on Thu Jun 2 00:33:55 2016. 11# 12# This file is execfile()d with the current directory set to its 13# containing dir. 14# 15# Note that not all possible configuration values are present in this 16# autogenerated file. 17# 18# All configuration values have a default; values that are commented out 19# serve to show the default. 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# 25import os 26from recommonmark.parser import CommonMarkParser 27from recommonmark.transform import AutoStructify 28import sphinx_boost 29 30# -- General configuration ------------------------------------------------ 31 32# If your documentation needs a minimal Sphinx version, state it here. 33# 34# needs_sphinx = '1.0' 35 36# Add any Sphinx extension module names here, as strings. They can be 37# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 38# ones. 39extensions = [ 40 # 'sphinx.ext.autodoc', 41 # 'sphinx.ext.githubpages', 42 'sphinx.ext.autosectionlabel', 43] 44 45# Add any paths that contain templates here, relative to this directory. 46templates_path = ['_templates'] 47 48source_parsers = { 49 '.md': CommonMarkParser, 50 '.hpp': CommonMarkParser 51} 52 53# The suffix(es) of source filenames. 54# You can specify multiple suffix as a list of string: 55# 56source_suffix = ['.rst', '.md', '.hpp'] 57# source_suffix = '.rst' 58 59# The encoding of source files. 60# 61# source_encoding = 'utf-8-sig' 62 63# The master toctree document. 64master_doc = 'doc/index' 65 66# General information about the project. 67project = u'Boost.HigherOrderFunctions' 68copyright = u'2016, Paul Fultz II' 69author = u'Paul Fultz II' 70 71# The version info for the project you're documenting, acts as replacement for 72# |version| and |release|, also used in various other places throughout the 73# built documents. 74# 75 76def parse_version(): 77 lines = open('../include/boost/hof/version.hpp').readlines() 78 defines = ['BOOST_HOF_VERSION_MAJOR', 'BOOST_HOF_VERSION_MINOR', 'BOOST_HOF_VERSION_PATCH'] 79 versions = ['0','0','0'] 80 for line in lines: 81 for di, define in enumerate(defines): 82 needle = '#define ' + define 83 i = line.find(needle) 84 if i >= 0: 85 versions[di] = line[i+len(needle):].strip() 86 final_version = versions[0] + '.' + versions[1] 87 if versions[2] != '0': final_version = final_version + '.' + versions[2] 88 return final_version 89 90 91 92 93# The short X.Y version. 94version = parse_version() 95# The full version, including alpha/beta/rc tags. 96release = version 97 98# The language for content autogenerated by Sphinx. Refer to documentation 99# for a list of supported languages. 100# 101# This is also used if you do content translation via gettext catalogs. 102# Usually you set "language" from the command line for these cases. 103language = None 104 105# There are two options for replacing |today|: either, you set today to some 106# non-false value, then it is used: 107# 108# today = '' 109# 110# Else, today_fmt is used as the format for a strftime call. 111# 112# today_fmt = '%B %d, %Y' 113 114# List of patterns, relative to source directory, that match files and 115# directories to ignore when looking for source files. 116# This patterns also effect to html_static_path and html_extra_path 117exclude_patterns = [ 118 '_build', 119 'Thumbs.db', 120 '.DS_Store', 121 'README.md', 122 '**/alias.hpp', 123 '**/config.hpp', 124 '**/hof.hpp', 125 '**/static_def.hpp', 126 '**/test.hpp', 127 '**/detail/*.hpp', 128] 129 130# The reST default role (used for this markup: `text`) to use for all 131# documents. 132# 133# default_role = None 134 135# If true, '()' will be appended to :func: etc. cross-reference text. 136# 137# add_function_parentheses = True 138 139# If true, the current module name will be prepended to all description 140# unit titles (such as .. function::). 141# 142# add_module_names = True 143 144# If true, sectionauthor and moduleauthor directives will be shown in the 145# output. They are ignored by default. 146# 147# show_authors = False 148 149highlight_language = 'cpp' 150 151# The name of the Pygments (syntax highlighting) style to use. 152pygments_style = 'tango' 153 154# A list of ignored prefixes for module index sorting. 155# modindex_common_prefix = [] 156 157# If true, keep warnings as "system message" paragraphs in the built documents. 158# keep_warnings = False 159 160# If true, `todo` and `todoList` produce output, else they produce nothing. 161todo_include_todos = False 162 163 164# -- Options for HTML output ---------------------------------------------- 165 166# The theme to use for HTML and HTML Help pages. See the documentation for 167# a list of builtin themes. 168# 169# html_theme = 'alabaster' 170html_theme = 'boost' 171 172# Theme options are theme-specific and customize the look and feel of a theme 173# further. For a list of options available for each theme, see the 174# documentation. 175# 176# html_theme_options = {} 177 178# Add any paths that contain custom themes here, relative to this directory. 179html_theme_path = [sphinx_boost.get_html_theme_path()] 180 181# The name for this set of Sphinx documents. 182# "<project> v<release> documentation" by default. 183# 184# html_title = u'Boost.HigherOrderFunctions v1.0' 185 186# A shorter title for the navigation bar. Default is the same as html_title. 187# 188# html_short_title = None 189 190# The name of an image file (relative to this directory) to place at the top 191# of the sidebar. 192# 193# html_logo = 'boost-proposed.png' 194 195# The name of an image file (relative to this directory) to use as a favicon of 196# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 197# pixels large. 198# 199# html_favicon = None 200 201# Add any paths that contain custom static files (such as style sheets) here, 202# relative to this directory. They are copied after the builtin static files, 203# so a file named "default.css" will overwrite the builtin "default.css". 204html_static_path = ['_static'] 205 206# Add any extra paths that contain custom files (such as robots.txt or 207# .htaccess) here, relative to this directory. These files are copied 208# directly to the root of the documentation. 209# 210# html_extra_path = [] 211 212# If not None, a 'Last updated on:' timestamp is inserted at every page 213# bottom, using the given strftime format. 214# The empty string is equivalent to '%b %d, %Y'. 215# 216# html_last_updated_fmt = None 217 218# If true, SmartyPants will be used to convert quotes and dashes to 219# typographically correct entities. 220# 221# html_use_smartypants = True 222 223# Custom sidebar templates, maps document names to template names. 224# 225# html_sidebars = {} 226 227# Additional templates that should be rendered to pages, maps page names to 228# template names. 229# 230html_additional_pages = { 231 'index': 'redirect.html', 232} 233 234# If false, no module index is generated. 235# 236# html_domain_indices = True 237 238# If false, no index is generated. 239# 240# html_use_index = True 241 242# If true, the index is split into individual pages for each letter. 243# 244# html_split_index = False 245 246# If true, links to the reST sources are added to the pages. 247# 248html_show_sourcelink = True 249html_copy_source = True 250 251# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 252# 253# html_show_sphinx = True 254 255# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 256# 257# html_show_copyright = True 258 259# If true, an OpenSearch description file will be output, and all pages will 260# contain a <link> tag referring to it. The value of this option must be the 261# base URL from which the finished HTML is served. 262# 263# html_use_opensearch = '' 264 265# This is the file name suffix for HTML files (e.g. ".xhtml"). 266# html_file_suffix = None 267 268# Language to be used for generating the HTML full-text search index. 269# Sphinx supports the following languages: 270# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 271# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' 272# 273# html_search_language = 'en' 274 275# A dictionary with options for the search language support, empty by default. 276# 'ja' uses this config value. 277# 'zh' user can custom change `jieba` dictionary path. 278# 279# html_search_options = {'type': 'default'} 280 281# The name of a javascript file (relative to the configuration directory) that 282# implements a search results scorer. If empty, the default will be used. 283# 284# html_search_scorer = 'scorer.js' 285 286# Output file base name for HTML help builder. 287htmlhelp_basename = 'Boost.HigherOrderFunctionsdoc' 288 289# -- Options for LaTeX output --------------------------------------------- 290 291latex_elements = { 292 # The paper size ('letterpaper' or 'a4paper'). 293 # 294 # 'papersize': 'letterpaper', 295 296 # The font size ('10pt', '11pt' or '12pt'). 297 # 298 # 'pointsize': '10pt', 299 300 # Additional stuff for the LaTeX preamble. 301 # 302 # 'preamble': '', 303 304 # Latex figure (float) alignment 305 # 306 # 'figure_align': 'htbp', 307} 308 309# Grouping the document tree into LaTeX files. List of tuples 310# (source start file, target name, title, 311# author, documentclass [howto, manual, or own class]). 312latex_documents = [ 313 (master_doc, 'Boost.HigherOrderFunctions.tex', u'Boost.HigherOrderFunctions Documentation', 314 u'Paul Fultz II', 'manual'), 315] 316 317# The name of an image file (relative to this directory) to place at the top of 318# the title page. 319# 320# latex_logo = None 321 322# For "manual" documents, if this is true, then toplevel headings are parts, 323# not chapters. 324# 325# latex_use_parts = False 326 327# If true, show page references after internal links. 328# 329# latex_show_pagerefs = False 330 331# If true, show URL addresses after external links. 332# 333# latex_show_urls = False 334 335# Documents to append as an appendix to all manuals. 336# 337# latex_appendices = [] 338 339# If false, no module index is generated. 340# 341# latex_domain_indices = True 342 343 344# -- Options for manual page output --------------------------------------- 345 346# One entry per manual page. List of tuples 347# (source start file, name, description, authors, manual section). 348man_pages = [ 349 (master_doc, 'Boost.HigherOrderFunctions', u'Boost.HigherOrderFunctions Documentation', 350 [author], 1) 351] 352 353# If true, show URL addresses after external links. 354# 355# man_show_urls = False 356 357 358# -- Options for Texinfo output ------------------------------------------- 359 360# Grouping the document tree into Texinfo files. List of tuples 361# (source start file, target name, title, author, 362# dir menu entry, description, category) 363texinfo_documents = [ 364 (master_doc, 'Boost.HigherOrderFunctions', u'Boost.HigherOrderFunctions Documentation', 365 author, 'Boost.HigherOrderFunctions', 'One line description of project.', 366 'Miscellaneous'), 367] 368 369# Documents to append as an appendix to all manuals. 370# 371# texinfo_appendices = [] 372 373# If false, no module index is generated. 374# 375# texinfo_domain_indices = True 376 377# How to display URL addresses: 'footnote', 'no', or 'inline'. 378# 379# texinfo_show_urls = 'footnote' 380 381# If true, do not generate a @detailmenu in the "Top" node's menu. 382# 383# texinfo_no_detailmenu = False 384 385nitpicky = True 386 387def insert_header(lines, f): 388 for line in lines: 389 yield line 390 if line.startswith('=='): 391 yield "" 392 yield "Header" 393 yield "------" 394 yield "" 395 yield " #include <{0}>".format(f) 396 yield "" 397 398extract_prefix = '/// ' 399include_dir = os.path.abspath('../include/') 400def extract_doc(app, docname, source): 401 path = app.env.doc2path(docname) 402 if path.endswith('.hpp'): 403 lines = source[0].split('\n') 404 md = [line[len(extract_prefix):] for line in lines if line.startswith(extract_prefix)] 405 source[0] = '\n'.join(insert_header(md, os.path.relpath(path, include_dir))) 406 407# app setup hook 408def setup(app): 409 app.srcdir = os.path.abspath(os.path.join(app.srcdir, os.pardir)) 410 app.add_config_value('recommonmark_config', { 411 'enable_eval_rst': True, 412 # 'enable_auto_doc_ref': True, 413 'commonmark_suffixes': ['.md', '.hpp'], 414 }, True) 415 app.add_transform(AutoStructify) 416 app.connect('source-read', extract_doc) 417