[pmwiki-users] WikiStyles request

Dominique Faure dominique.faure.1 at free.fr
Mon Sep 12 11:52:14 CDT 2005


At Sunday, September 11, 2005 3:02 PM [GMT+1=CET], Patrick R. Michaud wrote:

> On Sun, Sep 11, 2005 at 11:50:34AM +0200, Dominique Faure wrote:
>> A previous mailing-list topic about two-column definition lists lead to
>> the following style definition:
>>
>> $HTMLStylesFmt['columnlist'] = "
>> dl.dlcol dt { float:left; padding-right:0.5em;}
>> dl.dlcol dd { margin-left:13em; }\n";
>>
>> $WikiStyle['dlcol']['apply'] = 'list';
>> $WikiStyle['dlcol']['class'] = 'dlcol';
>>
>
> That would be either
>
>    %define=dw dlcol margin-left:-8em%
>    :05/06/01:%dw% Initial release.
>    :05/06/03:Handling of forgotten @@?action=print@@ and minor tweaks.
>
> or
>
>    %define=dw margin-left:-8em%
>    :05/06/01:%dlcol dw% Initial release.
>    :05/06/03:Handling of forgotten @@?action=print@@ and minor tweaks.
>
>> I was wondering how I could have a kind of parametrized style definition
>> which could provide help in such cases. Something like:
>> ...
>> which could be used as:
>>
>>> 05/06/01:%dlcol param['margin']:5em% Initial release.
>>> 05/06/03: Handling of forgotten @@?action=print@@ and minor tweaks.
>
>    :05/06/01:%dlcol margin-left:5em% Initial release.
>    :05/06/03: Handling of forgotten @@?action=print@@ and minor tweaks.
>
> Pm

Sorry but this doesn't work as expected:

  :term: %dlcol% ...
  <dl class='dlcol' ><dt>term</dt><dd> ...

  :term: %dlcol margin-left:5em%
  <dl class='dlcol' style='margin-left: 5em;' ><dt>term</dt><dd> ...

  :term: %dlcol%%margin-left:5em% ...
  <dl class='dlcol' ><dt>term</dt><dd> <span style='margin-left: 5em;' >
...</span>

I've found a working solution adding the new style application range:

  $WikiStyleApply['descr'] = 'dd';
  $WikiStyle['descr']['apply'] = 'descr';

  :term: %dlcol%%descr margin-left:5em% ...
  <dl class='dlcol' ><dt>term</dt><dd style='margin-left: 5em;' >  ...

Could we have something equivalent defined on www.pmwiki.org?
(even, if I would have enjoyed syntaxic sugars like 
%dlcol(margin-left:4em)%...)


BTW, following  shouldn't 'wikistyles.php' code loop below:

  ## apply ranges
  SDVA($WikiStyleApply,array(
    'item' => 'li|dt',
    'list' => 'ul|ol|dl',
    'div' => 'div',
    'img' => 'img',
    'block' => 'p(?!\\sclass=)|div|ul|ol|dl|li|dt|pre|h[1-6]',
    'p' => 'p(?!\\sclass=)'));
  foreach(array('item', 'list', 'block', 'p', 'div') as $c)
    SDV($WikiStyle[$c],array('apply'=>$c));

be more something like below?

  ...
  foreach(array_keys($WikiStyleApply) as $c)
    SDV($WikiStyle[$c],array('apply'=>$c));

One last (sorry to bother), couldn't the wiki styles implementation be 
improved using the ParseArg function?

Regards,
Dom 





More information about the pmwiki-users mailing list