[Pmwiki-users] Extending PmWiki to Use More Custom Styles
Patrick R. Michaud
pmichaud
Sat Feb 28 08:00:51 CST 2004
On Sat, Feb 28, 2004 at 07:50:16AM -0800, Steven Leite wrote:
>
> Is there much demand for improving %style% command? I'd very much
> like to be able to use this sort of syntax to build complex custome
> styles:
> %define=my_blue color=#4B91CE%
> %define=my_background bgcolor=yellow%
> %define=b font-weight=bold%
> %define=highlight color=my_blue bgcolor=my_background font-weight=b%
> Here's some %highlight% highlighted text%%
>
> How difficult would it be to implement more
> styles (particularily, bold, italic, underline and strikethrough).
Not too bad:
$WikiStyleTags['font-weight'] =
array('style' => 'font-weight:$value; ');
$WikiStyleTags['text-decoration'] =
array('style' => 'text-decoration:$value; ');
$WikiStyleTags['font-style'] =
array('style' => 'font-style:$value; ');
This enables the font-weight, text-decoration, and font-style properties
as wikistyles. You could then do %define=b font-weight=bold% in pages
to define the shortcuts. But, to preload the shortcuts you listed above...
$WikiStyle['my_blue']['color'] = '#4b91ce'; # defines %my_blue%
$WikiStyle['my_background']['bgcolor'] = 'yellow'; # defines %my_background%
$WikiStyle['b']['font-weight'] = 'bold'; # defines %b%
$WikiStyle['highlight']['color'] = '#4b91ce'; # defines %highlight%
$WikiStyle['highlight']['bgcolor'] = 'yellow';
$WikiStyle['highlight']['font-weight'] = 'bold';
$WikiStyle['i']['font-style'] = 'italic'; # defines %i%
$WikiStyle['u']['text-decoration'] = 'underline'; # defines %u%
$WikiStyle['strike']['text-decoration'] = 'line-through'; # defines %strike%
Ever since I created WikiStyles I've been willing to add more default
style definitions to PmWiki, but nobody's really asked for them until now.
I'm still willing to do this if people want to define some useful defaults.
Pm
More information about the pmwiki-users
mailing list