Yosymfony\Spress\Core\DataSource\Filesystem\AttributeParser::getContentFromFrontmatter PHP Method

getContentFromFrontmatter() public method

Get the content without frontmatter block.
public getContentFromFrontmatter ( string $value ) : string
$value string Frontmatter
return string
    public function getContentFromFrontmatter($value)
    {
        return ltrim(preg_replace($this->pattern, '', $value, 1));
    }

Usage Example

Example #1
0
    public function testGetAttributesFromEmptyJsonFrontmatter()
    {
        $parser = new AttributeParser(AttributeParser::PARSER_JSON);
        $raw = <<<FRONTMATTER
---
---
My content
FRONTMATTER;
        $attributes = $parser->getAttributesFromFrontmatter($raw);
        $content = $parser->getContentFromFrontmatter($raw);
        $this->assertTrue(is_array($attributes));
        $this->assertEquals('My content', $content);
    }
All Usage Examples Of Yosymfony\Spress\Core\DataSource\Filesystem\AttributeParser::getContentFromFrontmatter