[Home]WikiWithCascadingStyleSheet/CSSClasses

UseModWiki | WikiWithCascadingStyleSheet | RecentChanges | Preferences

My suggested changes to enable /CSSClasses in UseModWiki.

  $fullHtml .= "<hr class=wikilinefooter>\n"  if (!&GetParam('embed', $EmbedWiki)); ##TAB
    print "<hr class=wikilinefooter>\n"  if (!&GetParam('embed', $EmbedWiki)); ##TAB
    $header = &ScriptLink($HomePage.'" target=_"parent', "<$logoImage>")."\n"; ##TAB
    $result .= &GetGotoBar($id) . "<hr class=wikilineheader>"; ##TAB
  return "<hr class=wikilinefooter>" . &GetFormStart() . &GetGotoBar("") . ##TAB
      s/-------+/<hr noshade class=wikiline style="height:4px">/g; # ThinLine fix ##TAB
      s/------+/<hr noshade class=wikiline style="height:3px">/g; # ThinLine fix ##TAB
      s/-----+/<hr noshade class=wikiline style="height:2px">/g; # ThinLine fix ##TAB
      s/----+/<hr noshade class=wikiline style="height:1px">/g; # ThinLine fix ##TAB
      s/----+/<hr class=wikiline>/g; ##TAB
    ## Tables:
    s/^\|([^|]*)\s*/<TR class=wikitablerow><TD class=wikitablecell>$1<\/TD>\n/g; # start of line; new table-row ## TAB
    s/\|([^|]*)\s*/<td class=wikitablecell>$1<\/td>\n/g; #table new field ## TAB
  my ($pageHtml, @htmlStack, $code, $depth, $oldCode);  my ($tag); #table
    } elsif (/^[\|\+].*\S/) { #table
      $code = "TABLE"; #table
      $depth = 1; #table
      $tag = pop(@htmlStack); #table
      if ($tag eq "TABLE") { #table
        $pageHtml .= "</TR>\n"; #table
        $tag = "table";      } #table
      $pageHtml .= "</" . $tag . ">\n"; #table
        if ($code eq "TABLE") { #table
          $pageHtml .= "<TABLE class=wikitable>\n"; #table ## TAB
        } else { #table
        } #table
            . "</b>\n" . "$links<br>" . &DiffToHTML($diffText) . "<hr class=wikilinerevision>\n"; ##TAB
                   $priorName) . "</b>\n$links<hr class=wikilinerevision>"; ##TAB
              . "</b>\n$links<br>" . &DiffToHTML($diffText) . "<hr class=wikilinerevision>\n"; ##TAB
    print "\n<br><hr class=wikilinepreview><p><strong>", T('This is the text you submitted:'), ##TAB
  print "<hr class=wikilinepreview>\n"; ##TAB
    print "<div class=wikipreview>\n"; ##TAB
    print "<h2 class=wikiheadpreview>", T('Preview:'), "</h2>\n"; ##TAB
            "</b><hr class=wikilinepreview>\n"; ##TAB
    print &WikiToHTML($oldText) . "<hr class=wikilinepreview>\n"; ##TAB
    print "<h2 class=wikiheadpreview>", T('Preview only, not yet saved'), "</h2>\n"; ##TAB
    print "</div>\n"; ##TAB
  print "<hr class=wikilinepreference><b>$recentName:</b>\n"; ##TAB
    print '<hr class=wikilinerevision><b>', T('Differences:'), "</b>\n"; ##TAB
  print '<hr class=wikilinerevision><b>', T('Misc:'), "</b>\n"; ##TAB
  print "<hr class=wikilinerevision\n"; ##TAB
  print "<hr class=wikiline>\n"; ##TAB
  print "<hr class=wikiline>\n"; ##TAB
  print "<hr class=wikilineheader><br clear=all>\n<pre>";  # Get below the logo ##TAB
    print '<hr class=wikiline>', T('Processing rename/delete commands:'), "<br>\n"; ##TAB
  print "<hr class=wikiline>\n"; ##TAB
  print "<hr class=wikiline>\n"; ##TAB

