Allow each page to select its own CSS and theme
Until now each known user is allowed to choose the theme and CSS in the user preferences. It fits to the philosophy of moin to allow a user specific customization. This request asks fo a page specific customization addressing the anonymous user.
This easily could be managed with the following two lines:
Background: In our faculty we have a lot of little groups. Each of them is proud of its own (more ore less individual) corporate identity. Many of our groups would appreciate to migrate to one common wiki (one wiki, no wiki farm) -- if and only if they are the sovereign about the layout of their own pages.
Isn't "owning" pages a little against the WikiWay?
- Of course not: Even if we belong all to the same community, each of us wants to be an individual :-). But seriously: I have to respect that our faculty consists of many small self-confident groups. The acceptance of the wiki depends heavily on subtle distinguishing features. I do not have the position to preach egalitarianism, even if i would like it. More generally spoken: I'd like to set up not a wiki for a group, but a wiki for group of groups.
Anyways, you can do something similar using the SectionParser. Just put #format section and #class StyleName on the page, and then in the CSS use that class names to make different layouts.
- Hm: changing a skin is a quite different task to changing
a parser? jbusse
- Try the advice you got, it will answer your question...
Possible Solution: add custom pragmas
e.g.:
#pragma css http://example.com/css/group-a.css
Then add your custom theme that adds the custom css of the page to the head. You will have to override the method html_stylesheets in your theme, and insert the page css link before the user css link. Check FaviconTheme to learn how to get page pragmas in a theme.
A #!css parser that wold allow you to put any style into the current page's header could be even more convenient.
You mean new processing instruction, not parser, there is nothing to parse here.
Well, I mean a plugin that you'd put into data/plugin/parser directory and call with the {{{#!css }}} syntax. I think they are called parsers in MoinMoin. It would obviously need some backing up in the theme and probably in the request -- to communicate with the theme, so it's not only plugin alone. But what user sees is a "parser", in the MoinMoin sense of that word.
The theme can't use what the parser define for css link creation. The css links are created before the parser parse the text, or the parser parsed the text long time ago when the page was cached, and the value of the #css is not available.
The sane way to add this is pragma, which requires only a custom theme, possibly one method theme.
At least you can put the css on the pages and use action=raw to include them with such a pragma. I think it's a good compromise.
- There is one problem with this hack, moin returns text/plain mimetype for action=raw, and Firefox will not accept the css without text/css mimetype. You are right. I will try it! thanks jbusse
Me: "Allow me a prospect" ... You: "Open a new page about this" ... Me: "done: see FeatureRequests/PipelineArchitecture
- There is one problem with this hack, moin returns text/plain mimetype for action=raw, and Firefox will not accept the css without text/css mimetype. You are right. I will try it! thanks jbusse