requires changes in parsedown

This commit is contained in:
Andy Miller
2015-12-17 10:35:22 -07:00
parent 0142e76270
commit 1cecd09423

View File

@@ -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
}
}
}