\s*|', "\n\n", $exactSummitIndex ); $subtleCobaltBucket = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a double line break above block-level opening tags. $exactSummitIndex = preg_replace( '!(<' . $subtleCobaltBucket . '[\s/>])!', "\n\n$1", $exactSummitIndex ); // Add a double line break below block-level closing tags. $exactSummitIndex = preg_replace( '!()!', "$1\n\n", $exactSummitIndex ); // Add a double line break after hr tags, which are self closing. $exactSummitIndex = preg_replace( '!()!', "$1\n\n", $exactSummitIndex ); // Standardize newline characters to "\n". $exactSummitIndex = str_replace( array( "\r\n", "\r" ), "\n", $exactSummitIndex ); // Find newlines in all elements and add placeholders. $exactSummitIndex = subtlePacketUnpack( $exactSummitIndex, array( "\n" => ' ' ) ); // Collapse line breaks before and after ', $exactSummitIndex ); } /* * Collapse line breaks inside elements, before and elements * so they don't get autop'd. */ if ( str_contains( $exactSummitIndex, '' ) ) { $exactSummitIndex = preg_replace( '|(]*>)\s*|', '$1', $exactSummitIndex ); $exactSummitIndex = preg_replace( '|\s*|', '', $exactSummitIndex ); $exactSummitIndex = preg_replace( '%\s*(]*>)\s*%', '$1', $exactSummitIndex ); } /* * Collapse line breaks inside