Note this includes the table patch and the ThinLine patch. See /WikiStyleSheet for a CSS to accompany this.

How do we use this patch ? I'm not familiar enough with the wiki.pl file to know how to put it in. Just a couple of quick pointers would be great, especially if it should replace something or just be inserted somewhere. Thanks!

This issue with this patch is that it is single lines scattered through the source. As I did this under Windows I used BeyondCompare to extract the above lines, and you could use it or a similar tool to find out where they go.
Alternatively there are not so many prints that you cannot search for them and figure out where the appropriate replacement should go, based on the class name in the patched line and the context of the original line.


Here is a diff of wiki.pl after applying the patch above, hope it helps.

In case anybody's confused, if you apply this with the patch program under Linux (or similar), you'll need to specify -R since it's reversed. I applied it as is to clean wiki.pl and it worked a treat! (Apologies if I've broken etiquette by leaping in with (obvious?) comments - still very new to this whole wikid idea!) --CartRoo

A differ with Context

Patch to orignal wiki.pl 0.92 directly. As to wiki.pl with others patches, you should search \Whr\W , \Wtable\W , \Wt[rd]\W in your editor such as vi to check whether there are some unpatched left. -- Johnson

@@ -461,11 +461,11 @@
     $fullHtml .= &GetDiffHTML($showDiff, $id, $diffRevision, $newText);
   }
   $fullHtml .= &WikiToHTML($Text{'text'});
-  $fullHtml .= "<hr>\n"  if (!&GetParam('embed', $EmbedWiki));
+  $fullHtml .= "<hr class=wikilinefooter>\n"  if (!&GetParam('embed', $EmbedWiki));
   if (($id eq $RCName) || (T($RCName) eq $id) || (T($id) eq $RCName)) {
     print $fullHtml;
     &DoRc();
-    print "<hr>\n"  if (!&GetParam('embed', $EmbedWiki));
+    print "<hr class=wikilinefooter>\n"  if (!&GetParam('embed', $EmbedWiki));
     print &GetFooterText($id, $goodRevision);
     return;
   }
@@ -957,7 +957,7 @@
     if (!$LogoLeft) {
       $logoImage .= " align=\"right\"";
     }
-    $header = &ScriptLink($HomePage, "<$logoImage>");
+    $header = &ScriptLink($HomePage.'" target=_"parent', "<$logoImage>");
   }
   if ($id ne '') {
     $result .= $q->h1($header . &GetSearchLink($id));
@@ -966,7 +966,7 @@
   }
   if (&GetParam("toplinkbar", 1)) {
     # Later consider smaller size?
-    $result .= &GetGotoBar($id) . "<hr>";
+    $result .= &GetGotoBar($id) . "<hr class=wikilineheader>";
   }
   return $result;
 }
@@ -1067,7 +1067,7 @@
 }
 
 sub GetCommonFooter {
-  return "<hr>" . &GetFormStart() . &GetGotoBar("") .
+  return "<hr class=wikilinefooter>" . &GetFormStart() . &GetGotoBar("") .
          &GetSearchForm() . $q->endform . &GetMinimumFooter();
 }
 
@@ -1222,10 +1222,10 @@
     s/$RFCPattern/&StoreRFC($1)/geo;
     s/$ISBNPattern/&StoreISBN($1)/geo;
     if ($ThinLine) {
-      s/----+/<hr noshade size=1>/g;
-      s/====+/<hr noshade size=2>/g;
+      s/----+/<hr noshade class=wikiline size=1>/g;
+      s/====+/<hr noshade class=wikiline size=2>/g;
     } else {
-      s/----+/<hr>/g;
+      s/----+/<hr class=wikiline>/g;
     }
   }
   if ($doLines) { # 0 = no line-oriented, 1 or 2 = do line-oriented
@@ -1588,18 +1588,18 @@
   if ($rev ne "") {
     $html = '<b>'
             . Ts('Difference (from revision %s to current revision)', $rev)
-            . "</b>\n" . "$links<br>" . &DiffToHTML($diffText) . "<hr>\n";
+            . "</b>\n" . "$links<br>" . &DiffToHTML($diffText) . "<hr class=wikilinerevision>\n";
   } else {
     if (($diffType != 2) &&
         ((!defined(&GetPageCache("old$cacheName"))) ||
          (&GetPageCache("old$cacheName") < 1))) {
       $html = '<b>'
               . Ts('No diff available--this is the first %s revision.',
-                   $priorName) . "</b>\n$links<hr>";
+                   $priorName) . "</b>\n$links<hr class=wikilinerevision>";
     } else {
       $html = '<b>'
               . Ts('Difference (from prior %s revision)', $priorName)
-              . "</b>\n$links<br>" . &DiffToHTML($diffText) . "<hr>\n";
+              . "</b>\n$links<br>" . &DiffToHTML($diffText) . "<hr class=wikilinerevision>\n";
     }
   }
   return $html;
@@ -1683,7 +1683,7 @@
   $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
+  return "<table class=wikitable width=\"95\%\" bgcolor=#$color><tr class=wikitablerow><td class=wikitablecell>\n" . $diff
          . "</td></tr></table>\n";
 }
 
@@ -2617,23 +2617,23 @@
   print $q->submit(-name=>'Preview', -value=>T('Preview')), "\n";
 
   if ($isConflict) {
-    print "\n<br><hr><p><strong>", T('This is the text you submitted:'),
+    print "\n<br><hr class=wikilinepreview><p><strong>", T('This is the text you submitted:'),
           "</strong><p>",
           &GetTextArea('newtext', $newText, $editRows, $editCols),
           "<p>\n";
   }
-  print "<hr>\n";
+  print "<hr class=wikilinepreview>\n";
   if ($preview) {
-    print "<h2>", T('Preview:'), "</h2>\n";
+    print "<h2 class=wikiheadpreview>", T('Preview:'), "</h2>\n";
     if ($isConflict) {
       print "<b>",
             T('NOTE: This preview shows the revision of the other author.'),
-            "</b><hr>\n";
+            "</b><hr class=wikilinepreview>\n";
     }
     $MainPage = $id;
     $MainPage =~ s|/.*||;  # Only the main page name (remove subpage)
-    print &WikiToHTML($oldText) . "<hr>\n";
-    print "<h2>", T('Preview only, not yet saved'), "</h2>\n";
+    print &WikiToHTML($oldText) . "<hr class=wikilinepreview>\n";
+    print "<h2 class=wikiheadpreview>", T('Preview only, not yet saved'), "</h2>\n";
   }
   print &GetHistoryLink($id, T('View other revisions')) . "<br>\n";
   print &GetGotoBar($id);
@@ -2688,7 +2688,7 @@
     print '<br>', T('Email Address:'), ' ',
           &GetFormText('email', "", 30, 60);
   }
