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