1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

replace logical operators with conditionals to improve readability

This commit is contained in:
Emanuil Rusev 2014-01-23 22:46:49 +02:00
parent c8c5ae9df8
commit 3a5eecc23d

View File

@ -110,7 +110,10 @@ class Parsedown
} }
else else
{ {
$element['text'] !== '' and $element['text'] .= "\n"; if ($element['text'] !== '')
{
$element['text'] .= "\n";
}
$element['text'] .= $line; $element['text'] .= $line;
} }
@ -444,7 +447,10 @@ class Parsedown
'fence' => $matches[1], 'fence' => $matches[1],
); );
isset($matches[2]) and $element['language'] = $matches[2]; if (isset($matches[2]))
{
$element['language'] = $matches[2];
}
continue 2; continue 2;
} }
@ -524,7 +530,10 @@ class Parsedown
} }
else else
{ {
$this->breaks_enabled and $element['text'] .= ' '; if ($this->breaks_enabled)
{
$element['text'] .= ' ';
}
$element['text'] .= "\n".$line; $element['text'] .= "\n".$line;
} }
@ -603,7 +612,10 @@ class Parsedown
$markup .= '<pre><code'; $markup .= '<pre><code';
isset($element['language']) and $markup .= ' class="language-'.$element['language'].'"'; if (isset($element['language']))
{
$markup .= ' class="language-'.$element['language'].'"';
}
$markup .= '>'.$text.'</code></pre>'."\n"; $markup .= '>'.$text.'</code></pre>'."\n";
@ -744,7 +756,10 @@ class Parsedown
$offset = strlen($matches[0]); $offset = strlen($matches[0]);
$element['!'] and $offset++; if ($element['!'])
{
$offset++;
}
$remaining_text = substr($text, $offset); $remaining_text = substr($text, $offset);
@ -801,7 +816,10 @@ class Parsedown
{ {
$markup .= '<img alt="'.$element['a'].'" src="'.$element['»'].'"'; $markup .= '<img alt="'.$element['a'].'" src="'.$element['»'].'"';
isset($element['#']) and $markup .= ' title="'.$element['#'].'"'; if (isset($element['#']))
{
$markup .= ' title="'.$element['#'].'"';
}
$markup .= ' />'; $markup .= ' />';
} }
@ -811,7 +829,10 @@ class Parsedown
$markup .= '<a href="'.$element['»'].'"'; $markup .= '<a href="'.$element['»'].'"';
isset($element['#']) and $markup .= ' title="'.$element['#'].'"'; if (isset($element['#']))
{
$markup .= ' title="'.$element['#'].'"';
}
$markup .= '>'.$element['a'].'</a>'; $markup .= '>'.$element['a'].'</a>';
} }