Short description
(Moved from another page. The feature request would be to have a nice mechanism for "contributing" stylesheets to a page from macros, somewhat like adding stylesheet definitions to a theme's stylesheets family of attributes. The output HTML would then incorporate these stylesheets and thus style macro-introduced HTML properly. Currently, I have to manually add stylesheet inclusion to various theme stylesheets such as screen.css in anticipation that the macro-related styles will be needed, but this isn't very desirable from a deployment perspective.)
Is there a generic mechanism for macros (or anything not writing the output from scratch) to add stylesheet references to a page? This would solve deployment problems with extensions where they provide additional styles, but where such styles have to be incorporated somehow into existing themes. -- PaulBoddie 2010-03-10 16:55:47 and -- PaulBoddie 2010-03-10 23:13:03
A slightly reworded version of the above elicited the following response.
I think no (i mean, no special mechanism; may be it will be added easily when plugins become classes), but you can add new styles via js. -- EugeneSyromyatnikov 2010-03-10 20:23:15 or you can use the html_head var. Below an example for arnica:
html_head = ''' <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="%(url_prefix_static)s/arnica/css/text_x_arnica.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="%(url_prefix_static)s/arnica/css/arnica_slides.css"> <!-- css only for MSIE browsers --> <!--[if IE]> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="%(url_prefix_static)s/arnica/css/msie_arnica_slides.css"> <![endif]--> ''' % {"url_prefix_static": DefaultConfig.url_prefix_static}
Using html_head places the style sheet near the top of the <head>, not a good position if you are trying to override css. I have used page_header1 to load javascript. I think this may work for css as well. The placement for page_header1 is in the <body> section just before the wiki page content.
-- RogerHaase 2010-03-12 15:10:20