summaryrefslogtreecommitdiff
path: root/sphinx/builders/changes.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-02-21 17:17:21 +0100
committerGeorg Brandl <georg@python.org>2009-02-21 17:17:21 +0100
commit0cbd0ddc0d9e094e3f15956ed6f9e1841d1381ad (patch)
tree4ced4737260993cc56ff13422db8b365270fc3ef /sphinx/builders/changes.py
parent01bf7e7470533b166349ac98b6941ee899153609 (diff)
downloadsphinx-0cbd0ddc0d9e094e3f15956ed6f9e1841d1381ad.tar.gz
Fix the serializing and changes builders, and really test them.
Diffstat (limited to 'sphinx/builders/changes.py')
-rw-r--r--sphinx/builders/changes.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py
index d4520fa5..e07b06d8 100644
--- a/sphinx/builders/changes.py
+++ b/sphinx/builders/changes.py
@@ -15,7 +15,8 @@ from os import path
from cgi import escape
from sphinx import package_dir
-from sphinx.util import ensuredir, os_path
+from sphinx.util import ensuredir, os_path, copy_static_entry
+from sphinx.theming import Theme
from sphinx.builders import Builder
from sphinx.util.console import bold
@@ -27,7 +28,10 @@ class ChangesBuilder(Builder):
name = 'changes'
def init(self):
- self.init_templates()
+ self.create_template_bridge()
+ Theme.init_themes(self)
+ self.theme = Theme('default')
+ self.templates.init(self, self.theme)
def get_outdated_docs(self):
return self.outdir
@@ -44,11 +48,13 @@ class ChangesBuilder(Builder):
apichanges = []
otherchanges = {}
if version not in self.env.versionchanges:
- self.info(bold('no changes in this version.'))
+ self.info(bold('no changes in version %s.' % version))
return
self.info(bold('writing summary file...'))
for type, docname, lineno, module, descname, content in \
self.env.versionchanges[version]:
+ if isinstance(descname, tuple):
+ descname = descname[0]
ttext = self.typemap[type]
context = content.replace('\n', ' ')
if descname and docname.startswith('c-api'):
@@ -129,12 +135,15 @@ class ChangesBuilder(Builder):
f.write(self.templates.render('changes/rstsource.html', ctx))
finally:
f.close()
- shutil.copyfile(path.join(package_dir, 'themes', 'default',
- 'static', 'default.css'),
- path.join(self.outdir, 'default.css'))
- shutil.copyfile(path.join(package_dir, 'themes', 'basic',
- 'static', 'basic.css'),
- path.join(self.outdir, 'basic.css'))
+ themectx = dict(('theme_' + key, val) for (key, val) in
+ self.theme.get_options({}).iteritems())
+ copy_static_entry(path.join(package_dir, 'themes', 'default',
+ 'static', 'default.css_t'),
+ path.join(self.outdir, 'default.css_t'),
+ self, themectx)
+ copy_static_entry(path.join(package_dir, 'themes', 'basic',
+ 'static', 'basic.css'),
+ path.join(self.outdir, 'basic.css'), self)
def hl(self, text, version):
text = escape(text)