* Returns true if this content is not a redirect, and $wgArticleCountMethod
* is "any".
*
- * @param bool $hasLinks If it is known whether this content contains links,
+ * @param bool|null $hasLinks If it is known whether this content contains links,
* provide this information here, to avoid redundant parsing to find out.
*
* @return bool
/**
* Returns a Content object with pre-save transformations applied.
- * This implementation just trims trailing whitespace.
+ * This implementation just trims trailing whitespace and normalizes newlines.
*
* @param Title $title
* @param User $user
public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
$text = $this->getNativeData();
$pst = rtrim( $text );
+ $pst = str_replace( [ "\r\n", "\r" ], "\n", $pst );
return ( $text === $pst ) ? $this : new static( $pst, $this->getModel() );
}