# empty token
$txt="";
break;
+ case "h":
+ #heading- used to close all unbalanced bold or em tags in this section
+ $txt = '';
+ if( $state['em'] !== false and
+ ( $state['strong'] === false or $state['em'] > $state['strong'] ) )
+ {
+ $s .= '</em>';
+ $state['em'] = false;
+ }
+ if ( $state['strong'] !== false ) $txt .= '</strong>';
+ if ( $state['em'] !== false ) $txt .= '</em>';
+ $state['strong'] = $state['em'] = false;
+ break;
case "RFC ":
if ( $tagIsOpen ) {
$txt = "RFC ";
$s .= $txt;
}
} #end while
+
+ # make 100% sure all strong and em tags are closed
+ # doBlockLevels often messes the last bit up though, but invalid nesting is better than unclosed tags
+ # tidy solves this though
+ if( $state['em'] !== false and
+ ( $state['strong'] === false or $state['em'] > $state['strong'] ) )
+ {
+ $s .= '</em>';
+ $state['em'] = false;
+ }
+ if ( $state['strong'] !== false ) $s .= '</strong>';
+ if ( $state['em'] !== false ) $s .= '</em>';
+
if ( count( $tokenStack ) != 0 )
{
# still objects on stack. opened [[ tag without closing ]] tag.
}
break;
case "\n": // for block levels, actually, only "----" is handled.
- case "\r":
+ case "\r": // headings are detected to close any unbalanced em or strong tags in a section
if ( $this->continues( "----" ) )
{
$queueToken["type"] = "----";
$this->mPos ++;
}
break 2;
+ } else if (
+ $this->continues( "<h" ) and (
+ $this->continues( "<h1" ) or
+ $this->continues( "<h2" ) or
+ $this->continues( "<h3" ) or
+ $this->continues( "<h4" ) or
+ $this->continues( "<h5" ) or
+ $this->continues( "<h6" )
+ )
+ ) { // heading
+ $queueToken["type"] = "h";
+ $queueToken["text"] = "";
+ $this->mQueuedToken[] = $queueToken;
+ $this->mPos ++;
+ break 2; // switch + while
}
break;
case "!": // French spacing rules have a space before exclamation