1
0
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:
Awilum
2021-08-01 12:30:12 +03:00
parent eff0bbbfb4
commit d15af2dddc
2 changed files with 9 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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();
}
}