From d5d346ace8a98556505c0f6b64e3eaa7f8a87e23 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sun, 27 Jul 2014 11:25:28 +1200 Subject: [PATCH] Fix incorrect code block generation when previous line contains whitespace (Fixes #39) --- code/DocumentationParser.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/DocumentationParser.php b/code/DocumentationParser.php index 89e8360..ebb8090 100755 --- a/code/DocumentationParser.php +++ b/code/DocumentationParser.php @@ -72,6 +72,12 @@ class DocumentationParser { $output = array(); foreach($lines as $i => $line) { + // if line just contains whitespace, continue down the page. + // Prevents code blocks with leading tabs adding an extra line. + if(preg_match('/^\s$/', $line)) { + continue; + } + if(!$started && preg_match('/^\t*:::\s*(.*)/', $line, $matches)) { // first line with custom formatting $started = true;