setAttribute( 'data-parsoid', '{}' ); } /** * Remove extra linebreaks from a wikitext 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 Node $linkNode Reply link */ public static function addReplyLink( ContentCommentItem $comment, Node $linkNode ): void { $target = $comment->getRange()->endContainer; // Insert the link before trailing whitespace. // In the MediaWiki parser output,