Opened 10 years ago

Closed 10 years ago

# Separate CSS stylesheet

Reported by: Owned by: Andrej Tokarčík Andrej Tokarčík normal ProgressMeterMacro normal androsis@… 0.11

### Description

Actually, ProgressMeterMacro puts the required CSS styles into a wiki page every time the macro is called. Solve this by importing separate stylesheet for CSS styles used by macro.

### comment:1 follow-up:  2 Changed 10 years ago by Andrej Tokarčík

Resolution: → wontfix new → closed

This enhancement can't be done, AFAIK, because importing of separate CSS styles is possible just for plugins which define new URL handlers. And because this is _macro_ plugin, it is used within wiki pages -- but they (the wiki pages) have predefined handler (the wiki handler handle all '/wiki/*' requests) so we don't define new handler and because of that we can't import the separate CSS stylesheets.

If you know any other way how to solve this, let me know ;-)

### comment:2 in reply to:  1 Changed 10 years ago by Odd Simon Simonsen

If you know any other way how to solve this, let me know ;-)

I know nothing about this plugin, just wanting to mention that adding a stylesheet from a macro is doable and supported - Trac does this itself for many purposes. Like if you add a {{{#!diff}}} processor (=macro), it will also add the stylesheet needed to support inline viewing of patches regardless of what handler it is in.

from trac.web.chrome import add_stylesheet


You also need to extend the ITemplateProvider interface to make a named htdocs location available so your sheet can be located (if not done already).

As an example, I also add a stylesheet in a macro that is part of the fullblogplugin.

### comment:3 Changed 10 years ago by Andrej Tokarčík

Resolution: wontfix closed → reopened

Thanks for information and pointing at your plugin -- I have looked for a macro which includes separate stylesheets! I will look at this problem again, trying to get it done using your solution. Thanks!

### comment:4 Changed 10 years ago by Andrej Tokarčík

Resolution: → fixed reopened → closed

(In [3298]) ProgressMeterMacro: Using separate CSS, fixes #2377 (v0.1)

### Modify Ticket

Change Properties