mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 06:06:45 +02:00
feat(parsers): update parsers #199
This commit is contained in:
@@ -60,7 +60,7 @@ final class Markdown
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
$config = flextype('registry')->get('flextype.settings.parsers.markdown');
|
||||
$config = registry()->get('flextype.settings.parsers.markdown');
|
||||
$this->environment = Environment::createCommonMarkEnvironment();
|
||||
$this->environment->addExtension(new AttributesExtension());
|
||||
$this->environment->addExtension(new TableExtension());
|
||||
@@ -106,15 +106,15 @@ final class Markdown
|
||||
*/
|
||||
public function parse(string $input, bool $cache = true)
|
||||
{
|
||||
if ($cache === true && flextype('registry')->get('flextype.settings.cache.enabled') === true) {
|
||||
if ($cache === true && registry()->get('flextype.settings.cache.enabled') === true) {
|
||||
$key = $this->getCacheID($input);
|
||||
|
||||
if ($dataFromCache = flextype('cache')->get($key)) {
|
||||
if ($dataFromCache = cache()->get($key)) {
|
||||
return $dataFromCache;
|
||||
}
|
||||
|
||||
$data = $this->converter()->convertToHtml($input);
|
||||
flextype('cache')->set($key, $data);
|
||||
cache()->set($key, $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@@ -10,6 +10,8 @@ declare(strict_types=1);
|
||||
namespace Flextype\Support\Parsers;
|
||||
|
||||
use Atomastic\Macroable\Macroable;
|
||||
use Flextype\Support\Parsers\Markdown;
|
||||
use Flextype\Support\Parsers\Shortcodes;
|
||||
|
||||
class Parsers
|
||||
{
|
||||
@@ -24,10 +26,10 @@ class Parsers
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Shortcode instance.
|
||||
* Create a Shortcodes instance.
|
||||
*/
|
||||
public function shortcode(): Shortcode
|
||||
public function shortcodes(): Shortcodes
|
||||
{
|
||||
return Shortcode::getInstance();
|
||||
return Shortcodes::getInstance();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user