-  print "<hr><b>$recentName:</b>\n";
+  print "<hr class=wikilinepreference><b>$recentName:</b>\n";
   print '<br>', T('Default days to display:'), ' ',
         &GetFormText('rcdays', $RcDefault, 4, 9);
   print "<br>", &GetFormCheck('rcnewtop', $RecentTop,
@@ -2704,7 +2704,7 @@
   print "<br>", &GetFormCheck('rcchangehist', 1,
                               T('Use "changes" as link to history'));
   if ($UseDiff) {
-    print '<hr><b>', T('Differences:'), "</b>\n";
+    print '<hr class=wikilinerevision><b>', T('Differences:'), "</b>\n";
     print "<br>", &GetFormCheck('diffrclink', 1,
                                 Ts('Show (diff) links on %s', $recentName));
     print "<br>", &GetFormCheck('alldiff', 0,
@@ -2717,7 +2717,7 @@
                          -values=>[1,2,3], -labels=>\%labels,
                          -default=>&GetParam("defaultdiff", 1));
   }
-  print '<hr><b>', T('Misc:'), "</b>\n";
+  print '<hr class=wikilinerevision><b>', T('Misc:'), "</b>\n";
   # Note: TZ offset is added by TimeToText, so pre-subtract to cancel.
   print '<br>', T('Server time:'), ' ', &TimeToText($Now-$TimeZoneOffset);
   print '<br>', T('Time Zone offset (hours):'), ' ',
@@ -2733,7 +2733,7 @@
   print '<br>', &GetFormCheck('linkrandom', 0,
                               T('Add "Random Page" link to link bar'));
   print '<br>', $q->submit(-name=>'Save', -value=>T('Save')), "\n";
-  print "<hr>\n";
+  print "<hr class=wikilinerevision>\n";
   print &GetGotoBar('');
   print $q->endform;
   print &GetMinimumFooter();
@@ -2941,7 +2941,7 @@
         $q->password_field(-name=>'p_password', -value=>'', 
                            -size=>15, -maxlength=>50);
   print '<br>', $q->submit(-name=>'Login', -value=>T('Login')), "\n";
-  print "<hr>\n";
+  print "<hr class=wikiline>\n";
   print &GetGotoBar('');
   print $q->endform;
   print &GetMinimumFooter();
@@ -2973,7 +2973,7 @@
   } else {
     print Ts('Login for user ID %s failed.', $uid);
   }
-  print "<hr>\n";
+  print "<hr class=wikiline>\n";
   print &GetGotoBar('');
   print $q->endform;
   print &GetMinimumFooter();
@@ -3049,7 +3049,7 @@
 
 sub DoLinks {
   print &GetHeader('', &QuoteHtml(T('Full Link List')), '');
-  print "<hr><pre>\n\n\n\n\n";  # Extra lines to get below the logo
+  print "<hr class=wikilineheader><pre>\n\n\n\n\n";  # Extra lines to get below the logo
   &PrintLinkList(&GetFullLinkList());
   print "</pre>\n";
   print &GetMinimumFooter();
@@ -3526,7 +3526,7 @@
   $fname = "$DataDir/editlinks";
   if (-f $fname) {
     $data = &ReadFileOrDie($fname);
-    print '<hr>', T('Processing rename/delete commands:'), "<br>\n";
+    print '<hr class=wikiline>', T('Processing rename/delete commands:'), "<br>\n";
     &UpdateLinksList($data, 1, 1);  # Always update RC and links
     unlink("$fname.old");
     rename($fname, "$fname.old");
@@ -3617,7 +3617,7 @@
         "^123.21.3.  (blocks whole 123.21.3.* IP network)<p>";
   print &GetTextArea('banlist', $banList, 12, 50);
   print "<br>", $q->submit(-name=>'Save'), "\n";
-  print "<hr>\n";
+  print "<hr class=wikiline>\n";

   print &GetGotoBar("");
   print $q->endform;
   print &GetMinimumFooter();
@@ -3668,7 +3668,7 @@
   print $q->checkbox(-name=>"p_changetext", -override=>1, -checked=>1,
                       -label=>"Substitute text for rename");
   print "<br>", $q->submit(-name=>'Edit'), "\n";
-  print "<hr>\n";
+  print "<hr class=wikiline>\n";
   print &GetGotoBar("");
   print $q->endform;
   print &GetMinimumFooter();

Check out the SPAN and DIV markup for a modified UseMod site with CSS at http://ibasic.hytext.com/cgi-bin/ibasic.pl?Markup_Syntax DeadLink --Jerry Muelver

UseModWiki | WikiWithCascadingStyleSheet | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 4, 2012 10:13 pm by JuanmaMP (diff)
Search: