From 64264c806163cf7779049d3f1bdffc808bf253bd Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 11 Nov 2019 16:53:10 +0300 Subject: [PATCH] refactor(core): Parser API's refactoring #288 --- flextype/config/settings.yaml | 4 ++-- .../parsers/{FrontmatterParser.php => Frontmatter.php} | 2 +- flextype/parsers/{MarkdownParser.php => Markdown.php} | 2 +- flextype/parsers/Parser.php | 10 +++++----- flextype/twig/MarkdownTwigExtension.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename flextype/parsers/{FrontmatterParser.php => Frontmatter.php} (98%) rename flextype/parsers/{MarkdownParser.php => Markdown.php} (96%) diff --git a/flextype/config/settings.yaml b/flextype/config/settings.yaml index 73a4a97c..ca82364b 100644 --- a/flextype/config/settings.yaml +++ b/flextype/config/settings.yaml @@ -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 # diff --git a/flextype/parsers/FrontmatterParser.php b/flextype/parsers/Frontmatter.php similarity index 98% rename from flextype/parsers/FrontmatterParser.php rename to flextype/parsers/Frontmatter.php index 78878b3a..7481a785 100644 --- a/flextype/parsers/FrontmatterParser.php +++ b/flextype/parsers/Frontmatter.php @@ -18,7 +18,7 @@ use function ltrim; use function preg_split; use function trim; -class FrontmatterParser +class Frontmatter { /** * Front matter parser diff --git a/flextype/parsers/MarkdownParser.php b/flextype/parsers/Markdown.php similarity index 96% rename from flextype/parsers/MarkdownParser.php rename to flextype/parsers/Markdown.php index d9f7d186..e44009cf 100644 --- a/flextype/parsers/MarkdownParser.php +++ b/flextype/parsers/Markdown.php @@ -13,7 +13,7 @@ namespace Flextype; use ParsedownExtra; -class MarkdownParser +class Markdown { /** diff --git a/flextype/parsers/Parser.php b/flextype/parsers/Parser.php index 7bd7dbdb..d2a80951 100644 --- a/flextype/parsers/Parser.php +++ b/flextype/parsers/Parser.php @@ -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; diff --git a/flextype/twig/MarkdownTwigExtension.php b/flextype/twig/MarkdownTwigExtension.php index 786c6ea7..181752fe 100644 --- a/flextype/twig/MarkdownTwigExtension.php +++ b/flextype/twig/MarkdownTwigExtension.php @@ -44,6 +44,6 @@ class MarkdownTwigExtension extends Twig_Extension */ public function markdown($value) : string { - return MarkdownParser::parse($value); + return Markdown::parse($value); } }