/** * process the content by running over all the known shortcodes with the * chosen parser * * @param Page $page the page to work on * @param Data $config configuration merged with the page config */ public function processContent(Page $page, Data $config) { switch ($config->get('parser')) { case 'regular': $parser = 'Thunder\\Shortcode\\Parser\\RegularParser'; break; case 'wordpress': $parser = 'Thunder\\Shortcode\\Parser\\WordpressParser'; break; default: $parser = 'Thunder\\Shortcode\\Parser\\RegexParser'; break; } if ($page && $config->get('enabled')) { $content = $page->getRawContent(); $processor = new Processor(new $parser(new CommonSyntax()), $this->handlers); $processor = $processor->withEventContainer($this->events); $processed_content = $processor->process($content); return $processed_content; } }