diff options
| author | Greg Roach <fisharebest@gmail.com> | 2020-01-14 13:54:08 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2020-01-14 13:54:08 +0000 |
| commit | 26c0efaa53fae3c1687c1b9e1ee19ca56feb1627 (patch) | |
| tree | 47f27e499ae4543b955daaa9fb61b4a41d283916 /vendor/league/commonmark | |
| parent | c08d7baf56d5a2b3182f75d237bc83b6860e0646 (diff) | |
| download | webtrees-26c0efaa53fae3c1687c1b9e1ee19ca56feb1627.tar.gz webtrees-26c0efaa53fae3c1687c1b9e1ee19ca56feb1627.tar.bz2 webtrees-26c0efaa53fae3c1687c1b9e1ee19ca56feb1627.zip | |
Update vendor dependencies
Diffstat (limited to 'vendor/league/commonmark')
| -rw-r--r-- | vendor/league/commonmark/CHANGELOG.md | 10 | ||||
| -rw-r--r-- | vendor/league/commonmark/README.md | 2 | ||||
| -rw-r--r-- | vendor/league/commonmark/composer.json | 8 | ||||
| -rw-r--r-- | vendor/league/commonmark/src/CommonMarkConverter.php | 2 | ||||
| -rw-r--r-- | vendor/league/commonmark/src/Util/RegexHelper.php | 4 | ||||
| -rw-r--r-- | vendor/league/commonmark/src/Util/UrlEncoder.php | 115 |
6 files changed, 36 insertions, 105 deletions
diff --git a/vendor/league/commonmark/CHANGELOG.md b/vendor/league/commonmark/CHANGELOG.md index 7713f8ff01..eaa424c8a6 100644 --- a/vendor/league/commonmark/CHANGELOG.md +++ b/vendor/league/commonmark/CHANGELOG.md @@ -4,6 +4,13 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi ## [Unreleased][unreleased] +## [1.2.0] - 2020-01-09 + +### Changed + + - Removed URL decoding step before encoding (more performant and better matches the JS library) + - Removed redundant token from HTML tag regex + ## [1.1.2] - 2019-12-09 ### Fixed @@ -180,7 +187,8 @@ No changes were made since 1.0.0-rc1. - Removed `DelimiterStack::iterateByCharacters()` (use the new `processDelimiters()` method instead) - Removed the protected `DelimiterStack::findMatchingOpener()` method -[unreleased]: https://github.com/thephpleague/commonmark/compare/1.1.2...HEAD +[unreleased]: https://github.com/thephpleague/commonmark/compare/1.2.0...HEAD +[1.2.0]: https://github.com/thephpleague/commonmark/compare/1.1.2...1.2.0 [1.1.2]: https://github.com/thephpleague/commonmark/compare/1.1.1...1.1.2 [1.1.1]: https://github.com/thephpleague/commonmark/compare/1.1.0...1.1.1 [1.1.0]: https://github.com/thephpleague/commonmark/compare/1.0.0...1.1.0 diff --git a/vendor/league/commonmark/README.md b/vendor/league/commonmark/README.md index 12df509f47..4732b88c36 100644 --- a/vendor/league/commonmark/README.md +++ b/vendor/league/commonmark/README.md @@ -88,6 +88,8 @@ Custom parsers/renderers can be bundled into extensions which extend CommonMark. - [CommonMark Attributes Extension](https://github.com/webuni/commonmark-attributes-extension) - Adds a syntax to define attributes on the various HTML elements. - [Alt Three Emoji](https://github.com/AltThree/Emoji) An emoji parser for CommonMark. - [Sup Sub extensions](https://github.com/OWS/commonmark-sup-sub-extensions) - Adds support of superscript and subscript (`<sup>` and `<sub>` HTML tags) + - [YouTube iframe extension](https://github.com/zoonru/commonmark-ext-youtube-iframe) - Replaces youtube link with iframe. + - [Footnotes extension](https://github.com/rezozero/commonmark-ext-footnotes) - Adds support for referencing footnotes inline and rendering them at the bottom of your content Others can be found on [Packagist under the `commonmark-extension` package type](https://packagist.org/packages/league/commonmark?type=commonmark-extension). diff --git a/vendor/league/commonmark/composer.json b/vendor/league/commonmark/composer.json index 3c28bd0c1a..8cdc63628f 100644 --- a/vendor/league/commonmark/composer.json +++ b/vendor/league/commonmark/composer.json @@ -29,7 +29,7 @@ "require-dev": { "ext-json": "*", "cebe/markdown": "~1.0", - "commonmark/commonmark.js": "0.29.0", + "commonmark/commonmark.js": "0.29.1", "erusev/parsedown": "~1.0", "michelf/php-markdown": "~1.4", "mikehaertl/php-shellcommand": "^1.4", @@ -46,9 +46,9 @@ "type": "package", "package": { "name": "commonmark/commonmark.js", - "version": "0.29.0", + "version": "0.29.1", "dist": { - "url": "https://github.com/commonmark/commonmark.js/archive/0.29.0.zip", + "url": "https://github.com/commonmark/commonmark.js/archive/0.29.1.zip", "type": "zip" } } @@ -76,7 +76,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "config": { diff --git a/vendor/league/commonmark/src/CommonMarkConverter.php b/vendor/league/commonmark/src/CommonMarkConverter.php index cd14268e12..786ada5bce 100644 --- a/vendor/league/commonmark/src/CommonMarkConverter.php +++ b/vendor/league/commonmark/src/CommonMarkConverter.php @@ -24,7 +24,7 @@ class CommonMarkConverter extends Converter * * This might be a typical `x.y.z` version, or `x.y-dev`. */ - public const VERSION = '1.1.2'; + public const VERSION = '1.2.0'; /** @var EnvironmentInterface */ protected $environment; diff --git a/vendor/league/commonmark/src/Util/RegexHelper.php b/vendor/league/commonmark/src/Util/RegexHelper.php index 86cb3da924..c39d9edcfe 100644 --- a/vendor/league/commonmark/src/Util/RegexHelper.php +++ b/vendor/league/commonmark/src/Util/RegexHelper.php @@ -31,7 +31,7 @@ final class RegexHelper public const PARTIAL_REG_CHAR = '[^\\\\()\x00-\x20]'; public const PARTIAL_IN_PARENS_NOSP = '\((' . self::PARTIAL_REG_CHAR . '|' . self::PARTIAL_ESCAPED_CHAR . '|\\\\)*\)'; public const PARTIAL_TAGNAME = '[A-Za-z][A-Za-z0-9-]*'; - public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|title|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)'; + public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)'; public const PARTIAL_ATTRIBUTENAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; public const PARTIAL_UNQUOTEDVALUE = '[^"\'=<>`\x00-\x20]+'; public const PARTIAL_SINGLEQUOTEDVALUE = '\'[^\']*\''; @@ -173,7 +173,7 @@ final class RegexHelper case HtmlBlock::TYPE_5_CDATA: return '/^<!\[CDATA\[/'; case HtmlBlock::TYPE_6_BLOCK_ELEMENT: - return '%^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|title|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)%i'; + return '%^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)%i'; case HtmlBlock::TYPE_7_MISC_ELEMENT: return '/^(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . ')\\s*$/i'; } diff --git a/vendor/league/commonmark/src/Util/UrlEncoder.php b/vendor/league/commonmark/src/Util/UrlEncoder.php index 527fc57277..c7e40ddebb 100644 --- a/vendor/league/commonmark/src/Util/UrlEncoder.php +++ b/vendor/league/commonmark/src/Util/UrlEncoder.php @@ -16,42 +16,7 @@ namespace League\CommonMark\Util; final class UrlEncoder { - protected static $dontEncode = [ - '%21' => '!', - '%23' => '#', - '%24' => '$', - '%26' => '&', - '%27' => '\'', - '%28' => '(', - '%29' => ')', - '%2A' => '*', - '%2B' => '+', - '%2C' => ',', - '%2D' => '-', - '%2E' => '.', - '%2F' => '/', - '%3A' => ':', - '%3B' => ';', - '%3D' => '=', - '%3F' => '?', - '%40' => '@', - '%5F' => '_', - '%7E' => '~', - ]; - - protected static $dontDecode = [ - '%3B' => ';', - '%2F' => '/', - '%3F' => '?', - '%3A' => ':', - '%40' => '@', - '%26' => '&', - '%3D' => '=', - '%2B' => '+', - '%24' => '$', - '%2C' => ',', - '%23' => '#', - ]; + private static $encodeCache = ['%00', '%01', '%02', '%03', '%04', '%05', '%06', '%07', '%08', '%09', '%0A', '%0B', '%0C', '%0D', '%0E', '%0F', '%10', '%11', '%12', '%13', '%14', '%15', '%16', '%17', '%18', '%19', '%1A', '%1B', '%1C', '%1D', '%1E', '%1F', '%20', '!', '%22', '#', '$', '%25', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '%3C', '=', '%3E', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '%5B', '%5C', '%5D', '%5E', '_', '%60', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '%7B', '%7C', '%7D', '~', '%7F']; /** * @param string $uri @@ -60,73 +25,29 @@ final class UrlEncoder */ public static function unescapeAndEncode(string $uri): string { - $decoded = \html_entity_decode($uri); - - return self::encode(self::decode($decoded)); - } - - /** - * Decode a percent-encoded URI - * - * @param string $uri - * - * @return string - */ - private static function decode(string $uri): string - { - /** @var string $ret */ - $ret = \preg_replace_callback('/((?:%[0-9a-f]{2})+)/iu', function ($matches) { - $bytes = \hex2bin(\str_replace('%', '', $matches[1])); - - // Invalid UTF-8 sequences should be kept as-is - if ($bytes === false || !\mb_check_encoding($bytes, 'UTF-8')) { - return \strtoupper($matches[0]); - } + $result = ''; - // Otherwise, split the sequence into characters and decode them (unless that character shouldn't be decoded) - /** @var string[] $characters */ - $characters = \preg_split('//u', $bytes, -1, \PREG_SPLIT_NO_EMPTY); - - $ret = ''; - foreach ($characters as $char) { - if (($encoding = \array_search($char, self::$dontDecode, true)) !== false) { - $ret .= $encoding; - } else { - $ret .= $char; + /** @var string[] $chars */ + $chars = \preg_split('//u', $uri, -1, \PREG_SPLIT_NO_EMPTY); + $l = \count($chars); + for ($i = 0; $i < $l; $i++) { + $code = $chars[$i]; + if ($code === '%' && $i + 2 < $l) { + if (\preg_match('/^[0-9a-f]{2}$/i', $chars[$i + 1] . $chars[$i + 2]) === 1) { + $result .= '%' . $chars[$i + 1] . $chars[$i + 2]; + $i += 2; + continue; } } - return $ret; - }, $uri); - - return $ret; - } - - /** - * Encode a URI, preserving already-encoded and excluded characters - * - * @param string $uri - * - * @return string - */ - private static function encode(string $uri): string - { - /** @var string $ret */ - $ret = \preg_replace_callback('/(%[0-9a-f]{2})|./isu', function ($matches) { - // Keep already-encoded characters as-is - if (\count($matches) > 1) { - return $matches[0]; - } - - // Keep excluded characters as-is - if (\in_array($matches[0], self::$dontEncode)) { - return $matches[0]; + if (\ord($code) < 128) { + $result .= self::$encodeCache[\ord($code)]; + continue; } - // Otherwise, encode the character - return \rawurlencode($matches[0]); - }, $uri); + $result .= \rawurlencode($code); + } - return $ret; + return $result; } } |
