TitleWiki Content Specific CSS Extensions
Date31-Oct-2005 11:51:16 EET
JSPWiki version2.2.28
SubmitterGregorHagedorn
Idea CategoryGenericIdea
Reference
Idea StatusNewIdea

I run into situations where the Wiki content authors need to extend the stylesheet by special styles they define (and use through the double % or in Wiki webs that enable html).

A special wiki page (e.g . "WikiSpecialCSS") that would contain CSS definitions and would automatically be added to any template (default or ContributedTemplate) would solve this.

Note that for those running a MultipleWiki setup an n:m relation between wiki content webs and templates exist! It is therefore important that the content related CSS extension are not part of the template definition.

Furthermore, content related issues are and should be handled by a different group of people than setup/software related issues. The content editors take responsibility for the content of one specific Wiki web. They should not need to bother the server administrators whenever a content-related change is required.

  • Aside: One reason why extra styling is required is OWL/web ontology issues, where logical markup shall be added to content and links!

My preferred proposal is to keep the CSS extensions in a Wiki page, directly editable. I think providing the CSS in an attachment is less desirable.

The content of "WikiSpecialCSS" would ideally be validated against a CSS validator, but I am not sure one is readily available under Java to be integrated into JSPWiki. Also some caching of validation status would probably be desirable, to avoid validation on every page call. To me it would be acceptable to fix the name of the page that is included and validated in the property file; this would make it simple to watch and validate only this page.

The separation of different media types (print, screen etc.) would not be affected.

Note that one problem of doing this now on a template basis is that one would have to give up the browser-specific CSS selection. Unfortunately because the JavaScript browser selection is the LAST CSS loaded, it overwrites the user styles. The implementation of this idea would be simplified by some server-side handling of CSS selection, see also Bug CSSINCLUDE.JS Doesnt Work Recurring Bug.

-- Gregor Hagedorn, 2005-10-28

(Above and following comment refactored from Bug CSSINCLUDE.JS Doesnt Work Recurring Bug.)

The insertion of additional CSS stylesheets by Wiki users, without having to restart or redeploy your webapp. (the notion of a WikiSpecialCSS) would be a great feature to allow users to add customised css classes and share them consistently across different pages.

In my opinion, this additional stylesheet should be inserted BEFORE any of the other .css in order to avoid that it overwrites crucial stylesheet definitions of the wiki deployment. By doing so, a user can only add new css classes with specific styles. (there is no need for a server side validator)

However, there are several ways of doing this :

  1. Have user-specific stylesheet on a wiki-site basis, settable as UserPreference. Not of many use I believe.
  2. Have user-specific stylesheets on a per page basis. E.g. something like [{SET css='other wiki page' }]
    Notice that when a wiki page is used to contain css definitions, it might not render properly. Moreover, some pre-processing might be useful; such as url(...) definitions for e.g. background pictures should preferably point to wiki pages or attachments, ...

--DF


  1. Whether the content stylesheet should be added before or after the template stylesheet is truly debatable. My situations, which involves preserving formatting and layout of content for html-enabled wikis would not be solved by inserting the content stylesheet before the template stylesheet, the template settings would overwrite the content settings and destroy the layout. But I agree that both situations may be desirable, for non-html wikis probably the template should overwrite indeed.
  2. Whether CSS validation is desirable or not depends on whether enabling full CSS is a potential security risk. From the changes made to JSPWiki in regard to double-percent formatting I suspect so, but I am no expert.
  3. However, most importantly, the idea is not about user-specific stylesheets. It is about content-specific styles, where the scope is a Wiki web, not a single page. Such styles may simple add formatting, but foremost they could add logical markup to text. For example, we need classes to markup taxon names for host and pathogens, literature citations, and taxonomic authors inside a complex text. This markup is different for different content Wiki all of which use the same JSPWiki templates.

-- Gregor Hagedorn, 2005-10-31


This could be relatively easily by implementing the solution as in BugAutomaticallyLoadPluginWithoutChangingSearchpathInJspwiki.properties. A simple PageFilter or a WikiPlugin would then load the CSS from a page and insert it using this mechanism.

-- JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-3) was last changed on 27-Jul-2010 15:29 by 孙兵