mirror of
https://github.com/flextype/flextype.git
synced 2025-08-28 07:20:06 +02:00
refactor(core): Parser API's refactoring #288
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# The title of the website
|
||||
title: Flextype
|
||||
title: Flextype1
|
||||
|
||||
# The description of the website
|
||||
description: Build fast, flexible, easier to manage websites with Flextype.
|
||||
@@ -70,7 +70,7 @@ entries:
|
||||
#
|
||||
# - display: Display errors or not.
|
||||
errors:
|
||||
display: false
|
||||
display: true
|
||||
|
||||
# Cache
|
||||
#
|
||||
|
@@ -18,7 +18,7 @@ use function ltrim;
|
||||
use function preg_split;
|
||||
use function trim;
|
||||
|
||||
class FrontmatterParser
|
||||
class Frontmatter
|
||||
{
|
||||
/**
|
||||
* Front matter parser
|
@@ -13,7 +13,7 @@ namespace Flextype;
|
||||
|
||||
use ParsedownExtra;
|
||||
|
||||
class MarkdownParser
|
||||
class Markdown
|
||||
{
|
||||
|
||||
/**
|
@@ -74,7 +74,7 @@ class Parser
|
||||
{
|
||||
switch ($parser) {
|
||||
case 'frontmatter':
|
||||
return FrontmatterParser::encode($input);
|
||||
return Parser::encode($input);
|
||||
|
||||
break;
|
||||
case 'json':
|
||||
@@ -111,12 +111,12 @@ class Parser
|
||||
return $data_from_cache;
|
||||
}
|
||||
|
||||
$data = FrontmatterParser::decode($input);
|
||||
$data = Frontmatter::decode($input);
|
||||
$this->flextype['cache']->save($key, $data);
|
||||
|
||||
return $data;
|
||||
} else {
|
||||
return FrontmatterParser::decode($input);
|
||||
return Frontmatter::decode($input);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -162,12 +162,12 @@ class Parser
|
||||
return $data_from_cache;
|
||||
}
|
||||
|
||||
$data = MarkdownParser::parse($input);
|
||||
$data = Markdown::parse($input);
|
||||
$this->flextype['cache']->save($key, $data);
|
||||
|
||||
return $data;
|
||||
} else {
|
||||
return MarkdownParser::parse($input);
|
||||
return Markdown::parse($input);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@@ -44,6 +44,6 @@ class MarkdownTwigExtension extends Twig_Extension
|
||||
*/
|
||||
public function markdown($value) : string
|
||||
{
|
||||
return MarkdownParser::parse($value);
|
||||
return Markdown::parse($value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user