Improve documentation of content handler stuff
[lhc/web/wiklou.git] / includes / content / WikitextContent.php
index 89a9fe9..8d778f5 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Content object for wiki text pages.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  *
  * @author Daniel Kinzler
  */
+
+/**
+ * Content object for wiki text pages.
+ *
+ * @ingroup Content
+ */
 class WikitextContent extends TextContent {
 
        public function __construct( $text ) {
@@ -63,6 +71,7 @@ class WikitextContent extends TextContent {
                $text = $with->getNativeData();
 
                if ( $section === '' ) {
+                       wfProfileOut( __METHOD__ );
                        return $with; # XXX: copy first?
                } if ( $section == 'new' ) {
                        # Inserting a new section
@@ -116,8 +125,9 @@ class WikitextContent extends TextContent {
 
                $text = $this->getNativeData();
                $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
+               rtrim( $pst );
 
-               return new WikitextContent( $pst );
+               return ( $text === $pst ) ? $this : new WikitextContent( $pst );
        }
 
        /**
@@ -211,8 +221,8 @@ class WikitextContent extends TextContent {
         *
         * @param $hasLinks Bool  if it is known whether this content contains
         *    links, provide this information here, to avoid redundant parsing to
-        *    find out.
-        * @param $title null|\Title
+        *    find out (default: null).
+        * @param $title Title: (default: null)
         *
         * @internal param \IContextSource $context context for parsing if necessary
         *
@@ -267,11 +277,10 @@ class WikitextContent extends TextContent {
         *
         * @since    1.21
         *
-        * @param $content Content the content to render
-        * @param $title \Title
-        * @param $revId null
-        * @param $options null|ParserOptions
-        * @param $generateHtml bool
+        * @param $title Title
+        * @param $revId int Revision to pass to the parser (default: null)
+        * @param $options ParserOptions (default: null)
+        * @param $generateHtml bool (default: false)
         *
         * @internal param \IContextSource|null $context
         * @return ParserOutput representing the HTML form of the text