Merge "Resources.php: Add missing dependencies to module 'mediawiki.util'"
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index 2cdd8c7..d097414 100644 (file)
@@ -258,6 +258,12 @@ class ParserOptions {
         */
        private $allowUnsafeRawHtml = true;
 
+       /**
+        * CSS class to use to wrap output from Parser::parse().
+        * @var string|false
+        */
+       private $wrapOutputClass = 'mw-parser-output';
+
        public function getInterwikiMagic() {
                return $this->mInterwikiMagic;
        }
@@ -481,6 +487,16 @@ class ParserOptions {
                return $this->allowUnsafeRawHtml;
        }
 
+       /**
+        * Class to use to wrap output from Parser::parse()
+        * @since 1.30
+        * @return string|bool
+        */
+       public function getWrapOutputClass() {
+               $this->optionUsed( 'wrapclass' );
+               return $this->wrapOutputClass;
+       }
+
        public function setInterwikiMagic( $x ) {
                return wfSetVar( $this->mInterwikiMagic, $x );
        }
@@ -629,6 +645,19 @@ class ParserOptions {
                return wfSetVar( $this->allowUnsafeRawHtml, $x );
        }
 
+       /**
+        * CSS class to use to wrap output from Parser::parse()
+        * @since 1.30
+        * @param string|bool $className Set false to disable wrapping.
+        * @return string|bool Current value
+        */
+       public function setWrapOutputClass( $className ) {
+               if ( $className === true ) { // DWIM, they probably want the default class name
+                       $className = 'mw-parser-output';
+               }
+               return wfSetVar( $this->wrapOutputClass, $className );
+       }
+
        /**
         * Set the redirect target.
         *
@@ -915,6 +944,10 @@ class ParserOptions {
                        $confstr .= '!printable=1';
                }
 
+               if ( $this->wrapOutputClass !== 'mw-parser-output' && in_array( 'wrapclass', $forOptions ) ) {
+                       $confstr .= '!wrapclass=' . $this->wrapOutputClass;
+               }
+
                if ( $this->mExtraKey != '' ) {
                        $confstr .= $this->mExtraKey;
                }