comparison doc/conf.py @ 163:ff03cdf36139

The README.txt should be in the most important parts readable without keyword substitutions. The release number ist now directly included. Distinguish between the release date "release_date" and the build date of the documentation "today".
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 14 Mar 2019 00:13:59 +0100
parents f7114e4f3938
children b5ce9a8461bf
comparison
equal deleted inserted replaced
162:4ce8ff2af612 163:ff03cdf36139
10 10
11 # If extensions (or modules to document with autodoc) are in another directory, 11 # If extensions (or modules to document with autodoc) are in another directory,
12 # add these directories to sys.path here. If the directory is relative to the 12 # add these directories to sys.path here. If the directory is relative to the
13 # documentation root, use os.path.abspath to make it absolute, like shown here. 13 # documentation root, use os.path.abspath to make it absolute, like shown here.
14 # 14 #
15 import datetime
15 import os 16 import os
16 import sys 17 import sys
17 sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) 18 sys.path.insert(0, os.path.dirname(os.path.abspath('.')))
18 19
19 import configmix 20 import configmix
28 29
29 # The short X.Y version 30 # The short X.Y version
30 version = '.'.join(configmix.__version__.split('.')[:2]) 31 version = '.'.join(configmix.__version__.split('.')[:2])
31 # The full version, including alpha/beta/rc tags 32 # The full version, including alpha/beta/rc tags
32 release = configmix.__version__ 33 release = configmix.__version__
33 34 release_date = configmix.__date__
34 today = '$Date$' 35
35 if len(today) == 6 \ 36 today = datetime.date.today().isoformat()
36 and today[0] == '$' and today[1:-2] == 'Date' \
37 and today[-1] == '$':
38 del today
39 else:
40 today = today[7:today.find(' ', 7)]
41 37
42 38
43 # -- General configuration --------------------------------------------------- 39 # -- General configuration ---------------------------------------------------
44 40
45 # If your documentation needs a minimal Sphinx version, state it here. 41 # If your documentation needs a minimal Sphinx version, state it here.
93 # 89 #
94 #html_theme = 'alabaster' 90 #html_theme = 'alabaster'
95 html_theme = 'haiku' 91 html_theme = 'haiku'
96 # for the Haiku title 92 # for the Haiku title
97 html_short_title = u("%s %s") % (project, release) 93 html_short_title = u("%s %s") % (project, release)
94 html_last_updated_fmt = "%s (rev %s)" % (today, configmix.__revision__)
98 95
99 # Theme options are theme-specific and customize the look and feel of a theme 96 # Theme options are theme-specific and customize the look and feel of a theme
100 # further. For a list of options available for each theme, see the 97 # further. For a list of options available for each theme, see the
101 # documentation. 98 # documentation.
102 # 99 #
213 210
214 211
215 # -- Options for changelog --------------------------------------------------- 212 # -- Options for changelog ---------------------------------------------------
216 213
217 changelog_inner_tag_sort = ['breaking', 'feature', 'bugfix', 'test', 'doc'] 214 changelog_inner_tag_sort = ['breaking', 'feature', 'bugfix', 'test', 'doc']
215
216
217 def setup(app):
218 #
219 # Custom release_date variable with a custom substitution |release_date|
220 #
221 app.add_config_value('release_date', '', 'env')
222
223 import sphinx.transforms
224
225 class IAMCustomSubstitutions(sphinx.transforms.SphinxTransform):
226
227 default_priority = sphinx.transforms.DefaultSubstitutions.default_priority
228 def apply(self):
229 from docutils import nodes
230 for ref in self.document.traverse(nodes.substitution_reference):
231 refname = ref['refname']
232 if refname == 'release_date':
233 stext = self.config[refname]
234 ref.replace_self(nodes.Text(stext, stext))
235
236 app.add_transform(IAMCustomSubstitutions)