setAttribute( 'data-parsoid', '{}' ); } /** * Remove extra linebreaks from a wikitext string * * @param string $wikitext * @return string */ public static function sanitizeWikitextLinebreaks( string $wikitext ) : string { $wikitext = CommentUtils::htmlTrim( $wikitext ); $wikitext = preg_replace( "/\r/", "\n", $wikitext ); $wikitext = preg_replace( "/\n+/", "\n", $wikitext ); return $wikitext; } /** * Given a comment and a reply link, add the reply link to its document's DOM tree, at the end of * the comment. * * @param CommentItem $comment * @param DOMElement $linkNode Reply link */ public static function addReplyLink( CommentItem $comment, DOMElement $linkNode ) : void { $target = $comment->getRange()->endContainer; // Insert the link before trailing whitespace. // In the MediaWiki parser output,