From 1cecd094230755345c2f94fe7f5a0e2578fd1ffd Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 17 Dec 2015 10:35:22 -0700 Subject: [PATCH] requires changes in parsedown --- .../Common/Markdown/ParsedownGravTrait.php | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 2051c4258..b4d4ff2f7 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -16,9 +16,11 @@ trait ParsedownGravTrait protected $base_url; protected $pages_dir; protected $special_chars; - protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/'; + public $completeable_blocks = []; + public $continueable_blocks = []; + /** * Initialization function to setup key variables needed by the MarkdownGravLinkTrait * @@ -55,9 +57,17 @@ trait ParsedownGravTrait * @param $type * @param $tag */ - public function addBlockType($type, $tag) + public function addBlockType($type, $tag, $continueable = false, $completeable = false) { $this->BlockTypes[$type] []= $tag; + + if ($continueable) { + $this->continueable_blocks[] = $tag; + } + + if ($completeable) { + $this->completeable_blocks[] = $tag; + } } /** @@ -72,6 +82,18 @@ trait ParsedownGravTrait $this->inlineMarkerList .= $type; } + protected function isBlockContinueable($Type) + { + $continueable = in_array($Type, $this->continueable_blocks) || method_exists($this, 'block'.$Type.'Continue'); + return $continueable; + } + + protected function isBlockCompleteable($Type) + { + $completeable = in_array($Type, $this->completeable_blocks) || method_exists($this, 'block'.$Type.'Complete'); + return $completeable; + } + /** * Make the element function publicly accessible, Medium uses this to render from Twig @@ -295,4 +317,6 @@ trait ParsedownGravTrait } } + + }