<commit_before><?php
/*
 * This file is part of the Burgov CMS.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Burgov\Bundle\CMSBundle\Twig;

/**
 * @author <NAME> <<EMAIL>>
 */
class CMSExtension extends \Twig_Extension
{
    public function getName()
    {
        return 'cms';
    }

    public function getFilters()
    {
        return array(
            'cms_readmore' => new \Twig_Filter_Method($this, 'readmore'),
            'cms_article' => new \Twig_Filter_Method($this, 'article')
        );
    }

    public function readmore($html, $linkTarget)
    {
        $parts = preg_split('#<p.*?><span.*?>(\s|&nbsp;)*\.{3}(\s|&nbsp;)*</span></p>#', $html);

        return $parts[0].'<p class="readmore"><a href="'.$linkTarget.'">Lees meer...</a></p>';
    }

    public function article($html)
    {
        return preg_replace('#<p.*?><span.*?>(\s|&nbsp;)*\.{3}(\s|&nbsp;)*</span></p>#', '', $html);

    }
}
<commit_msg>option to disable read-more link<commit_after><?php
/*
 * This file is part of the Burgov CMS.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Burgov\Bundle\CMSBundle\Twig;

/**
 * @author <NAME> <<EMAIL>>
 */
class CMSExtension extends \Twig_Extension
{
    public function getName()
    {
        return 'cms';
    }

    public function getFilters()
    {
        return array(
            'cms_readmore' => new \Twig_Filter_Method($this, 'readmore'),
            'cms_article' => new \Twig_Filter_Method($this, 'article')
        );
    }

    public function readmore($html, $linkTarget, $linkIfNoReadMore = true)
    {
        $parts = preg_split('#<p.*?><span.*?>(\s|&nbsp;)*\.{3}(\s|&nbsp;)*</span></p>#', $html);

        return $parts[0].($linkIfNoReadMore || count($parts) > 1 ? '<p class="readmore"><a href="'.$linkTarget.'">Lees meer...</a></p>' : '');
    }

    public function article($html)
    {
        return preg_replace('#<p.*?><span.*?>(\s|&nbsp;)*\.{3}(\s|&nbsp;)*</span></p>#', '', $html);

    }
}

{'fraction_non_alphanumeric': 0.20662678324896455, 'fraction_numerical': 0.0032213529682466636, 'mean_word_length': 2.834215167548501, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1639506', 'n_tokens_mistral': 761, 'n_tokens_neox': 741, 'n_words': 163}