[Home]WikiPatches/ConfigurableDiffBgColor

UseModWiki | WikiPatches | RecentChanges | Preferences

This feature is in 1.0 with different names for the color options ($DiffColor1? and $DiffColor2?). --CliffordAdams

The 1.0 code also uses the CSS classes TABLE.wikidiffold and TABLE.wikidiffnew to allow the colors to be set in a stylesheet. If you use the CSS method then you can set $DiffColor1? and $DiffColor2? to ''. --CliffordAdams


CSS support is a nice feature under 092. However, depending on the choice of background/foreground colors in the style sheet, the diff output can become illegible. Currently no solution but modifying the wiki.pl source. - TakOta?


*** usemod092/wiki.pl	Sat Apr 21 17:44:10 2001
--- wiki.pl	Fri Jan 18 11:42:42 2002
***************
*** 45,51 ****
    $UrlProtocols $UrlPattern $ImageExtensions $RFCPattern $ISBNPattern
    $FS $FS1 $FS2 $FS3 $CookieName $SiteBase $StyleSheet $NotFoundPg
    $FooterNote $EditNote $MaxPost $NewText $NotifyDefault $HttpCharset
!   $UserGotoBar);
  # Note: $NotifyDefault is kept because it was a config variable in 0.90
  # Other global variables:
  use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl
--- 45,51 ----
    $UrlProtocols $UrlPattern $ImageExtensions $RFCPattern $ISBNPattern
    $FS $FS1 $FS2 $FS3 $CookieName $SiteBase $StyleSheet $NotFoundPg
    $FooterNote $EditNote $MaxPost $NewText $NotifyDefault $HttpCharset
!   $UserGotoBar $DiffBgFrom $DiffBgTo);
  # Note: $NotifyDefault is kept because it was a config variable in 0.90
  # Other global variables:
  use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl
***************
*** 84,89 ****
--- 84,91 ----
  $NewText     = "";              # New page text ("" for default message)
  $HttpCharset = "";              # Charset for pages, like "iso-8859-2"
  $UserGotoBar = "";              # HTML added to end of goto bar
+ $DiffBgFrom  = "";              # Background color for diff from field
+ $DiffBgTo    = "";              # Background color for diff to field
  
  # Major options:
  $UseSubpage  = 1;       # 1 = use subpages,       0 = do not use subpages
***************
*** 1663,1670 ****
    $html =~ s/(^|\n)(\d+.*c.*)/$1 <br><strong>$tChanged $2<\/strong><br>/g;
    $html =~ s/(^|\n)(\d+.*d.*)/$1 <br><strong>$tRemoved $2<\/strong><br>/g;
    $html =~ s/(^|\n)(\d+.*a.*)/$1 <br><strong>$tAdded $2<\/strong><br>/g;
!   $html =~ s/\n((<.*\n)+)/&ColorDiff($1,"ffffaf")/ge;
!   $html =~ s/\n((>.*\n)+)/&ColorDiff($1,"cfffcf")/ge;
    return $html;
  }
  
--- 1665,1672 ----
    $html =~ s/(^|\n)(\d+.*c.*)/$1 <br><strong>$tChanged $2<\/strong><br>/g;
    $html =~ s/(^|\n)(\d+.*d.*)/$1 <br><strong>$tRemoved $2<\/strong><br>/g;
    $html =~ s/(^|\n)(\d+.*a.*)/$1 <br><strong>$tAdded $2<\/strong><br>/g;
!   $html =~ s/\n((<.*\n)+)/&ColorDiff($1,$DiffBgFrom || "#ffffaf")/ge;
!   $html =~ s/\n((>.*\n)+)/&ColorDiff($1,$DiffBgTo || "#cfffcf")/ge;
    return $html;
  }
  
***************
*** 1683,1689 ****
    $diff =~ s/$FS(\d+)$FS/$SaveUrl{$1}/ge;   # Restore saved text
    $diff =~ s/$FS(\d+)$FS/$SaveUrl{$1}/ge;   # Restore nested saved text
    $diff =~ s/\r?\n/<br>/g;
!   return "<table width=\"95\%\" bgcolor=#$color><tr><td>\n" . $diff
           . "</td></tr></table>\n";
  }
  
--- 1685,1691 ----
    $diff =~ s/$FS(\d+)$FS/$SaveUrl{$1}/ge;   # Restore saved text
    $diff =~ s/$FS(\d+)$FS/$SaveUrl{$1}/ge;   # Restore nested saved text
    $diff =~ s/\r?\n/<br>/g;
!   return "<table width=\"95\%\" bgcolor=\"$color\"><tr><td>\n" . $diff
           . "</td></tr></table>\n";
  }
  

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 2, 2009 3:18 pm by MarkusLude (diff)
Search: