}
/**
- * Private constructor
+ * @param string $text
+ * @param bool $lineStart
*/
private function __construct( $text, $lineStart ) {
$this->text = $text;
private function openList( $char ) {
$result = $this->closeParagraph();
- if ( '*' === $char ) {
+ if ( $char === '*' ) {
$result .= "<ul><li>";
- } elseif ( '#' === $char ) {
+ } elseif ( $char === '#' ) {
$result .= "<ol><li>";
- } elseif ( ':' === $char ) {
+ } elseif ( $char === ':' ) {
$result .= "<dl><dd>";
- } elseif ( ';' === $char ) {
+ } elseif ( $char === ';' ) {
$result .= "<dl><dt>";
$this->DTopen = true;
} else {
* @return string
*/
private function nextItem( $char ) {
- if ( '*' === $char || '#' === $char ) {
+ if ( $char === '*' || $char === '#' ) {
return "</li>\n<li>";
- } elseif ( ':' === $char || ';' === $char ) {
+ } elseif ( $char === ':' || $char === ';' ) {
$close = "</dd>\n";
if ( $this->DTopen ) {
$close = "</dt>\n";
}
- if ( ';' === $char ) {
+ if ( $char === ';' ) {
$this->DTopen = true;
return $close . '<dt>';
} else {
* @return string
*/
private function closeList( $char ) {
- if ( '*' === $char ) {
+ if ( $char === '*' ) {
$text = "</li></ul>";
- } elseif ( '#' === $char ) {
+ } elseif ( $char === '#' ) {
$text = "</li></ol>";
- } elseif ( ':' === $char ) {
+ } elseif ( $char === ':' ) {
if ( $this->DTopen ) {
$this->DTopen = false;
$text = "</dt></dl>";
$char = $prefix[$commonPrefixLength];
$output .= $this->openList( $char );
- if ( ';' === $char ) {
+ if ( $char === ';' ) {
# @todo FIXME: This is dupe of code above
if ( $this->findColonNoLinks( $t, $term, $t2 ) !== false ) {
$t = $t2;
}
# If we have no prefixes, go to paragraph mode.
- if ( 0 == $prefixLength ) {
+ if ( $prefixLength == 0 ) {
# No prefix (not in list)--go to paragraph mode
# @todo consider using a stack for nestable elements like span, table and div
}
$inBlockElem = !$closeMatch;
} elseif ( !$inBlockElem && !$this->inPre ) {
- if ( ' ' == substr( $t, 0, 1 )
+ if ( substr( $t, 0, 1 ) == ' '
&& ( $this->lastSection === 'pre' || trim( $t ) != '' )
&& !$inBlockquote
) {
if ( $pendingPTag ) {
$output .= $this->closeParagraph();
$pendingPTag = false;
- $this->lastSection = '';
}
} else {
# paragraph
} else {
if ( $this->lastSection !== 'p' ) {
$output .= $this->closeParagraph();
- $this->lastSection = '';
$pendingPTag = '<p>';
} else {
$pendingPTag = '</p><p>';