|
@@ 56-66 (lines=11) @@
|
| 53 |
|
]; |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public function beforeConvert(ConvertEvent $convertEvent) |
| 57 |
|
{ |
| 58 |
|
if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) { |
| 59 |
|
$content = $convertEvent->source()->content(); |
| 60 |
|
foreach ($this->addPlaceholderRe as $re) { |
| 61 |
|
$content = preg_replace($re, $this->placeholder, $content); |
| 62 |
|
} |
| 63 |
|
$content = preg_replace('/{%\s+(\w+)\s+(\w+\++\w+)\s+%}(.*){%\s+end\1\s+%}/Us', '<div data-$1="$2">$3</div>', $content); |
| 64 |
|
$convertEvent->source()->setContent($content); |
| 65 |
|
} |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
public function afterConvert(ConvertEvent $convertEvent) |
| 69 |
|
{ |
|
@@ 68-76 (lines=9) @@
|
| 65 |
|
} |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
public function afterConvert(ConvertEvent $convertEvent) |
| 69 |
|
{ |
| 70 |
|
if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) { |
| 71 |
|
$content = $convertEvent->source()->content(); |
| 72 |
|
$content = preg_replace($this->removePlaceholderRe, '', $content); |
| 73 |
|
$content = preg_replace('/<div data-(\w+)="(\w+\++\w+)">(.*?)<\/div>/Us', '{% $1 \'$2\' %}$3{% end$1 %}', $content); |
| 74 |
|
$convertEvent->source()->setContent($content); |
| 75 |
|
} |
| 76 |
|
} |
| 77 |
|
} |
| 78 |
|
|