# HG changeset patch # User Franz Glasner # Date 1552518839 -3600 # Node ID ff03cdf36139dd8a00ace3228e72d73045061def # Parent 4ce8ff2af61233fd0ad87b78de0028653bb336d8 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". diff -r 4ce8ff2af612 -r ff03cdf36139 .hgkwarchive --- a/.hgkwarchive Thu Feb 21 23:25:15 2019 +0100 +++ b/.hgkwarchive Thu Mar 14 00:13:59 2019 +0100 @@ -1,4 +1,4 @@ [patterns] -configmix/**.py = +configmix/**.py = RCS, reST path:README.txt = reST path:doc/conf.py = diff -r 4ce8ff2af612 -r ff03cdf36139 README.txt --- a/README.txt Thu Feb 21 23:25:15 2019 +0100 +++ b/README.txt Thu Mar 14 00:13:59 2019 +0100 @@ -3,8 +3,8 @@ .. _README: :Author: Franz Glasner -:Version: |release| -:Date: |today| +:Version: 0.6.0.dev1 +:Date: |VCSJustDate| :Copyright: (c) 2015–2019, Franz Glasner. All rights reserved. :License: 3-clause BSD License. diff -r 4ce8ff2af612 -r ff03cdf36139 configmix/__init__.py --- a/configmix/__init__.py Thu Feb 21 23:25:15 2019 +0100 +++ b/configmix/__init__.py Thu Mar 14 00:13:59 2019 +0100 @@ -15,7 +15,8 @@ __version__ = "0.6.0.dev1" -__revision__ = "$Revision$" +__revision__ = "|VCSRevision|" +__date__ = "|VCSJustDate|" import copy diff -r 4ce8ff2af612 -r ff03cdf36139 doc/conf.py --- a/doc/conf.py Thu Feb 21 23:25:15 2019 +0100 +++ b/doc/conf.py Thu Mar 14 00:13:59 2019 +0100 @@ -12,6 +12,7 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +import datetime import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) @@ -30,14 +31,9 @@ version = '.'.join(configmix.__version__.split('.')[:2]) # The full version, including alpha/beta/rc tags release = configmix.__version__ +release_date = configmix.__date__ -today = '$Date$' -if len(today) == 6 \ - and today[0] == '$' and today[1:-2] == 'Date' \ - and today[-1] == '$': - del today -else: - today = today[7:today.find(' ', 7)] +today = datetime.date.today().isoformat() # -- General configuration --------------------------------------------------- @@ -95,6 +91,7 @@ html_theme = 'haiku' # for the Haiku title html_short_title = u("%s %s") % (project, release) +html_last_updated_fmt = "%s (rev %s)" % (today, configmix.__revision__) # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -215,3 +212,25 @@ # -- Options for changelog --------------------------------------------------- changelog_inner_tag_sort = ['breaking', 'feature', 'bugfix', 'test', 'doc'] + + +def setup(app): + # + # Custom release_date variable with a custom substitution |release_date| + # + app.add_config_value('release_date', '', 'env') + + import sphinx.transforms + + class IAMCustomSubstitutions(sphinx.transforms.SphinxTransform): + + default_priority = sphinx.transforms.DefaultSubstitutions.default_priority + def apply(self): + from docutils import nodes + for ref in self.document.traverse(nodes.substitution_reference): + refname = ref['refname'] + if refname == 'release_date': + stext = self.config[refname] + ref.replace_self(nodes.Text(stext, stext)) + + app.add_transform(IAMCustomSubstitutions)