Opened 13 years ago
Last modified 10 years ago
#10163 closed enhancement
Allow pure xml file format in trac.env_index_template (site.html) — at Initial Version
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.0 |
Component: | rendering | Version: | 0.12.2 |
Severity: | minor | Keywords: | site-customization |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In current stable version (0.12.2), 'site.html' (actually trac.env_index_template) can be in 2 formats:
- cs (ClearSilver): template is a file that ends with '.cs'
- xhtml (Genshi): anyother file
This propose of enhancement ask to allow use pure xml files in trac.env_index_template (as well as the other formats). In current trunk ClearSilver format has been eliminated, and all templates are rendered with Genshi in xhtml format. Genshi can easy render other formats.
The propose include an easy patch to allow to use pure xml files by checking file extension (similar to 0.12.2 code with .cs).
Index: trunk/trac/web/main.py =================================================================== --- a/trunk/trac/web/main.py +++ b/trunk/trac/web/main.py @@ -655,14 +655,9 @@ default_encoding='utf-8') tmpl = loader.load(template) stream = tmpl.generate(**data) - use_xml = template.endswith('.xml') - if use_xml: - output = stream.render('xml') - req.send(output, 'text/xml') - else: - output = stream.render('xhtml', doctype=DocType.XHTML_STRICT, - encoding='utf-8') - req.send(output, 'text/html') + output = stream.render('xhtml', doctype=DocType.XHTML_STRICT, + encoding='utf-8') + req.send(output, 'text/html') except RequestDone: pass