|
@@ -11,6 +11,7 @@ use \Michelf\MarkdownExtra;
|
|
|
*/
|
|
|
class Pico {
|
|
|
|
|
|
+ protected $columns = array();
|
|
|
private $plugins;
|
|
|
|
|
|
/**
|
|
@@ -101,7 +102,9 @@ class Pico {
|
|
|
'next_page' => $next_page,
|
|
|
'is_front_page' => $url ? false : true,
|
|
|
);
|
|
|
-
|
|
|
+ foreach ($this->columns as $var => $code) {
|
|
|
+ $twig_vars["column_{$var}"] = $code;
|
|
|
+ }
|
|
|
$template = (isset($meta['template']) && $meta['template']) ? $meta['template'] : 'index';
|
|
|
$this->run_hooks('before_render', array(&$twig_vars, &$twig, &$template));
|
|
|
$output = $twig->render($template .'.html', $twig_vars);
|
|
@@ -138,6 +141,17 @@ class Pico {
|
|
|
{
|
|
|
$content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta
|
|
|
$content = str_replace('%base_url%', $this->base_url(), $content);
|
|
|
+
|
|
|
+ // pattern to find {column:xyz} {/column:xyz} column marker
|
|
|
+ $pattern = '#({column:(.*?)})(.+?)({/column:\\2})#ims';
|
|
|
+ preg_match_all($pattern, $content, $matches);
|
|
|
+
|
|
|
+ $counter = 0;
|
|
|
+ foreach ($matches[2] as $var) {
|
|
|
+ $this->columns[$var] = MarkdownExtra::defaultTransform($matches[3][$counter]);
|
|
|
+ $counter++;
|
|
|
+ }
|
|
|
+
|
|
|
$content = MarkdownExtra::defaultTransform($content);
|
|
|
|
|
|
return $content;
|