示例#1
0
 /**
  * Called after conversion
  *
  * @param ConvertEvent $convertEvent Convert event
  */
 public function afterConvert(ConvertEvent $convertEvent)
 {
     if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) {
         $content = $convertEvent->source()->content();
         $content = preg_replace(self::$removePlaceholderRe, '', $content);
         $content = preg_replace('/<div data-(\\w+)="(\\w+\\++\\w+)">(.*?)<\\/div>/Us', '{% $1 \'$2\' %}$3{% end$1 %}', $content);
         $convertEvent->source()->setContent($content);
     }
 }
 /**
  * Called after conversion
  *
  * @param ConvertEvent $convertEvent Convert event
  */
 public function afterConvert(ConvertEvent $convertEvent)
 {
     if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) {
         $content = $convertEvent->source()->content();
         $content = preg_replace(self::$removePlaceholderRe, '', $content);
         $content = preg_replace('/<div data-codeblock-args="(.*?)">(.*?)<\\/div>/Us', '{% codeblock $1 %}$2{% endcodeblock %}', $content);
         $convertEvent->source()->setContent($content);
     }
 }