Upgrade to 3.2.0
This commit is contained in:
@@ -8,6 +8,12 @@ use Kirby\Exception\BadMethodCallException;
|
||||
|
||||
/**
|
||||
* Representation and parse of a single KirbyTag.
|
||||
*
|
||||
* @package Kirby Text
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class KirbyTag
|
||||
{
|
||||
@@ -41,6 +47,7 @@ class KirbyTag
|
||||
}
|
||||
|
||||
foreach ($attrs as $attrName => $attrValue) {
|
||||
$attrName = strtolower($attrName);
|
||||
$this->$attrName = $attrValue;
|
||||
}
|
||||
|
||||
@@ -54,11 +61,13 @@ class KirbyTag
|
||||
|
||||
public function __get(string $attr)
|
||||
{
|
||||
return null;
|
||||
$attr = strtolower($attr);
|
||||
return $this->$attr ?? null;
|
||||
}
|
||||
|
||||
public function attr(string $name, $default = null)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
return $this->$name ?? $default;
|
||||
}
|
||||
|
||||
@@ -67,11 +76,18 @@ class KirbyTag
|
||||
return (new static(...$arguments))->render();
|
||||
}
|
||||
|
||||
public static function parse(string $string, array $data = [], array $options = []): self
|
||||
/**
|
||||
* @param string $string
|
||||
* @param array $data
|
||||
* @param array $options
|
||||
* @return self
|
||||
*/
|
||||
public static function parse(string $string, array $data = [], array $options = [])
|
||||
{
|
||||
// remove the brackets, extract the first attribute (the tag type)
|
||||
$tag = trim(rtrim(ltrim($string, '('), ')'));
|
||||
$type = trim(substr($tag, 0, strpos($tag, ':')));
|
||||
$type = strtolower($type);
|
||||
$attr = static::$types[$type]['attr'] ?? [];
|
||||
|
||||
// the type should be parsed as an attribute, so we add it here
|
||||
|
@@ -9,6 +9,12 @@ use Exception;
|
||||
* given string. KiryTags are defined via
|
||||
* `KirbyTag::$types`. The default tags for the
|
||||
* Cms are located in `kirby/config/tags.php`
|
||||
*
|
||||
* @package Kirby Text
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class KirbyTags
|
||||
{
|
||||
|
@@ -14,9 +14,9 @@ use ParsedownExtra;
|
||||
*
|
||||
* @package Kirby Text
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link http://getkirby.com
|
||||
* @copyright Bastian Allgeier
|
||||
* @license MIT
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class Markdown
|
||||
{
|
||||
|
@@ -12,9 +12,9 @@ use Michelf\SmartyPantsTypographer;
|
||||
*
|
||||
* @package Kirby Text
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link http://getkirby.com
|
||||
* @copyright Bastian Allgeier
|
||||
* @license MIT
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
class SmartyPants
|
||||
{
|
||||
|
Reference in New Issue
Block a user