[pmwiki-users] Converting WikiStyle shortcuts to CSS classes
Russell Bailey
russell-pmwiki at saberpunk.net
Mon Sep 12 08:32:11 CDT 2005
Joachim Durchholz wrote:
> Russell Bailey wrote:
>
>> I think the most sensible way to get around this is to transform
>> WikiStyles into the thing they act like- CSS classes. I'm figuring
>> that, at the end of markup generation, I'd transform the contents
>> of $WikiStyles to classes and store them in
>> $HTMLStylesFmt['wikistyles'].
>>
>> I have a few questions:
>>
>> * Is there a reason not to do this? Previously, Pm has said there
>> wasn't, but I want to make sure nobody's run into one.
>
>
> I'm not sure about the following scenario:
>
> User A has a scripting-disabled browser and saves a page with a
> wikistyle.
>
> User B has scripting on, edits the page, and the styles get saved as
> CSS classes.
>
> User A later revisits the page, and doesn't understand the CSS markup
> he now finds in the page.
I probably should have made clear that this is purely a rendering
thing- in fact, the reason it's come up is that I don't want users
familiar with PmWiki (who are a small but significant subset of my
users) to be confused.
Basically, for users with appropriate scripting-enabled browsers (IE
and Gecko, basically, and hopefully near-future versions of Safari),
they see the page as editable HTML. When they save, it gets turned
back into PmWiki markup.
For users without appropriate browsing capabilities, or users who
choose not to use the rich text editor, everything works the way it
does now.
What I'm doing with this particular extension is rendering WikiStyle
shortcuts (either defined directly in $WikiStyle or put there with
define= markup) to CSS classes, then applying the classes to the text.
So, from my sandbox:
%red% red %%
becomes
<span class='wikistyle_red'>
red
</span>
instead of
<span style='color:red;'>
red
</span>
This means that when data is saved from the rich text editor, PmWiki
can tell which spans had which WikiStyles, making things more intuitive
for the end user.
> This kind of scenario applies to all kinds of wikitext munging that
> you may do. OTOH you may already be handling this gracefully - I
> haven't tried the recipe yet.
It's not released yet, but my development version is at
dev.saberpunk.net. It's stable, 'cept when I'm coding on it. ;) Note
that I haven't finished the WikiStyle code yet, so the rich text editor
will probably mess up the text when you try to save (saving
%wikistyle_red% instead of %red%, and applying some things that should
apply to paragraphs to spans), and won't yet display most WikiStyles.
Best,
Russell
More information about the pmwiki-users
mailing list