sagemath / sage_trac_plugin

Trac plugin used to support Sage development at trac.sagemath.org
5 stars 6 forks source link

Improve ticket_box template customization #3

Open embray opened 8 years ago

embray commented 8 years ago

Currently the sage_trac_plugin comes with a complete copy of the ticket_box.html macro from Trac, which includes a few Sage specific customisations.

Whether intended or not (I'm not sure) the Trac configuration on trac.sagemath.org isn't even using the copy of the template that comes with the plugin; rather there's another copy of the template in the Trac environment itself (under sage_trac/templates), and the trac.ini contains the appropriate setting to load template overrides from that path. IIRC it should be possible for the plugin to supply the template substitution directly, without this additional tweak.

However, another problem is that since it contains an entire copy of the original ticket_box.html template, this means that the template needs to be updated every time it's updated in Trac. A better way would be to use a template that includes from the original template, and uses Genshi match templates and similar tricks to insert to the Sage-specific stuff as needed. Looking at the sage-specific modifications I believe this should be straightforward.

Match templates are not a silver-bullet--the original template could still change significantly enough from one version to the next such that the match template no longer works properly. But it's less likely, and still requires less tweaking even if that does happen (most likely an XPath string needs to be updated or something).

embray commented 8 years ago

I also just remembered that the ITemplateStreamFilter interface is a thing, and may be usable for this purpose.

fchapoton commented 8 years ago

Is this related to the fact that trac currently does not use the latest version of the template available here (which prevents https to be secure) ? I would like to remove one of the three patchbot icons appearing at top-right of every ticket page. This is done in the template here, which at some point was used by trac, but no longer.

embray commented 8 years ago

The template is used, but the point of this is that the plugin itself does not actually install the updated template, which it should. Currently it has to be manually copied into the environment's custom templates directory.

fchapoton commented 8 years ago

could you please perform the manual copy, then ?