Revert r23617 per Brion
authorAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 2 Jul 2007 23:22:39 +0000 (23:22 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 2 Jul 2007 23:22:39 +0000 (23:22 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/Article.php

index e0a4ba4..b5343a2 100644 (file)
@@ -104,18 +104,18 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9250) Remove hardcoded minimum image name length of three characters
 * Fixed DISPLAYTITLE behaviour to reject titles which don't normalise to the
   same title as the current page, and enabled per default
-* (bug 10196) Add classes and dir="ltr" to <div>s wrapping CSS and JS pages
-  (new classes: mw-code, mw-css, mw-js)
+* Wrap site CSS and JavaScript in a <pre> tag, like user JS/CSS
+* (bug 10196) Add classes and dir="ltr" to the <pre>s on CSS and JS pages (new
+  classes: mw-code, mw-css, mw-js)
 * (bug 6711) Add $wgAddGroups and $wgRemoveGroups to allow finer control over
   usergroup assignment.
 * Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information
 * (bug 10387) Detect and handle '.php5' extension environments at install time
   Patch by Edward Z. Yang.
+* Introduce 'ShowRawCssJs' hook; see docs/hooks.txt for more information
 * (bug 10404) Show rights log for the selected user in Special:Userrights
 * New javascript for upload page that will show a warning if a file with the
   "destination filename" already exists.
-* (bug 10422) Do not wrap user JS/CSS in <pre>; allow it to render as wikitext.
-  like site CSS/JS.
 * Add 'editsection-brackets' message to allow localization (or removal) of the
   brackets in the "[edit]" link for sections.
 * (bug 10437) Move texvc styling to shared.css.
index 6f188e9..a74591a 100644 (file)
@@ -656,9 +656,14 @@ $content_actions: The array of content actions
                     Can be used to set custom CSS/JS
 $out: OutputPage object
 
+'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views
+$text: Text being shown
+$title: Title of the custom script/stylesheet page
+$output: Current OutputPage object
+
 'AjaxAddScript': Called in output page just before the initialisation
 of the javascript ajax engine. The hook is only called when ajax
 is enabled ( $wgUseAjax = true; ).
 
 More hooks might be available but undocumented, you can execute
-./maintenance/findhooks.php to find hidden one.
+./maintenance/findhooks.php to find hidden one.
\ No newline at end of file
index 58de866..9f3795e 100644 (file)
@@ -784,12 +784,15 @@ class Article {
                        if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) {
                                $wgOut->addHtml( wfMsgExt( 'clearyourcache', 'parse' ) );
 
-                               // Add classes, give directionality.  Do parse it as wikitext
-                               // (bug 10422).
-                               preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
-                               $wgOut->addHtml( "<div class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" );
-                               $wgOut->addWikiText( $this->mContent );
-                               $wgOut->addHtml( "\n</div>\n" );
+                               // Give hooks a chance to customise the output
+                               if( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->mTitle, $wgOut ) ) ) {
+                                       // Wrap the whole lot in a <pre> and don't parse
+                                       preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
+                                       $wgOut->addHtml( "<pre class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" );
+                                       $wgOut->addHtml( htmlspecialchars( $this->mContent ) );
+                                       $wgOut->addHtml( "\n</pre>\n" );
+                               }
+                       
                        }
                        
                        elseif ( $rt = Title::newFromRedirect( $text ) ) {