-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- allow front matter on any Blade template
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace SavvyWombat\Caxton\Blade; | ||
|
||
use Illuminate\Contracts\View\Engine; | ||
use Illuminate\View\Engines\CompilerEngine; | ||
use Illuminate\View\ViewException; | ||
use League\CommonMark\Exception\CommonMarkException; | ||
use SavvyWombat\Caxton\Markdown\MarkdownConverter; | ||
|
||
class DefaultEngine implements Engine | ||
{ | ||
public function __construct( | ||
protected CompilerEngine $blade, | ||
protected MarkdownConverter $markdown, | ||
) { | ||
// | ||
} | ||
|
||
/** | ||
* @param string $path | ||
* @param array $data | ||
* @return string | ||
* @throws ViewException | ||
* @throws CommonMarkException | ||
*/ | ||
public function get($path, array $data = []): string | ||
{ | ||
return $this->markdown->extractContent($this->blade->get($path, $data)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters