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 ContentCommentItem $comment * @param Element $linkNode Reply link */ public static function addReplyLink( ContentCommentItem $comment, Element $linkNode ): void { $target = $comment->getRange()->endContainer; // Insert the link before trailing whitespace. // In the MediaWiki parser output,