[Home]WikiPatches/EnableCSS

UseModWiki | WikiPatches | RecentChanges | Preferences

Many of the changes in this patch have been added to 1.0. --CliffordAdams
This patch puts correct class declarations to most elements on a page:

This page is 115 lines in unified diff and thus long enough to let some other patches fail. So decide before patching, whether you need such fine grained control.

If the <html> on top of the generated HTML is in capital letters, update your CGI.pm to a recent version.

  -- jl

The Patch

--- BrainDump.orig      Fri Nov  1 00:35:33 2002
+++ BrainDump   Fri Nov  1 01:00:13 2002
@@ -460,7 +460,7 @@
     &OpenKeptRevisions('text_default')  if (!$openKept);
     $fullHtml .= &GetDiffHTML($showDiff, $id, $diffRevision, $newText);
   }
-  $fullHtml .= &WikiToHTML($Text{'text'});
+  $fullHtml .= '<div class="content">' . &WikiToHTML($Text{'text'}) . '</div>';
   $fullHtml .= "<hr>\n"  if (!&GetParam('embed', $EmbedWiki));
   if (($id eq $RCName) || (T($RCName) eq $id) || (T($id) eq $RCName)) {
     print $fullHtml;
@@ -777,7 +777,7 @@
 sub ScriptLink {
   my ($action, $text) = @_;
 
-  return "<a href=\"$ScriptName?$action\">$text</a>";
+  return "<a href=\"$ScriptName?$action\" class=\"scriptlink\">$text</a>";
 }
 
 sub GetPageLink {
@@ -899,7 +899,7 @@
   if ($FreeLinks) {
     $action =~ s/ /_/g;
   }
-  return "<a href=\"$ScriptName?$action\" title=\"$title\">$text</a>";
+  return "<a href=\"$ScriptName?$action\" title=\"$title\" class=\"scriptlinktitle\">$text</a>";
 }
 
 sub GetAuthorLink {
@@ -948,10 +948,12 @@
   $result .= &GetHtmlHeader("$SiteName: $title");
   return $result  if ($embed);
 
+       $result .= '<div class="header">';
   if ($oldId ne '') {
     $result .= $q->h3('(' . Ts('redirected from %s', 
                                &GetEditLink($oldId, $oldId)) . ')');
   }
+
   if ((!$embed) && ($LogoUrl ne "")) {
     $logoImage = "img src=\"$LogoUrl\" alt=\"$altText\" border=0";
     if (!$LogoLeft) {
@@ -966,9 +968,9 @@
   }
   if (&GetParam("toplinkbar", 1)) {
     # Later consider smaller size?
-    $result .= &GetGotoBar($id) . "<hr>";
+    $result .= &GetGotoBar($id) . "</div><hr>";
   }
-  return $result;
+  return $result; 
 }
 
 sub GetHttpHeader {
@@ -1027,7 +1029,8 @@
   if (&GetParam('embed', $EmbedWiki)) {
     return $q->end_html;
   }
-  $result = &GetFormStart();
+       $result = '<div class="footer">';
+  $result .= &GetFormStart();
   $result .= &GetGotoBar($id);
   if (&UserCanEdit($id, 0)) {
     if ($rev ne '') {
@@ -1065,6 +1068,7 @@
   }
   $result .= $q->endform;
   $result .= &GetMinimumFooter();
+       $result .= '</div>';
   return $result;
 }
 
@@ -1329,7 +1333,7 @@
   return ("", $id . $punct)  if ($url eq "");
   $remotePage =~ s/&/&/g;  # Unquote common URL HTML
   $url .= $remotePage;
-  return ("<a href=\"$url\">$name</a>", $punct);
+  return ("<a href=\"$url\" class=\"interpage\">$name</a>", $punct);
 }
 
 sub StoreBracketInterPage {
@@ -1421,7 +1425,7 @@
   if ($useImage && ($name =~ /^(http:|https:|ftp:).+\.$ImageExtensions$/)) {
     return ("<img src=\"$name\">", $punct);
   }
-  return ("<a href=\"$name\">$name</a>", $punct);
+  return ("<a href=\"$name\" class=\"url\">$name</a>", $punct);
 }
 
 sub StoreBracketUrl {
@@ -1461,7 +1465,7 @@
 sub RFCLink {
   my ($num) = @_;
 
-  return "<a href=\"http://www.faqs.org/rfcs/rfc${num}.html\">RFC $num</a>";
+  return "<a href=\"http://www.faqs.org/rfcs/rfc${num}.html\" class=\"rfc\">RFC $num</a>";
 }
 
 sub StoreISBN {
@@ -1482,11 +1486,12 @@
     return "ISBN $rawnum";
   }
   $first  = "<a href=\"http://shop.barnesandnoble.com/bookSearch/"
-            . "isbnInquiry.asp?isbn=$num\">";
+            . "isbnInquiry.asp?isbn=$num\" class=\"isbnban\">";
   $second = "<a href=\"http://www.amazon.com/exec/obidos/"
-            . "ISBN=$num\">" . T('alternate') . "</a>";
+            . "ISBN=$num\" class=\"isbnamazon\">" . T('alternate') . "</a>";
   $third  = "<a href=\"http://www.pricescan.com/books/"
-            . "BookDetail.asp?isbn=$num\">" . T('search') . "</a>";
+            . "BookDetail.asp?isbn=$num\" class=\"isbnps\">" . T('search') 
+                                               . "</a>";
   $html  = $first . "ISBN " . $rawprint . "</a> ";
   $html .= "($second, $third)";
   $html .= " "  if ($rawnum =~ / $/);  # Add space if old ISBN had space.

Sample Style Sheet

BODY {
        background-color: #BBBBBB;
        color: #000000;
}

A {
        text-decoration: none;
}

DIV.footer, DIV.header {
        background-color: #CCCCCC;
        color: #333333;
}

DIV.header {
        height: 64px;
        padding-top: 4px;
        padding-left: 5px;
}

DIV.header H1 {
        margin: 0px;
}

/* The logo specified by $LogoUrl */
DIV.header H1 IMG.logo {
        padding-right: 5px;
}

/* The page title - name of page linked to backtrace */
DIV.header H1 A {
        font-style: italic;
        color: #444444;
        margin: 0px;
}

/* Main content section */
DIV.content {
        background-color: #EEEEEE;
        color: #444444;
        padding: 10px;
}

/* Footer section */
DIV.footer {
        padding-top: 5px;
        padding-left: 5px;
        line-height: 125%;
}

A.interpage {
        background-color: inherit;
        color: green;
        font-weight: bold;
}

A.url {
        color: blue;
}

A.scriptlink {
        background-color: inherit;
        color: inherit;
        font-weight: bold;
}

SPAN.gotobar {
        font-size: 125%;
        color: #CCCCCC;
}

SPAN.gotobar A {
        color: #666666;
        text-decoration: underline;     
}

DIV.content A.edit {
        background-color: inherit;
        color: inherit;
        font-weight: bold;
}

DIV.footer A.edit, DIV.footer A.history {
        font-style: italic;
}

A.edit {
        background-color: inherit;
        color: red;
        font-weight: bold;
}

A.diff {
        background-color: inherit;
        color: inherit;
        text-decoration: underline;
}

A.history {
        color: inherit;
}

INPUT.search {
        background-color: #EEEEEE;
        margin: 5px;
        color: green;
}

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited August 20, 2004 2:06 pm by JuanmaMP (diff)
Search: