diff options
author | gbrandl <gbrandl@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-07-07 08:20:16 +0000 |
---|---|---|
committer | gbrandl <gbrandl@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-07-07 08:20:16 +0000 |
commit | 3ddfd230e3c90c7f79426dc91aacd64efb230856 (patch) | |
tree | f01b39486274f713a8890291b10ca68ed52c85ab /sandbox/py-rest-doc/sphinx/environment.py | |
parent | ef8d4115a98e15bccba0644d08a03412bfd98ff9 (diff) | |
download | docutils-3ddfd230e3c90c7f79426dc91aacd64efb230856.tar.gz |
Implement environment reloading in the web application.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5320 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'sandbox/py-rest-doc/sphinx/environment.py')
-rw-r--r-- | sandbox/py-rest-doc/sphinx/environment.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sandbox/py-rest-doc/sphinx/environment.py b/sandbox/py-rest-doc/sphinx/environment.py index 43f809e18..2d5dac7f8 100644 --- a/sandbox/py-rest-doc/sphinx/environment.py +++ b/sandbox/py-rest-doc/sphinx/environment.py @@ -10,6 +10,7 @@ """ from __future__ import with_statement +import time import heapq import hashlib import difflib @@ -71,12 +72,16 @@ class DefaultSubstitutions(Transform): default_priority = 210 def apply(self): + config = self.document.settings.env.config # only handle those not otherwise defined in the document to_handle = default_substitutions - set(self.document.substitution_defs) for ref in self.document.traverse(nodes.substitution_reference): refname = ref['refname'] if refname in to_handle: - text = self.document.settings.env.config.get(refname, '') + text = config.get(refname, '') + if refname == 'today' and not text: + # special handling: can also specify a strftime format + text = time.strftime(config.get('today_fmt', '%B %d, %Y')) ref.replace_self(nodes.Text(text, text)) |