mirror of
https://github.com/flextype/flextype.git
synced 2025-08-23 05:16:03 +02:00
- FrontmatterParser implementation
This commit is contained in:
@@ -32,10 +32,10 @@ class FrontmatterParser
|
||||
{
|
||||
$parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL . ltrim($content));
|
||||
if (count($parts) < 3) {
|
||||
return ['matter' => [], 'body' => $content];
|
||||
return ['content' => $content];
|
||||
}
|
||||
|
||||
return ['matter' => trim($parts[1]), 'body' => implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2))];
|
||||
return YamlParser::decode(trim($parts[1])) + ['content' => implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2))];
|
||||
}
|
||||
|
||||
public static function encode($input) : string
|
||||
|
Reference in New Issue
Block a user