2 # -*- coding: utf-8 -*-
7 extensions = [ 'sphinx.ext.autodoc' ]
9 # The suffix of source filenames.
10 source_suffix = '.rst'
12 # The master toctree document.
15 # General information about the project.
17 copyright = u'2009-2022, Carl Worth and many others'
19 location = os.path.dirname(__file__)
21 for pathdir in ['.', '..']:
22 version_file = os.path.join(location,pathdir,'version.txt')
23 if os.path.exists(version_file):
24 with open(version_file,'r') as infile:
25 version=infile.read().replace('\n','')
28 sys.path.insert(0, os.path.join(location, '..', 'bindings', 'python-cffi', 'build', 'stage'))
30 # read generated config
31 for pathdir in ['.', '..']:
32 conf_file = os.path.join(location,pathdir,'sphinx.config')
33 if os.path.exists(conf_file):
34 with open(conf_file,'r') as infile:
35 exec(''.join(infile.readlines()))
37 # The full version, including alpha/beta/rc tags.
40 # List of patterns, relative to source directory, that match files and
41 # directories to ignore when looking for source files.
42 exclude_patterns = ['_build']
44 if tags.has('WITH_EMACS'):
45 # Hacky reimplementation of include to workaround limitations of
47 lines = ['.. include:: /../emacs/rstdoc.rsti\n\n'] # in the source tree
48 for file in ('notmuch.rsti', 'notmuch-lib.rsti', 'notmuch-hello.rsti', 'notmuch-show.rsti', 'notmuch-tag.rsti', 'notmuch-tree.rsti'):
49 lines.extend(open(rsti_dir+'/'+file))
50 rst_epilog = ''.join(lines)
53 # If we don't have emacs (or the user configured --without-emacs),
54 # don't build the notmuch-emacs docs, as they need emacs to generate
55 # the docstring include files
56 exclude_patterns.append('notmuch-emacs.rst')
58 if not tags.has('WITH_PYTHON'):
59 exclude_patterns.append('python-bindings.rst')
61 # The name of the Pygments (syntax highlighting) style to use.
62 pygments_style = 'sphinx'
64 # -- Options for HTML output ----------------------------------------------
66 # The theme to use for HTML and HTML Help pages. See the documentation for
67 # a list of builtin themes.
68 html_theme = 'default'
71 # Add any paths that contain custom static files (such as style sheets) here,
72 # relative to this directory. They are copied after the builtin static files,
73 # so a file named "default.css" will overwrite the builtin "default.css".
76 # Output file base name for HTML help builder.
77 htmlhelp_basename = 'notmuchdoc'
79 # Disable SmartyPants, as it mangles command lines.
80 # Despite the name, this actually affects manual pages as well.
81 html_use_smartypants = False
84 # - https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-manpages_url
85 # - https://manpages.debian.org/
86 manpages_url = 'https://manpages.debian.org/{page}.{section}.html'
88 # -- Options for manual page output ---------------------------------------
90 # One entry per manual page. List of tuples
91 # (source start file, name, description, authors, manual section).
93 notmuch_authors = u'Carl Worth and many others'
95 man_make_section_directory = False
98 ('man1/notmuch', 'notmuch',
99 u'thread-based email index, search, and tagging',
100 [notmuch_authors], 1),
102 ('man1/notmuch-address', 'notmuch-address',
103 u'output addresses from matching messages',
104 [notmuch_authors], 1),
106 ('man1/notmuch-compact', 'notmuch-compact',
107 u'compact the notmuch database',
108 [notmuch_authors], 1),
110 ('man1/notmuch-config', 'notmuch-config',
111 u'access notmuch configuration file',
112 [notmuch_authors], 1),
114 ('man1/notmuch-count', 'notmuch-count',
115 u'count messages matching the given search terms',
116 [notmuch_authors], 1),
118 ('man1/notmuch-dump', 'notmuch-dump',
119 u'creates a plain-text dump of the tags of each message',
120 [notmuch_authors], 1),
122 ('man1/notmuch-emacs-mua', 'notmuch-emacs-mua',
123 u'send mail with notmuch and emacs',
124 [notmuch_authors], 1),
126 ('man1/notmuch-git', 'notmuch-git',
127 u'manage notmuch tags with git',
128 [notmuch_authors], 1),
130 ('man1/notmuch-git', 'nmbug',
131 u'manage notmuch bugs with git',
132 [notmuch_authors], 1),
134 ('man5/notmuch-hooks', 'notmuch-hooks',
135 u'hooks for notmuch',
136 [notmuch_authors], 5),
138 ('man1/notmuch-insert', 'notmuch-insert',
139 u'add a message to the maildir and notmuch database',
140 [notmuch_authors], 1),
142 ('man1/notmuch-new', 'notmuch-new',
143 u'incorporate new mail into the notmuch database',
144 [notmuch_authors], 1),
146 ('man7/notmuch-properties', 'notmuch-properties',
147 u'notmuch message property conventions and documentation',
148 [notmuch_authors], 7),
150 ('man1/notmuch-reindex', 'notmuch-reindex',
151 u're-index matching messages',
152 [notmuch_authors], 1),
154 ('man1/notmuch-reply', 'notmuch-reply',
155 u'constructs a reply template for a set of messages',
156 [notmuch_authors], 1),
158 ('man1/notmuch-restore', 'notmuch-restore',
159 u'restores the tags from the given file (see notmuch dump)',
160 [notmuch_authors], 1),
162 ('man1/notmuch-search', 'notmuch-search',
163 u'search for messages matching the given search terms',
164 [notmuch_authors], 1),
166 ('man7/notmuch-search-terms', 'notmuch-search-terms',
167 u'syntax for notmuch queries',
168 [notmuch_authors], 7),
170 ('man1/notmuch', 'notmuch-setup',
171 u'getting started with notmuch',
172 [notmuch_authors], 1),
174 ('man7/notmuch-sexp-queries', 'notmuch-sexp-queries',
175 u's-expression syntax for notmuch queries',
176 [notmuch_authors], 7),
178 ('man1/notmuch-show', 'notmuch-show',
179 u'show messages matching the given search terms',
180 [notmuch_authors], 1),
182 ('man1/notmuch-tag', 'notmuch-tag',
183 u'add/remove tags for all messages matching the search terms',
184 [notmuch_authors], 1),
187 # If true, show URL addresses after external links.
188 #man_show_urls = False
190 # -- Options for Texinfo output -------------------------------------------
192 # Grouping the document tree into Texinfo files. List of tuples
193 # (source start file, target name, title, author,
194 # dir menu entry, description, category)
195 # If true, do not generate a @detailmenu in the "Top" node's menu.
196 texinfo_no_detailmenu = True
198 texinfo_documents = [
199 ('notmuch-emacs', 'notmuch-emacs', u'notmuch-emacs documentation',
200 notmuch_authors, 'notmuch-emacs',
201 'emacs based front-end for notmuch', 'Miscellaneous'),
204 # generate texinfo list from man page list
205 texinfo_documents += [
207 x[0], # source start file
209 x[1] + u' documentation', # title
211 x[1], # dir menu entry
213 'Miscellaneous' # category
214 ) for x in man_pages]
217 import docutils.nodes
218 # define nmconfig role and directive for config items.
219 app.add_object_type('nmconfig','nmconfig',
220 indextemplate='pair: configuration item; %s',
221 ref_nodeclass=docutils.nodes.generated)