Split the content to balance open tags when `<!--nextpage-->` and `<!--more.*?-->` are used. Needs filter inline docs. The 4 unit tests that were previously failing for ticket 6297 now pass.

See #6297. 
Props devesine.



git-svn-id: https://develop.svn.wordpress.org/trunk@26050 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2013-11-08 22:21:02 +00:00
parent c815622e87
commit 2a8b83fbb0
1 changed files with 9 additions and 4 deletions

View File

@ -1169,10 +1169,15 @@ function convert_chars($content, $deprecated = '') {
* @return string Balanced text * @return string Balanced text
*/ */
function balanceTags( $text, $force = false ) { function balanceTags( $text, $force = false ) {
if ( $force || get_option('use_balanceTags') == 1 ) if ( $force || get_option('use_balanceTags') == 1 ) {
return force_balance_tags( $text ); $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) );
else // Capture lets PREG_SPLIT_DELIM_CAPTURE return the delimiters
return $text; $delimiters_regex = '/(' . implode( '|', $balance_tags_delimiters ) . ')/';
$parts = preg_split( $delimiters_regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
return implode( '', array_map( 'force_balance_tags', $parts ) );
}
return $text;
} }
/** /**