[pmwiki-users] wikistyles question
Patrick R. Michaud
pmichaud at pobox.com
Fri Nov 24 16:08:05 CST 2006
On Fri, Nov 24, 2006 at 08:56:53PM +0000, Hans wrote:
> Friday, November 24, 2006, 7:09:18 PM, Patrick wrote:
>
> > It should be noted that wikistyles can do quite a bit more
> > than CSS (and are thus not a subset). In particular, wikistyles
> > allow new styles to be created in terms of existing ones, which
> > CSS doesn't easily allow.
>
> Can you please give an example for this difference?
Sure. Essentially, CSS doesn't give me a way to create a new
class that is based on an existing one, or to combine two or
more classes to make a new one. WikiStyles lets me do that.
Here's an example...
Let's suppose I start with the following CSS classes:
.frame { border:1px solid #cccccc; padding:4px; background-color:#f9f9f9; }
.rfloat { float:right; margin-left:0.5em; }
.lrindent { margin-left:40px; margin-right:40px; }
This gives me the following wikistyled-divs:
>>frame<<
text in a bordered box with a grey background
>>rfloat<<
something right floated
>>lrindent<<
indent something by 40px on left and right margins
I can then easily create the following additional wikistyles:
%define=rframe frame rfloat%
>>rframe<< right floats something inside of a frame
%define=sidenote rframe width=200px%
>>sidenote<< is a fixed width right-floated frame
%define=postit sidenote background-color=yellow%
>>postit<< - a sidenote with a yellow background
%define=box frame lrindent border="2px dotted blue"%
>>box<< indents on two sides, with dotted blue border
%define=tinybox box font-size:smaller%
>>tinybox<< is same as box, but with a smaller font
Note that I never had to repeat any of properties of an existing
class -- I could simply say "an rframe contains all of the properties
of frame and rfloat combined" or "a postit contains all of the
properties of sidenote plus an additional background-color property".
What's more, if a skin comes in and redefines one of the
.frame, .rfloat, or .lrindent properties, then those changes
are automatically reflected in the wikistyles I've defined. If
this had been a pure-CSS implementation, I would then have to go
and adjust my custom styles in order to have them remain in
agreement with the new base class settings.
Pm
More information about the pmwiki-users
mailing list