Basic page rendering and editing now works in XHTML! Yeah!
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 3 Apr 2004 10:23:26 +0000 (10:23 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 3 Apr 2004 10:23:26 +0000 (10:23 +0000)
To test:
$wgMimeType = "text/xml";
$wgDocType = "-//W3C//DTD XHTML 1.0 Transitional//EN";
$wgDTD = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";

includes/EditPage.php
includes/Parser.php
includes/Skin.php

index 8ce60fa..e2946a8 100644 (file)
@@ -304,11 +304,11 @@ class EditPage {
                $watchhtml = "";
 
                if ( 0 != $wgUser->getID() ) {
-                       $watchhtml = "<input tabindex='4' type='checkbox' name='wpWatchthis'".($this->watchthis?" checked":"")." id='wpWatchthis'>".
+                       $watchhtml = "<input tabindex='4' type='checkbox' name='wpWatchthis'".($this->watchthis?" checked":"")." id='wpWatchthis' />".
                        "<label for='wpWatchthis'>{$watchthis}</label>";
                }
 
-               $checkboxhtml = $minoredithtml . $watchhtml . "<br>";
+               $checkboxhtml = $minoredithtml . $watchhtml . "<br />";
 
                if ( "preview" == $formtype) {
                        $previewhead="<h2>" . wfMsg( "preview" ) . "</h2>\n<p><large><center><font color=\"#cc0000\">" .
@@ -338,11 +338,11 @@ class EditPage {
                # Otherwise, show a summary field at the bottom
                $summarytext = htmlspecialchars( $wgLang->recodeForEdit( $this->summary ) ); # FIXME
                if( $this->section == "new" ) {
-                       $commentsubject="{$subject}: <input tabindex='1' type='text' value=\"$summarytext\" name=\"wpSummary\" maxlength='200' size='60'><br>";
+                       $commentsubject="{$subject}: <input tabindex='1' type='text' value=\"$summarytext\" name=\"wpSummary\" maxlength='200' size='60' /><br />";
                        $editsummary = "";
                } else {
                        $commentsubject = "";
-                       $editsummary="{$summary}: <input tabindex='3' type='text' value=\"$summarytext\" name=\"wpSummary\" maxlength='200' size='60'><br>";
+                       $editsummary="{$summary}: <input tabindex='3' type='text' value=\"$summarytext\" name=\"wpSummary\" maxlength='200' size='60' /><br />";
                }
 
                if( !$this->preview ) {
index b526d2d..b7e8812 100644 (file)
@@ -968,7 +968,8 @@ class Parser
                # and making lists from lines starting with * # : etc.
                #
                $a = explode( "\n", $text );
-               $text = $lastPref = "";
+               $text = "<p>"; # ??
+               $lastPref = "";
                $this->mDTopen = $inBlockElem = false;
 
                if ( ! $linestart ) { $text .= array_shift( $a ); }
@@ -1029,8 +1030,9 @@ class Parser
                                        if ( " " == $t{0} ) {
                                                $newSection = "pre";
                                                # $t = wfEscapeHTML( $t );
+                                       } else {
+                                               $newSection = "p";
                                        }
-                                       else { $newSection = "p"; }
 
                                        if ( 0 == strcmp( "", trim( $oLine ) ) ) {
                                                $text .= $this->closeParagraph();
@@ -1056,9 +1058,7 @@ class Parser
                        --$npl;
                }
                if ( "" != $this->mLastSection ) {
-                       if ( "p" != $this->mLastSection ) {
-                               $text .= "</" . $this->mLastSection . ">";
-                       }
+                       $text .= "</" . $this->mLastSection . ">";
                        $this->mLastSection = "";
                }
                wfProfileOut( $fname );
index 13c345d..7090698 100644 (file)
@@ -335,7 +335,6 @@ class Skin {
                $s .= $this->pageTitle();
                $s .= $this->pageSubtitle() ;
                $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
-               $s .= "\n<p>";
                wfProfileOut( $fname );
                return $s;
        }
@@ -2323,8 +2322,7 @@ class Skin {
        // toolbar for common editing functions. It can be disabled in the user preferences.
        // The necsesary JavaScript code can be found in style/wikibits.js.
        function getEditToolbar() {
-
-               global $wgUploadPath,$wgLang;
+               global $wgUploadPath, $wgLang, $wgMimeType;
 
                // toolarray an array of arrays which each include the filename of
                // the button image (without path), the opening tag, the closing tag,
@@ -2389,6 +2387,12 @@ class Skin {
                                "tip"=>wfMsg("hr_tip"))
                );
                $toolbar ="<script type='text/javascript'>\n";
+               
+               $xml = ($wgMimeType == "text/xml");
+               if( $xml ) {
+                       $toolbar .= "<![CDATA[";
+               }
+               
                $toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
                foreach($toolarray as $tool) {
 
@@ -2406,7 +2410,12 @@ class Skin {
                }
 
                $toolbar.="addInfobox('" . addslashes( wfMsg( "infobox" ) ) . "','" . addslashes(wfMsg("infobox_alert")) . "');\n";
-               $toolbar.="document.writeln(\"</div>\");\n</script>";
+               $toolbar.="document.writeln(\"</div>\");\n";
+               
+               if( $xml ) {
+                       $toolbar .= "]]>";
+               }
+               $toolbar.="</script>";
                return $toolbar;
        }
 }