mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Fix incorrect code block generation when previous line contains whitespace (Fixes #39)
This commit is contained in:
parent
b95191ea3d
commit
d5d346ace8
@ -72,6 +72,12 @@ class DocumentationParser {
|
|||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
foreach($lines as $i => $line) {
|
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)) {
|
if(!$started && preg_match('/^\t*:::\s*(.*)/', $line, $matches)) {
|
||||||
// first line with custom formatting
|
// first line with custom formatting
|
||||||
$started = true;
|
$started = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user