public function beforeConvert(ConvertEvent $convertEvent): void
    {
        if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) {
            $content = $convertEvent->source()->content();
            foreach (self::$addPlaceholderRe as $re) {
                $content = preg_replace($re, self::$placeholder, $content);
            }
            $content = preg_replace(
                '/{%\s+(\w+)\s+(\w+\++\w+)\s+%}(.*){%\s+end\1\s+%}/Us',
                '<div data-$1="$2">$3</div>',
                $content
            );
            $convertEvent->source()->setContent($content);
        }
    }
public function beforeConvert(ConvertEvent $convertEvent): void
    {
        if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) {
            $content = $convertEvent->source()->content();
            foreach (self::$addPlaceholderRe as $re) {
                $content = preg_replace($re, self::$placeholder, $content);
            }
            $content = preg_replace(
                '/{%\s+(\w+)\s+(\w+\++\w+)\s+%}(.*){%\s+end\1\s+%}/Us',
                '<div data-$1="$2">$3</div>',
                $content
            );
            $convertEvent->source()->setContent($content);
        }
    }
public function beforeConvert ( ConvertEvent $ convertEvent ) : void { if ( $ convertEvent -> isHandledBy ( SculpinMarkdownBundle :: CONVERTER_NAME , SculpinTwigBundle :: FORMATTER_NAME ) ) { $ content = $ convertEvent -> source ( ) -> content ( ) ; foreach ( self :: $ addPlaceholderRe as $ re ) { $ content = preg_replace ( $ re , self :: $ placeholder , $ content ) ; } $ content = preg_replace ( '/{%\s+(\w+)\s+(\w+\++\w+)\s+%}(.*){%\s+end\1\s+%}/Us' , '<div data-$1="$2">$3</div>' , $ content ) ; $ convertEvent -> source ( ) -> setContent ( $ content ) ; } }
Called before conversion
Called before conversion