PmWiki: WikiStylesAdmin

WikiStyles can be predefined in config.php by the WikiAdministrator.

The general format for defining WikiStyles is:
    
    $WikiStyle['stylename']['attribute'] = 'value';

So the line:

    $WikiStyle['darkgreen']['color'] = '#006400';

defines a style %darkgreen% that changes the text color attribute to #006400, like this.

The standard WikiStyles are automatically included via the stdconfig.php script unless disabled by

    $EnableStdWikiStyles = 0;

To restrict wiki page authors to the styles you define,
add the following statement in config.php:

    $WikiStylePattern = '%[-\\w]*%';

To turn off WikiStyles completely, execute:

    unset($WikiStylePattern);

The remainder of this page shows examples defining WikiStyles for use in PmWiki pages. These examples are taken verbatim from scripts/wikistyles.php:
    

# the %newwin% pattern causes links to open in a new window
$WikiStyle['newwin']['target'] = '_blank';		

# the %comment% style creates a comment in the markup
$WikiStyleTags['display'] = array('style' => 'display:$value; ');
$WikiStyle['comment']['display'] = 'none';

# define colored text styles as %black%, %white%, %red%,
# from CSS color names
foreach (array('black','white','red','yellow','blue','gray',
  'silver', 'maroon', 'green', 'navy', 'purple') as $c) 
    $WikiStyle[$c]['color'] = $c;

# define %darkgreen% from a CSS #RRGGBB color specification
$WikiStyle['darkgreen']['color'] = '#006400';

# example defining %highlight% with multiple attributes
# $WikiStyle['highlight']['color'] = 'black';
# $WikiStyle['highlight']['bgcolor'] = 'yellow';

<< CustomInterMaps | PmWiki.DocumentationIndex | CustomFreeLinks >>

本頁更新於 2004 年 02 月 19 日,01:26 AM