doc/cs: Begin additional if conditions on a new line

This commit is contained in:
Eric Lippmann 2014-06-13 17:23:20 +02:00
parent 7f6010e1f8
commit 8fe1d49ce9
2 changed files with 10 additions and 11 deletions

View File

@ -160,12 +160,11 @@ class DocParser
$cat = array_merge($cat, $chapter); $cat = array_merge($cat, $chapter);
} }
} }
$html = preg_replace_callback( return preg_replace_callback(
'#<pre><code class="language-php">(.*?)\</code></pre>#s', '#<pre><code class="language-php">(.*?)\</code></pre>#s',
array($this, 'highlight'), array($this, 'highlight'),
Parsedown::instance()->text(implode('', $cat)) Parsedown::instance()->text(implode('', $cat))
); );
return $html;
} }
/** /**
@ -194,9 +193,9 @@ class DocParser
return null; return null;
} }
$header = null; $header = null;
if ($line && if ($line
$line[0] === '#' && && $line[0] === '#'
preg_match('/^#+/', $line, $match) === 1 && preg_match('/^#+/', $line, $match) === 1
) { ) {
// Atx-style // Atx-style
$level = strlen($match[0]); $level = strlen($match[0]);
@ -205,9 +204,9 @@ class DocParser
return null; return null;
} }
} elseif ( } elseif (
$line && $line
($line[0] === '=' || $line[0] === '-') && && ($line[0] === '=' || $line[0] === '-')
preg_match('/^[=-]+\s*$/', $line, $match) === 1 && preg_match('/^[=-]+\s*$/', $line, $match) === 1
) { ) {
// Setext // Setext
$header = trim($lastLine); $header = trim($lastLine);
@ -235,8 +234,8 @@ class DocParser
*/ */
protected function extractHeaderId(&$header) protected function extractHeaderId(&$header)
{ {
if ($header[0] === '<' && if ($header[0] === '<'
preg_match('#(?:<(?P<tag>a|span) id="(?P<id>.+)"></(?P=tag)>)#u', $header, $match) && preg_match('#(?:<(?P<tag>a|span) id="(?P<id>.+)"></(?P=tag)>)#u', $header, $match)
) { ) {
$header = str_replace($match[0], '', $header); $header = str_replace($match[0], '', $header);
return $match['id']; return $match['id'];

View File

@ -20,7 +20,7 @@ class MarkdownFileIterator extends RecursiveFilterIterator
public function accept() public function accept()
{ {
$current = $this->getInnerIterator()->current(); $current = $this->getInnerIterator()->current();
if (!$current->isFile()) { if (! $current->isFile()) {
return false; return false;
} }
$filename = $current->getFilename(); $filename = $current->getFilename();