Skip to content

Commit a3833e3

Browse files
authored
Merge pull request #251 from McCaulay/fix/get-pages-brackets
Fix get pages regular expression
2 parents beed422 + b42957d commit a3833e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Traits/Indexable.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ public function index($version)
1717

1818
$result = [];
1919
foreach($pages as $page) {
20-
$page = explode("{{version}}", $page)[1];
20+
$split = explode("{{version}}", $page);
21+
if (count($split) <= 1)
22+
continue;
23+
24+
$page = $split[1];
2125
$pageContent = $this->get($version, $page);
2226

2327
if(! $pageContent)
@@ -57,7 +61,7 @@ protected function getPages($version)
5761
$path = base_path(config('larecipe.docs.path').'/'.$version.'/index.md');
5862

5963
// match all markdown urls => [title](url)
60-
preg_match_all('/\(([^)]+)\)/', $this->files->get($path), $matches);
64+
preg_match_all('/\[.+\]\((.+)\)/', $this->files->get($path), $matches);
6165

6266
return $matches[1];
6367
}

0 commit comments

Comments
 (0)