UseModWiki | WikiPatches | RecentChanges | Preferences

This patch adds the following Wiki markup:


where classname is the name of a formatting block type and "text" is the text to be included in the block. The text can include line breaks, and other wiki markup is processed within the block.

It's up to the site's CSS stylesheet to format the block; otherwise it will look like normal text.


Classes are defined in the %ClassMarkup? hash in the form:
 "classname" => "HTML"

Two placeholders are available in the HTML:

Class examples

I've implemented so far:
declaration of class's position in the Object tree on the Unreal Wiki site
code array. The numbering should start at zero but only Opera complies with this CSS so far
code listing
quote from an external source
box, image and link to a zip file.



 # tarquin: classbox markup
 use vars qw( %ClassMarkup? );

This next section should go into config. The content of the hash is just an example.

 # temp settting
 %ClassMarkup? = ( 
  "class" => "<div class=\"class\">%text%</div>",
  "array" => "<div class=\"code\">%text%</div>",
  "code"  => "<div class=\"code\"><nowiki><pre>%text%</pre></nowiki></div>",
  "quote" => "<div class=\"quote\">%text%</div>",
  "zip"   => "<div class=\"zip\"><a href=\"%text%\">%text%</a></div>"


Beneath the line:
  $pageText = &QuoteHtml?($pageText);
add the following block:

  # tarq: classbox markup
    my $allkeys = join '|', map quotemeta, keys %ClassMarkup?;
    # $allkeys = join '|', map quotemeta, keys %ClassMarkup?;
    #$text =~ s[\@\@($allkeys)\@(.*)\@] [$ClassMarkup?{$1}]eg; 
    $pageText =~ s[\@\@($allkeys)\@(.*?)\@\@] {
      my $replacement = $ClassMarkup?{$1};
      my $blocktext = $2;
      $replacement =~ s[%text\%] [$blocktext]eg; 
      # process %nowiki% placeholder. 
      # This allows some classes to specify PRE themselves
      $replacement =~ s[%nowiki%] [\<nowiki\>]g;
      $replacement =~ s[%/nowiki%] [\<\/nowiki\>]g;

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited March 28, 2002 9:48 am by Tarquin (diff)