Upgrade to 3.2.0

This commit is contained in:
Bastian Allgeier
2019-06-25 09:56:08 +02:00
parent 9e18cf635d
commit 9c89153d35
296 changed files with 14408 additions and 2504 deletions

View File

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

View File

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

View File

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

View File

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