[Pmwiki-users] %class=something%

Patrick R. Michaud pmichaud
Thu Mar 4 15:16:47 CST 2004


On Thu, Mar 04, 2004 at 10:16:25AM -0300, Andres Yver wrote:
>
> The easiest (for a lay-author) solution is to physically separate 
> content from markup. This also what the w3.org people have been arguing 
> for over the last , well, almost a decade now.

Just to follow up on this point--PmWiki's implementation of WikiStyles
has *always* allowed content to be separated from styling information,
and does so even better as of the latest release.  Here's how it works
(the description below is alluded to in the WikiStyles documentation 
under "Style Definitions)...

Let's say that I want to have a style for adding notes to a page, where
the text is always green, italicized, and 10-pixel font.  With 
WikiStyles we can do something like

   %color=green font-style=italic font-size=10px% Lorem ipsum dolor 
   sit amet, consectetuer adipiscing elit. Cras tortor odio, 
   dapibus et, feugiat ut, vehicula non, nunc. Curabitur condimentum. 
   Donec vel eros. 

   %color=green font-style=italic font-size=10px% Phasellus ante velit, 
   faucibus vel, facilisis eleifend, rutrum id, quam. In tincidunt 
   metus sit amet arcu. Sed libero lectus, cursus eu, sollicitudin 
   vitae, semper ac, mauris. 

But it gets tedious repeating all of those %color=green font-style=italic
font-size=10px%, so instead what we do is define a new WikiStyle called
"note", by writing 

   %color=green font-style=italic font-size=10px define=note%

and then afterwards we can write:

   %note% Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  
   Cras tortor odio, dapibus et, feugiat ut, vehicula non, nunc. 
   Curabitur condimentum.  Donec vel eros. 

   %note% Phasellus ante velit, faucibus vel, facilisis eleifend, 
   rutrum id, quam. In tincidunt metus sit amet arcu. Sed libero 
   lectus, cursus eu, sollicitudin vitae, semper ac, mauris. 

Now then, the style definitions we use don't have to be defined
physically in the page they're used--we can define them indirectly
in other pages, such as a GroupHeader page or any other page that
is otherwise loaded before the styled text is displayed (e.g., an
[[include:LocalStyles]] page or as part of a sidebar).  It's also 
fairly easy for an admin to preload styles from a local configuration 
file.  Thus WikiStyles *can* be easily separated from the page 
content--same as CSS.

Furthermore, you can add additional characteristics to already defined 
WikiStyles, just like CSS.  So if I want to have all of the characteristics
of %note% but use red text, I simply write

   %note color=red% Etiam turpis turpis, tincidunt a, scelerisque 
   quis, pulvinar iaculis, leo. Vivamus lobortis lacus quis lectus. 
   Duis sagittis dolor vitae libero.

or, since PmWiki already has %color=red define=red% by default,
I can just combine the two to get

   %note red% Etiam turpis turpis, tincidunt a, scelerisque 
   quis, pulvinar iaculis, leo. Vivamus lobortis lacus quis lectus. 
   Duis sagittis dolor vitae libero.

and if I want to make this combination into a new "rednote" WikiStyle 
definition:

   %note red define=rednote%

On pmichaud.com I typically create a "Pm" WikiStyle to identify text 
that I want to stand out as coming from me:

   %bgcolor=purple define=Pm%

so that when I want to mark text as coming from me, I just write

   %Pm% Pellentesque consequat eros a ipsum. Etiam fringilla 
   rhoncus tellus.

which displays the text in a purple background color.  Other authors
can easily add their own styles.  It'd be nice if this style definition
could set the background color of a block markup such as <div> 
instead of only the inlined text, but we're not quite there yet.

(An interesting markup addition might be to have a signature markup 
that automatically grabs an author's prefered styling from his/her 
Profiles page in addition to signing an excerpt.)

So, PmWiki's WikiStyles implementation gives a wiki page author
most of the styling capabilities available via CSS, with the advantage
of a somewhat simpler syntax and the ability to define/edit styles
by editing wiki pages.

Pm



More information about the pmwiki-users mailing list