From d3856caf81c96b1ea2615a375122ca85e91a6fb3 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 12 Oct 2022 09:09:55 +0000 Subject: composer update michelf/php-markdown --- vendor/michelf/php-markdown/Michelf/Markdown.php | 94 ++++++++++-------------- 1 file changed, 37 insertions(+), 57 deletions(-) (limited to 'vendor/michelf/php-markdown/Michelf/Markdown.php') diff --git a/vendor/michelf/php-markdown/Michelf/Markdown.php b/vendor/michelf/php-markdown/Michelf/Markdown.php index f644080c7..746a2d048 100644 --- a/vendor/michelf/php-markdown/Michelf/Markdown.php +++ b/vendor/michelf/php-markdown/Michelf/Markdown.php @@ -4,7 +4,7 @@ * * @package php-markdown * @author Michel Fortin - * @copyright 2004-2021 Michel Fortin + * @copyright 2004-2022 Michel Fortin * @copyright (Original Markdown) 2004-2006 John Gruber */ @@ -18,7 +18,7 @@ class Markdown implements MarkdownInterface { * Define the package version * @var string */ - const MARKDOWNLIB_VERSION = "1.9.1"; + const MARKDOWNLIB_VERSION = "2.0.0"; /** * Simple function interface - Initialize the parser and return the result @@ -29,9 +29,9 @@ class Markdown implements MarkdownInterface { * @param string $text * @return string */ - public static function defaultTransform($text) { + public static function defaultTransform(string $text): string { // Take parser class on which this function was called. - $parser_class = \get_called_class(); + $parser_class = static::class; // Try to take parser from the static parser list static $parser_list; @@ -49,39 +49,34 @@ class Markdown implements MarkdownInterface { /** * Configuration variables */ - /** * Change to ">" for HTML output. - * @var string */ - public $empty_element_suffix = " />"; + public string $empty_element_suffix = " />"; /** * The width of indentation of the output markup - * @var int */ - public $tab_width = 4; + public int $tab_width = 4; /** * Change to `true` to disallow markup or entities. - * @var boolean */ - public $no_markup = false; - public $no_entities = false; + public bool $no_markup = false; + public bool $no_entities = false; /** * Change to `true` to enable line breaks on \n without two trailling spaces * @var boolean */ - public $hard_wrap = false; + public bool $hard_wrap = false; /** * Predefined URLs and titles for reference links and images. - * @var array */ - public $predef_urls = array(); - public $predef_titles = array(); + public array $predef_urls = array(); + public array $predef_titles = array(); /** * Optional filter function for URLs @@ -121,32 +116,27 @@ class Markdown implements MarkdownInterface { *
  • List item two
  • *
  • List item three
  • * - * - * @var bool */ - public $enhanced_ordered_list = false; + public bool $enhanced_ordered_list = false; /** * Parser implementation */ - /** * Regex to match balanced [brackets]. * Needed to insert a maximum bracked depth while converting to PHP. - * @var int */ - protected $nested_brackets_depth = 6; - protected $nested_brackets_re; + protected int $nested_brackets_depth = 6; + protected string $nested_brackets_re; - protected $nested_url_parenthesis_depth = 4; - protected $nested_url_parenthesis_re; + protected int $nested_url_parenthesis_depth = 4; + protected string $nested_url_parenthesis_re; /** * Table of hash values for escaped characters: - * @var string */ - protected $escape_chars = '\`*_{}[]()>#+-.!'; - protected $escape_chars_re; + protected string $escape_chars = '\`*_{}[]()>#+-.!'; + protected string $escape_chars_re; /** * Constructor function. Initialize appropriate member variables. @@ -175,23 +165,20 @@ class Markdown implements MarkdownInterface { /** * Internal hashes used during transformation. - * @var array */ - protected $urls = array(); - protected $titles = array(); - protected $html_hashes = array(); + protected array $urls = array(); + protected array $titles = array(); + protected array $html_hashes = array(); /** * Status flag to avoid invalid nesting. - * @var boolean */ - protected $in_anchor = false; + protected bool $in_anchor = false; /** * Status flag to avoid invalid nesting. - * @var boolean */ - protected $in_emphasis_processing = false; + protected bool $in_emphasis_processing = false; /** * Called before the transformation process starts to setup parser states. @@ -226,7 +213,7 @@ class Markdown implements MarkdownInterface { * @param string $text * @return string */ - public function transform($text) { + public function transform(string $text): string { $this->setup(); # Remove UTF-8 BOM and marker character in input, if present. @@ -263,9 +250,8 @@ class Markdown implements MarkdownInterface { /** * Define the document gamut - * @var array */ - protected $document_gamut = array( + protected array $document_gamut = array( // Strip link definitions, store in hashes. "stripLinkDefinitions" => 20, "runBasicBlockGamut" => 30, @@ -525,9 +511,8 @@ class Markdown implements MarkdownInterface { /** * Define the block gamut - these are all the transformations that form * block-level tags like paragraphs, headers, and list items. - * @var array */ - protected $block_gamut = array( + protected array $block_gamut = array( "doHeaders" => 10, "doHorizontalRules" => 20, "doLists" => 40, @@ -597,9 +582,8 @@ class Markdown implements MarkdownInterface { /** * These are all the transformations that occur *within* block-level * tags like paragraphs, headers, and list items. - * @var array */ - protected $span_gamut = array( + protected array $span_gamut = array( // Process character escapes, code spans, and inline HTML // in one shot. "parseSpan" => -30, @@ -724,7 +708,7 @@ class Markdown implements MarkdownInterface { /** * Callback method to parse referenced anchors - * @param string $matches + * @param array $matches * @return string */ protected function _doAnchors_reference_callback($matches) { @@ -763,7 +747,7 @@ class Markdown implements MarkdownInterface { /** * Callback method to parse inline anchors - * @param string $matches + * @param array $matches * @return string */ protected function _doAnchors_inline_callback($matches) { @@ -781,7 +765,7 @@ class Markdown implements MarkdownInterface { $url = $this->encodeURLAttribute($url); $result = "encodeAttribute($title); $result .= " title=\"$title\""; } @@ -1105,9 +1089,8 @@ class Markdown implements MarkdownInterface { /** * Nesting tracker for list levels - * @var integer */ - protected $list_level = 0; + protected int $list_level = 0; /** * Process the contents of a single ordered or unordered list, splitting it @@ -1248,7 +1231,7 @@ class Markdown implements MarkdownInterface { * Define the emphasis operators with their regex matches * @var array */ - protected $em_relist = array( + protected array $em_relist = array( '' => '(?:(? '(? '(? '(?:(? '(? '(? '(?:(? '(? '(?utf8_strlen = function($text) { - return preg_match_all('/[\x00-\xBF]|[\xC0-\xFF][\x80-\xBF]*/', $text, $m); - }; + $this->utf8_strlen = fn($text) => preg_match_all('/[\x00-\xBF]|[\xC0-\xFF][\x80-\xBF]*/', $text, $m); } /** -- cgit v1.2.3