From bd0ff478da33656c3ba72eace965e6c0a71a0435 Mon Sep 17 00:00:00 2001 From: Greg Roach Date: Sat, 27 Jun 2020 11:39:49 +0100 Subject: Update vendor dependencies --- vendor/composer/installed.json | 83 +++--- vendor/league/commonmark/.phpstorm.meta.php | 2 +- vendor/league/commonmark/CHANGELOG.md | 43 ++- vendor/league/commonmark/CODE_OF_CONDUCT.md | 22 -- vendor/league/commonmark/README.md | 12 +- vendor/league/commonmark/composer.json | 7 +- .../league/commonmark/src/CommonMarkConverter.php | 5 +- .../Extension/Attributes/AttributesExtension.php | 32 +++ .../Attributes/Event/AttributesListener.php | 141 ++++++++++ .../src/Extension/Attributes/Node/Attributes.php | 62 ++++ .../Extension/Attributes/Node/AttributesInline.php | 50 ++++ .../Attributes/Parser/AttributesBlockParser.php | 44 +++ .../Attributes/Parser/AttributesInlineParser.php | 58 ++++ .../Extension/Attributes/Util/AttributesHelper.php | 130 +++++++++ .../src/Extension/Autolink/InlineMentionParser.php | 6 + .../ExternalLink/ExternalLinkProcessor.php | 34 ++- .../Footnote/Event/AnonymousFootnotesListener.php | 51 ++++ .../Footnote/Event/GatherFootnotesListener.php | 87 ++++++ .../Footnote/Event/NumberFootnotesListener.php | 86 ++++++ .../src/Extension/Footnote/FootnoteExtension.php | 53 ++++ .../src/Extension/Footnote/Node/Footnote.php | 75 +++++ .../Extension/Footnote/Node/FootnoteBackref.php | 37 +++ .../Extension/Footnote/Node/FootnoteContainer.php | 39 +++ .../src/Extension/Footnote/Node/FootnoteRef.php | 56 ++++ .../Footnote/Parser/AnonymousFootnoteRefParser.php | 71 +++++ .../Extension/Footnote/Parser/FootnoteParser.php | 63 +++++ .../Footnote/Parser/FootnoteRefParser.php | 58 ++++ .../Footnote/Renderer/FootnoteBackrefRenderer.php | 49 ++++ .../Renderer/FootnoteContainerRenderer.php | 52 ++++ .../Footnote/Renderer/FootnoteRefRenderer.php | 62 ++++ .../Footnote/Renderer/FootnoteRenderer.php | 64 +++++ .../HeadingPermalink/HeadingPermalinkProcessor.php | 46 ++- .../HeadingPermalink/HeadingPermalinkRenderer.php | 14 +- .../HeadingPermalink/Slug/DefaultSlugGenerator.php | 6 + .../Slug/SlugGeneratorInterface.php | 7 + .../Mention/Generator/CallbackGenerator.php | 48 ++++ .../Generator/MentionGeneratorInterface.php | 25 ++ .../Generator/StringTemplateLinkGenerator.php | 31 ++ .../commonmark/src/Extension/Mention/Mention.php | 104 +++++++ .../src/Extension/Mention/MentionExtension.php | 40 +++ .../src/Extension/Mention/MentionParser.php | 91 ++++++ .../TableOfContents/Node/TableOfContents.php | 21 ++ .../Node/TableOfContentsPlaceholder.php | 33 +++ .../Normalizer/AsIsNormalizerStrategy.php | 5 +- .../Normalizer/FlatNormalizerStrategy.php | 5 +- .../Normalizer/RelativeNormalizerStrategy.php | 5 +- .../Extension/TableOfContents/TableOfContents.php | 16 +- .../TableOfContents/TableOfContentsBuilder.php | 157 ++++------- .../TableOfContents/TableOfContentsExtension.php | 7 + .../TableOfContents/TableOfContentsGenerator.php | 149 ++++++++++ .../TableOfContentsGeneratorInterface.php | 23 ++ .../TableOfContentsPlaceholderParser.php | 47 ++++ .../TableOfContentsPlaceholderRenderer.php | 24 ++ vendor/league/commonmark/src/Node/Node.php | 21 ++ .../commonmark/src/Normalizer/SlugNormalizer.php | 37 +++ .../commonmark/src/Normalizer/TextNormalizer.php | 51 ++++ .../src/Normalizer/TextNormalizerInterface.php | 26 ++ .../league/commonmark/src/Reference/Reference.php | 29 +- .../commonmark/src/Reference/ReferenceMap.php | 19 +- vendor/symfony/polyfill-ctype/composer.json | 4 + .../polyfill-iconv/Resources/charset/translit.php | 41 +-- vendor/symfony/polyfill-iconv/composer.json | 4 + vendor/symfony/polyfill-intl-idn/composer.json | 4 + .../Resources/unidata/lowerCase.php | 303 +++++++++++++++++++- .../Resources/unidata/upperCase.php | 312 ++++++++++++++++++++- vendor/symfony/polyfill-mbstring/composer.json | 4 + 66 files changed, 3160 insertions(+), 233 deletions(-) delete mode 100644 vendor/league/commonmark/CODE_OF_CONDUCT.md create mode 100644 vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php create mode 100644 vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php create mode 100644 vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php create mode 100644 vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php create mode 100644 vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php create mode 100644 vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php create mode 100644 vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php create mode 100644 vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php create mode 100644 vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php create mode 100644 vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php create mode 100644 vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php create mode 100644 vendor/league/commonmark/src/Extension/Mention/Mention.php create mode 100644 vendor/league/commonmark/src/Extension/Mention/MentionExtension.php create mode 100644 vendor/league/commonmark/src/Extension/Mention/MentionParser.php create mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php create mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php create mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php create mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php create mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php create mode 100644 vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php create mode 100644 vendor/league/commonmark/src/Normalizer/SlugNormalizer.php create mode 100644 vendor/league/commonmark/src/Normalizer/TextNormalizer.php create mode 100644 vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php (limited to 'vendor') diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 2e4bb2bcdd..8da3d9b576 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1370,22 +1370,22 @@ }, { "name": "league/commonmark", - "version": "1.4.3", - "version_normalized": "1.4.3.0", + "version": "1.5.0", + "version_normalized": "1.5.0.0", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "412639f7cfbc0b31ad2455b2fe965095f66ae505" + "reference": "fc33ca12575e98e57cdce7d5f38b2ca5335714b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/412639f7cfbc0b31ad2455b2fe965095f66ae505", - "reference": "412639f7cfbc0b31ad2455b2fe965095f66ae505", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/fc33ca12575e98e57cdce7d5f38b2ca5335714b3", + "reference": "fc33ca12575e98e57cdce7d5f38b2ca5335714b3", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "conflict": { "scrutinizer/ocular": "1.7.*" @@ -1403,16 +1403,11 @@ "scrutinizer/ocular": "^1.5", "symfony/finder": "^4.2" }, - "time": "2020-05-04T22:15:21+00:00", + "time": "2020-06-21T20:50:13+00:00", "bin": [ "bin/commonmark" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { @@ -3042,17 +3037,17 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.0", - "version_normalized": "1.17.0.0", + "version": "v1.17.1", + "version_normalized": "1.17.1.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", "shasum": "" }, "require": { @@ -3061,11 +3056,15 @@ "suggest": { "ext-ctype": "For best performance" }, - "time": "2020-05-12T16:14:59+00:00", + "time": "2020-06-06T08:46:27+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "installation-source": "dist", @@ -3116,17 +3115,17 @@ }, { "name": "symfony/polyfill-iconv", - "version": "v1.17.0", - "version_normalized": "1.17.0.0", + "version": "v1.17.1", + "version_normalized": "1.17.1.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "c4de7601eefbf25f9d47190abe07f79fe0a27424" + "reference": "ba6c9c18db36235b859cc29b8372d1c01298c035" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/c4de7601eefbf25f9d47190abe07f79fe0a27424", - "reference": "c4de7601eefbf25f9d47190abe07f79fe0a27424", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/ba6c9c18db36235b859cc29b8372d1c01298c035", + "reference": "ba6c9c18db36235b859cc29b8372d1c01298c035", "shasum": "" }, "require": { @@ -3135,11 +3134,15 @@ "suggest": { "ext-iconv": "For best performance" }, - "time": "2020-05-12T16:47:27+00:00", + "time": "2020-06-06T08:46:27+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "installation-source": "dist", @@ -3191,17 +3194,17 @@ }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.17.0", - "version_normalized": "1.17.0.0", + "version": "v1.17.1", + "version_normalized": "1.17.1.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a" + "reference": "a57f8161502549a742a63c09f0a604997bf47027" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a", - "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a57f8161502549a742a63c09f0a604997bf47027", + "reference": "a57f8161502549a742a63c09f0a604997bf47027", "shasum": "" }, "require": { @@ -3212,11 +3215,15 @@ "suggest": { "ext-intl": "For best performance" }, - "time": "2020-05-12T16:47:27+00:00", + "time": "2020-06-06T08:46:27+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "installation-source": "dist", @@ -3269,17 +3276,17 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.0", - "version_normalized": "1.17.0.0", + "version": "v1.17.1", + "version_normalized": "1.17.1.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" + "reference": "7110338d81ce1cbc3e273136e4574663627037a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7", + "reference": "7110338d81ce1cbc3e273136e4574663627037a7", "shasum": "" }, "require": { @@ -3288,11 +3295,15 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2020-05-12T16:47:27+00:00", + "time": "2020-06-06T08:46:27+00:00", "type": "library", "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "installation-source": "dist", diff --git a/vendor/league/commonmark/.phpstorm.meta.php b/vendor/league/commonmark/.phpstorm.meta.php index 6664a7abf5..53614d78e2 100644 --- a/vendor/league/commonmark/.phpstorm.meta.php +++ b/vendor/league/commonmark/.phpstorm.meta.php @@ -27,7 +27,7 @@ namespace PHPSTORM_META expectedArguments(\League\CommonMark\Inline\Element\Newline::__construct(), 0, argumentsSet('league_commonmark_newline_types')); expectedReturnValues(\League\CommonMark\Inline\Element\Newline::getType(), argumentsSet('league_commonmark_newline_types')); - registerArgumentsSet('league_commonmark_options', 'renderer', 'enable_em', 'enable_strong', 'use_asterisk', 'use_underscore', 'unordered_list_markers', 'html_input', 'allow_unsafe_links', 'max_nesting_level', 'heading_permalink', 'heading_permalink/html_class', 'heading_permalink/id_prefix', 'heading_permalink/inner_contents', 'heading_permalink/insert', 'heading_permalink/title', 'table_of_contents', 'table_of_contents/style', 'table_of_contents/normalize', 'table_of_contents/position', 'table_of_contents/html_class', 'table_of_contents/min_heading_level', 'table_of_contents/max_heading_level'); + registerArgumentsSet('league_commonmark_options', 'renderer', 'enable_em', 'enable_strong', 'use_asterisk', 'use_underscore', 'unordered_list_markers', 'html_input', 'allow_unsafe_links', 'max_nesting_level', 'external_link', 'external_link/nofollow', 'external_link/noopener', 'external_link/noreferrer', 'footnote', 'footnote/backref_class', 'footnote/container_add_hr', 'footnote/container_class', 'footnote/ref_class', 'footnote/ref_id_prefix', 'footnote/footnote_class', 'footnote/footnote_id_prefix', 'heading_permalink', 'heading_permalink/html_class', 'heading_permalink/id_prefix', 'heading_permalink/inner_contents', 'heading_permalink/insert', 'heading_permalink/slug_normalizer', 'heading_permalink/symbol', 'heading_permalink/title', 'table_of_contents', 'table_of_contents/style', 'table_of_contents/normalize', 'table_of_contents/position', 'table_of_contents/html_class', 'table_of_contents/min_heading_level', 'table_of_contents/max_heading_level', 'table_of_contents/placeholder'); expectedArguments(\League\CommonMark\EnvironmentInterface::getConfig(), 0, argumentsSet('league_commonmark_options')); expectedArguments(\League\CommonMark\Util\ConfigurationInterface::get(), 0, argumentsSet('league_commonmark_options')); expectedArguments(\League\CommonMark\Util\ConfigurationInterface::set(), 0, argumentsSet('league_commonmark_options')); diff --git a/vendor/league/commonmark/CHANGELOG.md b/vendor/league/commonmark/CHANGELOG.md index f506d92fd3..f6aaa5fde2 100644 --- a/vendor/league/commonmark/CHANGELOG.md +++ b/vendor/league/commonmark/CHANGELOG.md @@ -4,6 +4,46 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi ## [Unreleased][unreleased] +## [1.5.0] - 2020-06-21 + +### Added + + - Added new `AttributesExtension` based on (#474) + - Added new `FootnoteExtension` based on (#474) + - Added new `MentionExtension` to replace `InlineMentionParser` with more flexibility and customization + - Added the ability to render `TableOfContents` nodes anywhere in a document (given by a placeholder) + - Added the ability to properly clone `Node` objects + - Added options to customize the value of `rel` attributes set via the `ExternalLink` extension (#476) + - Added a new `heading_permalink/slug_normalizer` configuration option to allow custom slug generation (#460) + - Added a new `heading_permalink/symbol` configuration option to replace the now deprecated `heading_permalink/inner_contents` configuration option (#505) + - Added `SlugNormalizer` and `TextNormalizer` classes to make normalization reusable by extensions (#485) + - Added new classes: + - `TableOfContentsGenerator` + - `TableOfContentsGeneratorInterface` + - `TableOfContentsPlaceholder` + - `TableOfContentsPlaceholderParser` + - `TableOfContentsPlaceholderRenderer` + +### Changed + + - "Moved" the `TableOfContents` class into a new `Node` sub-namespace (with backward-compatibility) + - Reference labels are now generated and stored in lower-case instead of upper-case + - Reference labels are no longer normalized inside the `Reference`, only the `ReferenceMap` + +### Fixed + + - Fixed reference label case folding polyfill not being consistent between different PHP versions + +### Deprecated + + - Deprecated the `CommonMarkConverter::VERSION` constant (#496) + - Deprecated `League\CommonMark\Extension\Autolink\InlineMentionParser` (use `League\CommonMark\Extension\Mention\MentionParser` instead) + - Deprecated everything under `League\CommonMark\Extension\HeadingPermalink\Slug` (use the classes under `League\CommonMark\Normalizer` instead) + - Deprecated `League\CommonMark\Extension\TableOfContents\TableOfContents` (use the one in the new `Node` sub-namespace instead) + - Deprecated the `STYLE_` and `NORMALIZE_` constants in `TableOfContentsBuilder` (use the ones in `TableOfContentsGenerator` instead) + - Deprecated the `\League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkRenderer::DEFAULT_INNER_CONTENTS` constant (#505) + - Deprecated the `heading_permalink/inner_contents` configuration option in the `HeadingPermalink` extension (use the new `heading_permalink/symbol` configuration option instead) (#505) + ## [1.4.3] - 2020-05-04 ### Fixed @@ -301,7 +341,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.4.3...HEAD +[unreleased]: https://github.com/thephpleague/commonmark/compare/1.5.0...HEAD +[1.5.0]: https://github.com/thephpleague/commonmark/compare/1.4.3...1.5.0 [1.4.3]: https://github.com/thephpleague/commonmark/compare/1.4.2...1.4.3 [1.4.2]: https://github.com/thephpleague/commonmark/compare/1.4.1...1.4.2 [1.4.1]: https://github.com/thephpleague/commonmark/compare/1.4.0...1.4.1 diff --git a/vendor/league/commonmark/CODE_OF_CONDUCT.md b/vendor/league/commonmark/CODE_OF_CONDUCT.md deleted file mode 100644 index 01b8644f13..0000000000 --- a/vendor/league/commonmark/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,22 +0,0 @@ -# Contributor Code of Conduct - -As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. - -We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, such as physical or electronic addresses, without explicit permission -* Other unethical or unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/vendor/league/commonmark/README.md b/vendor/league/commonmark/README.md index 5b5f2fdfe1..f800d51ff7 100644 --- a/vendor/league/commonmark/README.md +++ b/vendor/league/commonmark/README.md @@ -3,7 +3,7 @@ [![Latest Version](https://img.shields.io/packagist/v/league/commonmark.svg?style=flat-square)](https://packagist.org/packages/league/commonmark) [![Total Downloads](https://img.shields.io/packagist/dt/league/commonmark.svg?style=flat-square)](https://packagist.org/packages/league/commonmark) [![Software License](https://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square)](LICENSE) -[![Build Status](https://img.shields.io/travis/thephpleague/commonmark/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/commonmark) +[![Build Status](https://img.shields.io/travis/thephpleague/commonmark/1.5.svg?style=flat-square)](https://travis-ci.org/thephpleague/commonmark) [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark/code-structure) [![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/126/badge)](https://bestpractices.coreinfrastructure.org/projects/126) @@ -81,7 +81,7 @@ See the [Extensions documentation](https://commonmark.thephpleague.com/customiza ### Integrations - [CakePHP 3](https://github.com/gourmet/common-mark) -- [Drupal 7 & 8](https://www.drupal.org/project/markdown) +- [Drupal](https://www.drupal.org/project/markdown) - [Laravel 4 & 5](https://github.com/GrahamCampbell/Laravel-Markdown) - [Sculpin](https://github.com/bcremer/sculpin-commonmark-bundle) - [Symfony 2 & 3](https://github.com/webuni/commonmark-bundle) @@ -91,17 +91,15 @@ See the [Extensions documentation](https://commonmark.thephpleague.com/customiza ### Included Extensions -See [our extension documentation](https://commonmark.thephpleague.com/customization/extensions/#included-extensions) for a full list of extensions bundled with this library. +See [our extension documentation](https://commonmark.thephpleague.com/extensions/overview) for a full list of extensions bundled with this library. ### Community Extensions Custom parsers/renderers can be bundled into extensions which extend CommonMark. Here are some that you may find interesting: - - [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 (`` and `` 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). @@ -142,7 +140,7 @@ Contributions to this library are **welcome**, especially ones that: Major refactoring to core parsing logic should be avoided if possible so that we can easily follow updates made to [the reference implementation][commonmark.js]. That being said, we will absolutely consider changes which don't deviate too far from the reference spec or which are favored by other popular CommonMark implementations. -Please see [CONTRIBUTING](https://github.com/thephpleague/commonmark/blob/master/.github/CONTRIBUTING.md) for additional details. +Please see [CONTRIBUTING](https://github.com/thephpleague/commonmark/blob/latest/.github/CONTRIBUTING.md) for additional details. ## 🧪 Testing @@ -188,7 +186,7 @@ This project is primarily maintained by [Colin O'Dell][@colinodell]. Members of ## 🗺️ Who Uses It? -This project is used by [Laravel Framework](https://laravel.com/), [Cachet](https://cachethq.io/), [Firefly III](https://firefly-iii.org/), [Neos](https://www.neos.io/), [Daux.io](https://daux.io/), and [more](https://packagist.org/packages/league/commonmark/dependents)! +This project is used by [Drupal](https://www.drupal.org/project/markdown), [Laravel Framework](https://laravel.com/), [Cachet](https://cachethq.io/), [Firefly III](https://firefly-iii.org/), [Neos](https://www.neos.io/), [Daux.io](https://daux.io/), and [more](https://packagist.org/packages/league/commonmark/dependents)! --- diff --git a/vendor/league/commonmark/composer.json b/vendor/league/commonmark/composer.json index 48f2509d8a..3a39e2820d 100644 --- a/vendor/league/commonmark/composer.json +++ b/vendor/league/commonmark/composer.json @@ -20,7 +20,7 @@ "source": "https://github.com/thephpleague/commonmark" }, "require": { - "php": "^7.1", + "php": "^7.1 || ^8.0", "ext-mbstring": "*" }, "require-dev": { @@ -83,11 +83,6 @@ "@phpunit" ] }, - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "config": { "sort-packages": true } diff --git a/vendor/league/commonmark/src/CommonMarkConverter.php b/vendor/league/commonmark/src/CommonMarkConverter.php index 9cf74031d2..76cffbe029 100644 --- a/vendor/league/commonmark/src/CommonMarkConverter.php +++ b/vendor/league/commonmark/src/CommonMarkConverter.php @@ -23,8 +23,11 @@ class CommonMarkConverter extends Converter * The currently-installed version. * * This might be a typical `x.y.z` version, or `x.y-dev`. + * + * @deprecated in 1.5.0 and will be removed from 2.0.0. + * Use \Composer\InstalledVersions provided by composer-runtime-api instead. */ - public const VERSION = '1.4.3'; + public const VERSION = '1.5.0'; /** @var EnvironmentInterface */ protected $environment; diff --git a/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php b/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php new file mode 100644 index 0000000000..f98ac26acd --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php @@ -0,0 +1,32 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes; + +use League\CommonMark\ConfigurableEnvironmentInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Attributes\Event\AttributesListener; +use League\CommonMark\Extension\Attributes\Parser\AttributesBlockParser; +use League\CommonMark\Extension\Attributes\Parser\AttributesInlineParser; +use League\CommonMark\Extension\ExtensionInterface; + +final class AttributesExtension implements ExtensionInterface +{ + public function register(ConfigurableEnvironmentInterface $environment) + { + $environment->addBlockParser(new AttributesBlockParser()); + $environment->addInlineParser(new AttributesInlineParser()); + $environment->addEventListener(DocumentParsedEvent::class, [new AttributesListener(), 'processDocument']); + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php b/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php new file mode 100644 index 0000000000..c83ccc7404 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php @@ -0,0 +1,141 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Event; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Block\Element\FencedCode; +use League\CommonMark\Block\Element\ListBlock; +use League\CommonMark\Block\Element\ListItem; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Attributes\Node\Attributes; +use League\CommonMark\Extension\Attributes\Node\AttributesInline; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Inline\Element\AbstractInline; +use League\CommonMark\Node\Node; + +final class AttributesListener +{ + private const DIRECTION_PREFIX = 'prefix'; + private const DIRECTION_SUFFIX = 'suffix'; + + public function processDocument(DocumentParsedEvent $event): void + { + $walker = $event->getDocument()->walker(); + while ($event = $walker->next()) { + $node = $event->getNode(); + if (!$node instanceof AttributesInline && ($event->isEntering() || !$node instanceof Attributes)) { + continue; + } + + [$target, $direction] = self::findTargetAndDirection($node); + + if ($target instanceof AbstractBlock || $target instanceof AbstractInline) { + $parent = $target->parent(); + if ($parent instanceof ListItem && $parent->parent() instanceof ListBlock && $parent->parent()->isTight()) { + $target = $parent; + } + + if ($direction === self::DIRECTION_SUFFIX) { + $attributes = AttributesHelper::mergeAttributes($target, $node->getAttributes()); + } else { + $attributes = AttributesHelper::mergeAttributes($node->getAttributes(), $target); + } + + $target->data['attributes'] = $attributes; + } + + if ($node instanceof AbstractBlock && $node->endsWithBlankLine() && $node->next() && $node->previous()) { + $previous = $node->previous(); + if ($previous instanceof AbstractBlock) { + $previous->setLastLineBlank(true); + } + } + + $node->detach(); + } + } + + /** + * @param Node $node + * + * @return array + */ + private static function findTargetAndDirection(Node $node): array + { + $target = null; + $direction = null; + $previous = $next = $node; + while (true) { + $previous = self::getPrevious($previous); + $next = self::getNext($next); + + if ($previous === null && $next === null) { + if (!$node->parent() instanceof FencedCode) { + $target = $node->parent(); + $direction = self::DIRECTION_SUFFIX; + } + + break; + } + + if ($node instanceof AttributesInline && ($previous === null || ($previous instanceof AbstractInline && $node->isBlock()))) { + continue; + } + + if ($previous !== null && !self::isAttributesNode($previous)) { + $target = $previous; + $direction = self::DIRECTION_SUFFIX; + + break; + } + + if ($next !== null && !self::isAttributesNode($next)) { + $target = $next; + $direction = self::DIRECTION_PREFIX; + + break; + } + } + + return [$target, $direction]; + } + + private static function getPrevious(?Node $node = null): ?Node + { + $previous = $node instanceof Node ? $node->previous() : null; + + if ($previous instanceof AbstractBlock && $previous->endsWithBlankLine()) { + $previous = null; + } + + return $previous; + } + + private static function getNext(?Node $node = null): ?Node + { + $next = $node instanceof Node ? $node->next() : null; + + if ($node instanceof AbstractBlock && $node->endsWithBlankLine()) { + $next = null; + } + + return $next; + } + + private static function isAttributesNode(Node $node): bool + { + return $node instanceof Attributes || $node instanceof AttributesInline; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php b/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php new file mode 100644 index 0000000000..13cd5fe28d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php @@ -0,0 +1,62 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Node; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Cursor; + +final class Attributes extends AbstractBlock +{ + /** @var array */ + private $attributes; + + /** + * @param array $attributes + */ + public function __construct(array $attributes) + { + $this->attributes = $attributes; + } + + /** + * @return array + */ + public function getAttributes(): array + { + return $this->attributes; + } + + public function canContain(AbstractBlock $block): bool + { + return false; + } + + public function isCode(): bool + { + return false; + } + + public function matchesNextLine(Cursor $cursor): bool + { + $this->setLastLineBlank($cursor->isBlank()); + + return false; + } + + public function shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber): bool + { + return false; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php b/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php new file mode 100644 index 0000000000..01cfa1825c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php @@ -0,0 +1,50 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Node; + +use League\CommonMark\Inline\Element\AbstractInline; + +final class AttributesInline extends AbstractInline +{ + /** @var array */ + public $attributes; + + /** @var bool */ + public $block; + + /** + * @param array $attributes + * @param bool $block + */ + public function __construct(array $attributes, bool $block) + { + $this->attributes = $attributes; + $this->block = $block; + $this->data = ['delim' => true]; // TODO: Re-implement as a delimiter? + } + + /** + * @return array + */ + public function getAttributes(): array + { + return $this->attributes; + } + + public function isBlock(): bool + { + return $this->block; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php new file mode 100644 index 0000000000..6eb4b74353 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockParser.php @@ -0,0 +1,44 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Parser; + +use League\CommonMark\Block\Parser\BlockParserInterface; +use League\CommonMark\ContextInterface; +use League\CommonMark\Cursor; +use League\CommonMark\Extension\Attributes\Node\Attributes; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; + +final class AttributesBlockParser implements BlockParserInterface +{ + public function parse(ContextInterface $context, Cursor $cursor): bool + { + $state = $cursor->saveState(); + $attributes = AttributesHelper::parseAttributes($cursor); + if ($attributes === []) { + return false; + } + + if ($cursor->getNextNonSpaceCharacter() !== null) { + $cursor->restoreState($state); + + return false; + } + + $context->addBlock(new Attributes($attributes)); + $context->setBlocksParsed(true); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php new file mode 100644 index 0000000000..d7cf02b253 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php @@ -0,0 +1,58 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Parser; + +use League\CommonMark\Extension\Attributes\Node\AttributesInline; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Inline\Parser\InlineParserInterface; +use League\CommonMark\InlineParserContext; + +final class AttributesInlineParser implements InlineParserInterface +{ + /** + * {@inheritdoc} + */ + public function getCharacters(): array + { + return [' ', '{']; + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + if ($cursor->getNextNonSpaceCharacter() !== '{') { + return false; + } + + $char = $cursor->getCharacter(); + if ($char === '{') { + $char = (string) $cursor->getCharacter($cursor->getPosition() - 1); + } + + $attributes = AttributesHelper::parseAttributes($cursor); + if ($attributes === []) { + return false; + } + + if ($char === '') { + $cursor->advanceToNextNonSpaceOrNewline(); + } + + $node = new AttributesInline($attributes, $char === ' ' || $char === ''); + $inlineContext->getContainer()->appendChild($node); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php b/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php new file mode 100644 index 0000000000..8649abfe9c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php @@ -0,0 +1,130 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Util; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Cursor; +use League\CommonMark\Inline\Element\AbstractInline; +use League\CommonMark\Util\RegexHelper; + +/** + * @internal + */ +final class AttributesHelper +{ + /** + * @param Cursor $cursor + * + * @return array + */ + public static function parseAttributes(Cursor $cursor): array + { + $state = $cursor->saveState(); + $cursor->advanceToNextNonSpaceOrNewline(); + if ($cursor->getCharacter() !== '{') { + $cursor->restoreState($state); + + return []; + } + + $cursor->advanceBy(1); + if ($cursor->getCharacter() === ':') { + $cursor->advanceBy(1); + } + + $attributes = []; + $regex = '/^\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')(?match($regex))) { + if ($attribute[0] === '#') { + $attributes['id'] = \substr($attribute, 1); + + continue; + } + + if ($attribute[0] === '.') { + $attributes['class'][] = \substr($attribute, 1); + + continue; + } + + [$name, $value] = \explode('=', $attribute, 2); + $first = $value[0]; + $last = \substr($value, -1); + if ((($first === '"' && $last === '"') || ($first === "'" && $last === "'")) && \strlen($value) > 1) { + $value = \substr($value, 1, -1); + } + + if (\strtolower(\trim($name)) === 'class') { + foreach (\array_filter(\explode(' ', \trim($value))) as $class) { + $attributes['class'][] = $class; + } + } else { + $attributes[trim($name)] = trim($value); + } + } + + if ($cursor->match('/}/') === null) { + $cursor->restoreState($state); + + return []; + } + + if ($attributes === []) { + $cursor->restoreState($state); + + return []; + } + + if (isset($attributes['class'])) { + $attributes['class'] = \implode(' ', (array) $attributes['class']); + } + + return $attributes; + } + + /** + * @param AbstractBlock|AbstractInline|array $attributes1 + * @param AbstractBlock|AbstractInline|array $attributes2 + * + * @return array + */ + public static function mergeAttributes($attributes1, $attributes2): array + { + $attributes = []; + foreach ([$attributes1, $attributes2] as $arg) { + if ($arg instanceof AbstractBlock || $arg instanceof AbstractInline) { + $arg = $arg->data['attributes'] ?? []; + } + + /** @var array $arg */ + $arg = (array) $arg; + if (isset($arg['class'])) { + foreach (\array_filter(\explode(' ', \trim($arg['class']))) as $class) { + $attributes['class'][] = $class; + } + + unset($arg['class']); + } + + $attributes = \array_merge($attributes, $arg); + } + + if (isset($attributes['class'])) { + $attributes['class'] = \implode(' ', $attributes['class']); + } + + return $attributes; + } +} diff --git a/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php b/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php index ab9a998f40..99e068a6d6 100644 --- a/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php +++ b/vendor/league/commonmark/src/Extension/Autolink/InlineMentionParser.php @@ -11,10 +11,16 @@ namespace League\CommonMark\Extension\Autolink; +use League\CommonMark\Extension\Mention\MentionParser; use League\CommonMark\Inline\Element\Link; use League\CommonMark\Inline\Parser\InlineParserInterface; use League\CommonMark\InlineParserContext; +@trigger_error(sprintf('%s is deprecated; use %s instead', InlineMentionParser::class, MentionParser::class), E_USER_DEPRECATED); + +/** + * @deprecated Use MentionParser instead + */ final class InlineMentionParser implements InlineParserInterface { /** @var string */ diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php index 5a2f66481b..6a88d5859c 100644 --- a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php +++ b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php @@ -17,6 +17,11 @@ use League\CommonMark\Inline\Element\Link; final class ExternalLinkProcessor { + public const APPLY_NONE = ''; + public const APPLY_ALL = 'all'; + public const APPLY_EXTERNAL = 'external'; + public const APPLY_INTERNAL = 'internal'; + /** @var EnvironmentInterface */ private $environment; @@ -50,6 +55,7 @@ final class ExternalLinkProcessor if (self::hostMatches($host, $internalHosts)) { $link->data['external'] = false; + $this->applyRelAttribute($link, false); continue; } @@ -63,7 +69,7 @@ final class ExternalLinkProcessor { $link->data['external'] = true; $link->data['attributes'] = $link->getData('attributes', []); - $link->data['attributes']['rel'] = 'noopener noreferrer'; + $this->applyRelAttribute($link, true); if ($openInNewWindow) { $link->data['attributes']['target'] = '_blank'; @@ -74,6 +80,32 @@ final class ExternalLinkProcessor } } + private function applyRelAttribute(Link $link, bool $isExternal): void + { + $rel = []; + + $options = [ + 'nofollow' => $this->environment->getConfig('external_link/nofollow', self::APPLY_NONE), + 'noopener' => $this->environment->getConfig('external_link/noopener', self::APPLY_EXTERNAL), + 'noreferrer' => $this->environment->getConfig('external_link/noreferrer', self::APPLY_EXTERNAL), + ]; + + foreach ($options as $type => $option) { + switch (true) { + case $option === self::APPLY_ALL: + case $isExternal && $option === self::APPLY_EXTERNAL: + case !$isExternal && $option === self::APPLY_INTERNAL: + $rel[] = $type; + } + } + + if ($rel === []) { + return; + } + + $link->data['attributes']['rel'] = \implode(' ', $rel); + } + /** * @param string $host * @param mixed $compareTo diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php new file mode 100644 index 0000000000..a1ff53cf7b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php @@ -0,0 +1,51 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Block\Element\Paragraph; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Inline\Element\Text; +use League\CommonMark\Reference\Reference; + +final class AnonymousFootnotesListener +{ + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $walker = $document->walker(); + + while ($event = $walker->next()) { + $node = $event->getNode(); + if ($node instanceof FootnoteRef && $event->isEntering() && null !== $text = $node->getContent()) { + // Anonymous footnote needs to create a footnote from its content + $existingReference = $node->getReference(); + $reference = new Reference( + $existingReference->getLabel(), + '#fnref:' . $existingReference->getLabel(), + $existingReference->getTitle() + ); + $footnote = new Footnote($reference); + $footnote->addBackref(new FootnoteBackref($reference)); + $paragraph = new Paragraph(); + $paragraph->appendChild(new Text($text)); + $footnote->appendChild($paragraph); + $document->appendChild($footnote); + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php new file mode 100644 index 0000000000..3834b30fb4 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php @@ -0,0 +1,87 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Block\Element\Document; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; +use League\CommonMark\Reference\Reference; + +final class GatherFootnotesListener +{ + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $walker = $document->walker(); + + $footnotes = []; + while ($event = $walker->next()) { + if (!$event->isEntering()) { + continue; + } + + $node = $event->getNode(); + if (!$node instanceof Footnote) { + continue; + } + + // Look for existing reference with footnote label + $ref = $document->getReferenceMap()->getReference($node->getReference()->getLabel()); + if ($ref !== null) { + // Use numeric title to get footnotes order + $footnotes[\intval($ref->getTitle())] = $node; + } else { + // Footnote call is missing, append footnote at the end + $footnotes[INF] = $node; + } + + /* + * Look for all footnote refs pointing to this footnote + * and create each footnote backrefs. + */ + $backrefs = $document->getData('#fn:' . $node->getReference()->getDestination(), []); + /** @var Reference $backref */ + foreach ($backrefs as $backref) { + $node->addBackref(new FootnoteBackref(new Reference( + $backref->getLabel(), + '#fnref:' . $backref->getLabel(), + $backref->getTitle() + ))); + } + } + + // Only add a footnote container if there are any + if (\count($footnotes) === 0) { + return; + } + + $container = $this->getFootnotesContainer($document); + + \ksort($footnotes); + foreach ($footnotes as $footnote) { + $container->appendChild($footnote); + } + } + + private function getFootnotesContainer(Document $document): FootnoteContainer + { + $footnoteContainer = new FootnoteContainer(); + $document->appendChild($footnoteContainer); + + return $footnoteContainer; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php new file mode 100644 index 0000000000..5b3f992503 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php @@ -0,0 +1,86 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Reference\Reference; + +final class NumberFootnotesListener +{ + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $walker = $document->walker(); + $nextCounter = 1; + $usedLabels = []; + $usedCounters = []; + + while ($event = $walker->next()) { + if (!$event->isEntering()) { + continue; + } + + $node = $event->getNode(); + + if (!$node instanceof FootnoteRef) { + continue; + } + + $existingReference = $node->getReference(); + $label = $existingReference->getLabel(); + $counter = $nextCounter; + $canIncrementCounter = true; + + if (\array_key_exists($label, $usedLabels)) { + /* + * Reference is used again, we need to point + * to the same footnote. But with a different ID + */ + $counter = $usedCounters[$label]; + $label = $label . '__' . ++$usedLabels[$label]; + $canIncrementCounter = false; + } + + // rewrite reference title to use a numeric link + $newReference = new Reference( + $label, + $existingReference->getDestination(), + (string) $counter + ); + + // Override reference with numeric link + $node->setReference($newReference); + $document->getReferenceMap()->addReference($newReference); + + /* + * Store created references in document for + * creating FootnoteBackrefs + */ + if (false === $document->getData($existingReference->getDestination(), false)) { + $document->data[$existingReference->getDestination()] = []; + } + + $document->data[$existingReference->getDestination()][] = $newReference; + + $usedLabels[$label] = 1; + $usedCounters[$label] = $nextCounter; + + if ($canIncrementCounter) { + $nextCounter++; + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php b/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php new file mode 100644 index 0000000000..1e896f9cbc --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php @@ -0,0 +1,53 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote; + +use League\CommonMark\ConfigurableEnvironmentInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Extension\Footnote\Event\AnonymousFootnotesListener; +use League\CommonMark\Extension\Footnote\Event\GatherFootnotesListener; +use League\CommonMark\Extension\Footnote\Event\NumberFootnotesListener; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Extension\Footnote\Parser\AnonymousFootnoteRefParser; +use League\CommonMark\Extension\Footnote\Parser\FootnoteParser; +use League\CommonMark\Extension\Footnote\Parser\FootnoteRefParser; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteBackrefRenderer; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteContainerRenderer; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteRefRenderer; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteRenderer; + +final class FootnoteExtension implements ExtensionInterface +{ + public function register(ConfigurableEnvironmentInterface $environment) + { + $environment->addBlockParser(new FootnoteParser(), 51); + $environment->addInlineParser(new AnonymousFootnoteRefParser(), 35); + $environment->addInlineParser(new FootnoteRefParser(), 51); + + $environment->addBlockRenderer(FootnoteContainer::class, new FootnoteContainerRenderer()); + $environment->addBlockRenderer(Footnote::class, new FootnoteRenderer()); + + $environment->addInlineRenderer(FootnoteRef::class, new FootnoteRefRenderer()); + $environment->addInlineRenderer(FootnoteBackref::class, new FootnoteBackrefRenderer()); + + $environment->addEventListener(DocumentParsedEvent::class, [new AnonymousFootnotesListener(), 'onDocumentParsed']); + $environment->addEventListener(DocumentParsedEvent::class, [new NumberFootnotesListener(), 'onDocumentParsed']); + $environment->addEventListener(DocumentParsedEvent::class, [new GatherFootnotesListener(), 'onDocumentParsed']); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php b/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php new file mode 100644 index 0000000000..d296d1930e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php @@ -0,0 +1,75 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Cursor; +use League\CommonMark\Reference\ReferenceInterface; + +/** + * @method children() AbstractBlock[] + */ +final class Footnote extends AbstractBlock +{ + /** + * @var FootnoteBackref[] + */ + private $backrefs = []; + + /** + * @var ReferenceInterface + */ + private $reference; + + public function __construct(ReferenceInterface $reference) + { + $this->reference = $reference; + } + + public function canContain(AbstractBlock $block): bool + { + return true; + } + + public function isCode(): bool + { + return false; + } + + public function matchesNextLine(Cursor $cursor): bool + { + return false; + } + + public function getReference(): ReferenceInterface + { + return $this->reference; + } + + public function addBackref(FootnoteBackref $backref): self + { + $this->backrefs[] = $backref; + + return $this; + } + + /** + * @return FootnoteBackref[] + */ + public function getBackrefs(): array + { + return $this->backrefs; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php new file mode 100644 index 0000000000..91747d31c6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php @@ -0,0 +1,37 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Inline\Element\AbstractInline; +use League\CommonMark\Reference\ReferenceInterface; + +/** + * Link from the footnote on the bottom of the document back to the reference + */ +final class FootnoteBackref extends AbstractInline +{ + /** @var ReferenceInterface */ + private $reference; + + public function __construct(ReferenceInterface $reference) + { + $this->reference = $reference; + } + + public function getReference(): ReferenceInterface + { + return $this->reference; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php new file mode 100644 index 0000000000..ad151efe5b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php @@ -0,0 +1,39 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Cursor; + +/** + * @method children() AbstractBlock[] + */ +final class FootnoteContainer extends AbstractBlock +{ + public function canContain(AbstractBlock $block): bool + { + return $block instanceof Footnote; + } + + public function isCode(): bool + { + return false; + } + + public function matchesNextLine(Cursor $cursor): bool + { + return false; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php new file mode 100644 index 0000000000..27b98b5573 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php @@ -0,0 +1,56 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Inline\Element\AbstractInline; +use League\CommonMark\Reference\ReferenceInterface; + +final class FootnoteRef extends AbstractInline +{ + /** @var ReferenceInterface */ + private $reference; + + /** @var string|null */ + private $content; + + /** + * @param ReferenceInterface $reference + * @param string|null $content + * @param array $data + */ + public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = []) + { + $this->reference = $reference; + $this->content = $content; + $this->data = $data; + } + + public function getReference(): ReferenceInterface + { + return $this->reference; + } + + public function setReference(ReferenceInterface $reference): FootnoteRef + { + $this->reference = $reference; + + return $this; + } + + public function getContent(): ?string + { + return $this->content; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php new file mode 100644 index 0000000000..cf7f20961e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php @@ -0,0 +1,71 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Inline\Parser\InlineParserInterface; +use League\CommonMark\InlineParserContext; +use League\CommonMark\Normalizer\SlugNormalizer; +use League\CommonMark\Normalizer\TextNormalizerInterface; +use League\CommonMark\Reference\Reference; + +final class AnonymousFootnoteRefParser implements InlineParserInterface +{ + /** @var TextNormalizerInterface */ + private $slugNormalizer; + + public function __construct() + { + $this->slugNormalizer = new SlugNormalizer(); + } + + public function getCharacters(): array + { + return ['^']; + } + + public function parse(InlineParserContext $inlineContext): bool + { + $container = $inlineContext->getContainer(); + $cursor = $inlineContext->getCursor(); + $nextChar = $cursor->peek(); + if ($nextChar !== '[') { + return false; + } + $state = $cursor->saveState(); + + $m = $cursor->match('/\^\[[^\n^\]]+\]/'); + if ($m !== null) { + if (\preg_match('#\^\[([^\]]+)\]#', $m, $matches) > 0) { + $reference = $this->createReference($matches[1]); + $container->appendChild(new FootnoteRef($reference, $matches[1])); + + return true; + } + } + + $cursor->restoreState($state); + + return false; + } + + private function createReference(string $label): Reference + { + $refLabel = $this->slugNormalizer->normalize($label); + $refLabel = \mb_substr($refLabel, 0, 20); + + return new Reference($refLabel, '#fn:' . $refLabel, $label); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php new file mode 100644 index 0000000000..231c2aa5e0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php @@ -0,0 +1,63 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Block\Parser\BlockParserInterface; +use League\CommonMark\ContextInterface; +use League\CommonMark\Cursor; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Reference\Reference; +use League\CommonMark\Util\RegexHelper; + +final class FootnoteParser implements BlockParserInterface +{ + public function parse(ContextInterface $context, Cursor $cursor): bool + { + if ($cursor->isIndented()) { + return false; + } + + $match = RegexHelper::matchAll( + '/^\[\^([^\n^\]]+)\]\:\s/', + $cursor->getLine(), + $cursor->getNextNonSpacePosition() + ); + + if (!$match) { + return false; + } + + $cursor->advanceToNextNonSpaceOrTab(); + $cursor->advanceBy(\strlen($match[0])); + $str = $cursor->getRemainder(); + \preg_replace('/^\[\^([^\n^\]]+)\]\:\s/', '', $str); + + if (\preg_match('/^\[\^([^\n^\]]+)\]\:\s/', $match[0], $matches) > 0) { + $context->addBlock($this->createFootnote($matches[1])); + $context->setBlocksParsed(true); + + return true; + } + + return false; + } + + private function createFootnote(string $label): Footnote + { + return new Footnote( + new Reference($label, $label, $label) + ); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php new file mode 100644 index 0000000000..496124e7ca --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php @@ -0,0 +1,58 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Inline\Parser\InlineParserInterface; +use League\CommonMark\InlineParserContext; +use League\CommonMark\Reference\Reference; + +final class FootnoteRefParser implements InlineParserInterface +{ + public function getCharacters(): array + { + return ['[']; + } + + public function parse(InlineParserContext $inlineContext): bool + { + $container = $inlineContext->getContainer(); + $cursor = $inlineContext->getCursor(); + $nextChar = $cursor->peek(); + if ($nextChar !== '^') { + return false; + } + + $state = $cursor->saveState(); + + $m = $cursor->match('#\[\^([^\]]+)\]#'); + if ($m !== null) { + if (\preg_match('#\[\^([^\]]+)\]#', $m, $matches) > 0) { + $container->appendChild(new FootnoteRef($this->createReference($matches[1]))); + + return true; + } + } + + $cursor->restoreState($state); + + return false; + } + + private function createReference(string $label): Reference + { + return new Reference($label, '#fn:' . $label, $label); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php new file mode 100644 index 0000000000..1bbf68943d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php @@ -0,0 +1,49 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\ElementRendererInterface; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\HtmlElement; +use League\CommonMark\Inline\Element\AbstractInline; +use League\CommonMark\Inline\Renderer\InlineRendererInterface; +use League\CommonMark\Util\ConfigurationAwareInterface; +use League\CommonMark\Util\ConfigurationInterface; + +final class FootnoteBackrefRenderer implements InlineRendererInterface, ConfigurationAwareInterface +{ + /** @var ConfigurationInterface */ + private $config; + + public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) + { + if (!($inline instanceof FootnoteBackref)) { + throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); + } + + $attrs = $inline->getData('attributes', []); + $attrs['class'] = $attrs['class'] ?? $this->config->get('footnote/backref_class', 'footnote-backref'); + $attrs['rev'] = 'footnote'; + $attrs['href'] = \mb_strtolower($inline->getReference()->getDestination()); + $attrs['role'] = 'doc-backlink'; + + return ' ' . new HtmlElement('a', $attrs, '↩', true); + } + + public function setConfiguration(ConfigurationInterface $configuration) + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php new file mode 100644 index 0000000000..24be14ea60 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php @@ -0,0 +1,52 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Block\Renderer\BlockRendererInterface; +use League\CommonMark\ElementRendererInterface; +use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; +use League\CommonMark\HtmlElement; +use League\CommonMark\Util\ConfigurationAwareInterface; +use League\CommonMark\Util\ConfigurationInterface; + +final class FootnoteContainerRenderer implements BlockRendererInterface, ConfigurationAwareInterface +{ + /** @var ConfigurationInterface */ + private $config; + + public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) + { + if (!($block instanceof FootnoteContainer)) { + throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); + } + + $attrs = $block->getData('attributes', []); + $attrs['class'] = $attrs['class'] ?? $this->config->get('footnote/container_class', 'footnotes'); + $attrs['role'] = 'doc-endnotes'; + + $contents = new HtmlElement('ol', [], $htmlRenderer->renderBlocks($block->children())); + if ($this->config->get('footnote/container_add_hr', true)) { + $contents = [new HtmlElement('hr', [], null, true), $contents]; + } + + return new HtmlElement('div', $attrs, $contents); + } + + public function setConfiguration(ConfigurationInterface $configuration) + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php new file mode 100644 index 0000000000..14d57f4d72 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php @@ -0,0 +1,62 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\ElementRendererInterface; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\HtmlElement; +use League\CommonMark\Inline\Element\AbstractInline; +use League\CommonMark\Inline\Renderer\InlineRendererInterface; +use League\CommonMark\Util\ConfigurationAwareInterface; +use League\CommonMark\Util\ConfigurationInterface; + +final class FootnoteRefRenderer implements InlineRendererInterface, ConfigurationAwareInterface +{ + /** @var ConfigurationInterface */ + private $config; + + public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer) + { + if (!($inline instanceof FootnoteRef)) { + throw new \InvalidArgumentException('Incompatible inline type: ' . \get_class($inline)); + } + + $attrs = $inline->getData('attributes', []); + $class = $attrs['class'] ?? $this->config->get('footnote/ref_class', 'footnote-ref'); + $idPrefix = $this->config->get('footnote/ref_id_prefix', 'fnref:'); + + return new HtmlElement( + 'sup', + [ + 'id' => $idPrefix . \mb_strtolower($inline->getReference()->getLabel()), + ], + new HTMLElement( + 'a', + [ + 'class' => $class, + 'href' => \mb_strtolower($inline->getReference()->getDestination()), + 'role' => 'doc-noteref', + ], + $inline->getReference()->getTitle() + ), + true + ); + } + + public function setConfiguration(ConfigurationInterface $configuration) + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php new file mode 100644 index 0000000000..f18e35a2a1 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php @@ -0,0 +1,64 @@ + + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Block\Renderer\BlockRendererInterface; +use League\CommonMark\ElementRendererInterface; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\HtmlElement; +use League\CommonMark\Util\ConfigurationAwareInterface; +use League\CommonMark\Util\ConfigurationInterface; + +final class FootnoteRenderer implements BlockRendererInterface, ConfigurationAwareInterface +{ + /** @var ConfigurationInterface */ + private $config; + + /** + * @param Footnote $block + * @param ElementRendererInterface $htmlRenderer + * @param bool $inTightList + * + * @return HtmlElement + */ + public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) + { + if (!($block instanceof Footnote)) { + throw new \InvalidArgumentException('Incompatible block type: ' . \get_class($block)); + } + + $attrs = $block->getData('attributes', []); + $attrs['class'] = $attrs['class'] ?? $this->config->get('footnote/footnote_class', 'footnote'); + $attrs['id'] = $this->config->get('footnote/footnote_id_prefix', 'fn:') . \mb_strtolower($block->getReference()->getLabel()); + $attrs['role'] = 'doc-endnote'; + + foreach ($block->getBackrefs() as $backref) { + $block->lastChild()->appendChild($backref); + } + + return new HtmlElement( + 'li', + $attrs, + $htmlRenderer->renderBlocks($block->children()), + true + ); + } + + public function setConfiguration(ConfigurationInterface $configuration) + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php index c082e10b84..aaf135542f 100644 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php @@ -13,11 +13,13 @@ namespace League\CommonMark\Extension\HeadingPermalink; use League\CommonMark\Block\Element\Heading; use League\CommonMark\Event\DocumentParsedEvent; -use League\CommonMark\Extension\HeadingPermalink\Slug\DefaultSlugGenerator; -use League\CommonMark\Extension\HeadingPermalink\Slug\SlugGeneratorInterface; +use League\CommonMark\Exception\InvalidOptionException; +use League\CommonMark\Extension\HeadingPermalink\Slug\SlugGeneratorInterface as DeprecatedSlugGeneratorInterface; use League\CommonMark\Inline\Element\Code; use League\CommonMark\Inline\Element\Text; use League\CommonMark\Node\Node; +use League\CommonMark\Normalizer\SlugNormalizer; +use League\CommonMark\Normalizer\TextNormalizerInterface; use League\CommonMark\Util\ConfigurationAwareInterface; use League\CommonMark\Util\ConfigurationInterface; @@ -29,15 +31,22 @@ final class HeadingPermalinkProcessor implements ConfigurationAwareInterface const INSERT_BEFORE = 'before'; const INSERT_AFTER = 'after'; - /** @var SlugGeneratorInterface */ - private $slugGenerator; + /** @var TextNormalizerInterface|DeprecatedSlugGeneratorInterface */ + private $slugNormalizer; /** @var ConfigurationInterface */ private $config; - public function __construct(SlugGeneratorInterface $slugGenerator = null) + /** + * @param TextNormalizerInterface|DeprecatedSlugGeneratorInterface|null $slugNormalizer + */ + public function __construct($slugNormalizer = null) { - $this->slugGenerator = $slugGenerator ?? new DefaultSlugGenerator(); + if ($slugNormalizer instanceof DeprecatedSlugGeneratorInterface) { + @trigger_error(sprintf('Passing a %s into the %s constructor is deprecated; use a %s instead', DeprecatedSlugGeneratorInterface::class, self::class, TextNormalizerInterface::class), E_USER_DEPRECATED); + } + + $this->slugNormalizer = $slugNormalizer ?? new SlugNormalizer(); } public function setConfiguration(ConfigurationInterface $configuration) @@ -47,6 +56,8 @@ final class HeadingPermalinkProcessor implements ConfigurationAwareInterface public function __invoke(DocumentParsedEvent $e): void { + $this->useNormalizerFromConfigurationIfProvided(); + $walker = $e->getDocument()->walker(); while ($event = $walker->next()) { @@ -57,10 +68,28 @@ final class HeadingPermalinkProcessor implements ConfigurationAwareInterface } } + private function useNormalizerFromConfigurationIfProvided(): void + { + $generator = $this->config->get('heading_permalink/slug_normalizer'); + if ($generator === null) { + return; + } + + if (!($generator instanceof DeprecatedSlugGeneratorInterface || $generator instanceof TextNormalizerInterface)) { + throw new InvalidOptionException('The heading_permalink/slug_normalizer option must be an instance of ' . TextNormalizerInterface::class); + } + + $this->slugNormalizer = $generator; + } + private function addHeadingLink(Heading $heading): void { $text = $this->getChildText($heading); - $slug = $this->slugGenerator->createSlug($text); + if ($this->slugNormalizer instanceof DeprecatedSlugGeneratorInterface) { + $slug = $this->slugNormalizer->createSlug($text); + } else { + $slug = $this->slugNormalizer->normalize($text, $heading); + } $headingLinkAnchor = new HeadingPermalink($slug); @@ -78,6 +107,9 @@ final class HeadingPermalinkProcessor implements ConfigurationAwareInterface } } + /** + * @deprecated Not needed in 2.0 + */ private function getChildText(Node $node): string { $text = ''; diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php index 22ab795436..5bdab9575f 100644 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php @@ -23,8 +23,11 @@ use League\CommonMark\Util\ConfigurationInterface; */ final class HeadingPermalinkRenderer implements InlineRendererInterface, ConfigurationAwareInterface { + /** @deprecated */ const DEFAULT_INNER_CONTENTS = ''; + const DEFAULT_SYMBOL = '¶'; + /** @var ConfigurationInterface */ private $config; @@ -55,8 +58,15 @@ final class HeadingPermalinkRenderer implements InlineRendererInterface, Configu 'title' => $this->config->get('heading_permalink/title', 'Permalink'), ]; - $innerContents = $this->config->get('heading_permalink/inner_contents', self::DEFAULT_INNER_CONTENTS); + $innerContents = $this->config->get('heading_permalink/inner_contents'); + if ($innerContents !== null) { + @trigger_error(sprintf('The %s config option is deprecated; use %s instead', 'inner_contents', 'symbol'), E_USER_DEPRECATED); + + return new HtmlElement('a', $attrs, $innerContents, false); + } + + $symbol = $this->config->get('heading_permalink/symbol', self::DEFAULT_SYMBOL); - return new HtmlElement('a', $attrs, $innerContents, false); + return new HtmlElement('a', $attrs, \htmlspecialchars($symbol), false); } } diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php index 65c920f94e..72faba8a95 100644 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/DefaultSlugGenerator.php @@ -11,8 +11,14 @@ namespace League\CommonMark\Extension\HeadingPermalink\Slug; +use League\CommonMark\Normalizer\SlugNormalizer; + +@trigger_error(sprintf('%s is deprecated; use %s instead', DefaultSlugGenerator::class, SlugNormalizer::class), E_USER_DEPRECATED); + /** * Creates URL-friendly strings + * + * @deprecated Use League\CommonMark\Normalizer\SlugNormalizer instead */ final class DefaultSlugGenerator implements SlugGeneratorInterface { diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php index 9ae05a4420..d238de7375 100644 --- a/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/Slug/SlugGeneratorInterface.php @@ -11,6 +11,13 @@ namespace League\CommonMark\Extension\HeadingPermalink\Slug; +use League\CommonMark\Normalizer\TextNormalizerInterface; + +@trigger_error(sprintf('%s is deprecated; use %s instead', SlugGeneratorInterface::class, TextNormalizerInterface::class), E_USER_DEPRECATED); + +/** + * @deprecated Use League\CommonMark\Normalizer\TextNormalizerInterface instead + */ interface SlugGeneratorInterface { /** diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php b/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php new file mode 100644 index 0000000000..58f9bb66a3 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention\Generator; + +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Inline\Element\AbstractInline; + +final class CallbackGenerator implements MentionGeneratorInterface +{ + /** + * A callback function which sets the URL on the passed mention and returns the mention, return a new AbstractInline based object or null if the mention is not a match + * + * @var callable(Mention): ?AbstractInline + */ + private $callback; + + public function __construct(callable $callback) + { + $this->callback = $callback; + } + + public function generateMention(Mention $mention): ?AbstractInline + { + $result = \call_user_func_array($this->callback, [$mention]); + if ($result === null) { + return null; + } + + if ($result instanceof AbstractInline && !($result instanceof Mention)) { + return $result; + } + + if ($result instanceof Mention && $result->hasUrl()) { + return $mention; + } + + throw new \RuntimeException('CallbackGenerator callable must set the URL on the passed mention and return the mention, return a new AbstractInline based object or null if the mention is not a match'); + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php b/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php new file mode 100644 index 0000000000..4f834ee90b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention\Generator; + +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Inline\Element\AbstractInline; + +interface MentionGeneratorInterface +{ + /** + * @param Mention $mention + * + * @return AbstractInline|null + */ + public function generateMention(Mention $mention): ?AbstractInline; +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php b/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php new file mode 100644 index 0000000000..2f2c485de9 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention\Generator; + +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Inline\Element\AbstractInline; + +final class StringTemplateLinkGenerator implements MentionGeneratorInterface +{ + /** @var string */ + private $urlTemplate; + + public function __construct(string $urlTemplate) + { + $this->urlTemplate = $urlTemplate; + } + + public function generateMention(Mention $mention): ?AbstractInline + { + return $mention->setUrl(\sprintf($this->urlTemplate, $mention->getIdentifier())); + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Mention.php b/vendor/league/commonmark/src/Extension/Mention/Mention.php new file mode 100644 index 0000000000..3344d53ead --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Mention.php @@ -0,0 +1,104 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention; + +use League\CommonMark\Inline\Element\Link; +use League\CommonMark\Inline\Element\Text; + +class Mention extends Link +{ + /** @var string */ + private $symbol; + + /** @var string */ + private $identifier; + + /** + * @param string $symbol + * @param string $identifier + * @param string $label + */ + public function __construct(string $symbol, string $identifier, string $label = null) + { + $this->symbol = $symbol; + $this->identifier = $identifier; + + parent::__construct('', $label ?? \sprintf('%s%s', $symbol, $identifier)); + } + + /** + * @return string|null + */ + public function getLabel(): ?string + { + if (($labelNode = $this->findLabelNode()) === null) { + return null; + } + + return $labelNode->getContent(); + } + + /** + * @return string + */ + public function getIdentifier(): string + { + return $this->identifier; + } + + /** + * @return string + */ + public function getSymbol(): string + { + return $this->symbol; + } + + /** + * @return bool + */ + public function hasUrl(): bool + { + return !empty($this->url); + } + + /** + * @param string $label + * + * @return $this + */ + public function setLabel(string $label): self + { + if (($labelNode = $this->findLabelNode()) === null) { + $labelNode = new Text(); + $this->prependChild($labelNode); + } + + $labelNode->setContent($label); + + return $this; + } + + private function findLabelNode(): ?Text + { + foreach ($this->children() as $child) { + if ($child instanceof Text) { + return $child; + } + } + + return null; + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php b/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php new file mode 100644 index 0000000000..19a981fe0c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention; + +use League\CommonMark\ConfigurableEnvironmentInterface; +use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; + +final class MentionExtension implements ExtensionInterface +{ + public function register(ConfigurableEnvironmentInterface $environment) + { + $mentions = $environment->getConfig('mentions', []); + foreach ($mentions as $name => $mention) { + foreach (['symbol', 'regex', 'generator'] as $key) { + if (empty($mention[$key])) { + throw new \RuntimeException("Missing \"$key\" from MentionParser configuration"); + } + } + if ($mention['generator'] instanceof MentionGeneratorInterface) { + $environment->addInlineParser(new MentionParser($mention['symbol'], $mention['regex'], $mention['generator'])); + } elseif (is_string($mention['generator'])) { + $environment->addInlineParser(MentionParser::createWithStringTemplate($mention['symbol'], $mention['regex'], $mention['generator'])); + } elseif (is_callable($mention['generator'])) { + $environment->addInlineParser(MentionParser::createWithCallback($mention['symbol'], $mention['regex'], $mention['generator'])); + } else { + throw new \RuntimeException(sprintf('The "generator" provided for the MentionParser configuration must be a string template, callable, or an object that implements %s.', MentionGeneratorInterface::class)); + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/MentionParser.php b/vendor/league/commonmark/src/Extension/Mention/MentionParser.php new file mode 100644 index 0000000000..7609184f7b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/MentionParser.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention; + +use League\CommonMark\Extension\Mention\Generator\CallbackGenerator; +use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; +use League\CommonMark\Extension\Mention\Generator\StringTemplateLinkGenerator; +use League\CommonMark\Inline\Parser\InlineParserInterface; +use League\CommonMark\InlineParserContext; + +final class MentionParser implements InlineParserInterface +{ + /** @var string */ + private $symbol; + + /** @var string */ + private $mentionRegex; + + /** @var MentionGeneratorInterface */ + private $mentionGenerator; + + public function __construct(string $symbol, string $mentionRegex, MentionGeneratorInterface $mentionGenerator) + { + $this->symbol = $symbol; + $this->mentionRegex = $mentionRegex; + $this->mentionGenerator = $mentionGenerator; + } + + public function getCharacters(): array + { + return [$this->symbol]; + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + + // The symbol must not have any other characters immediately prior + $previousChar = $cursor->peek(-1); + if ($previousChar !== null && $previousChar !== ' ') { + // peek() doesn't modify the cursor, so no need to restore state first + return false; + } + + // Save the cursor state in case we need to rewind and bail + $previousState = $cursor->saveState(); + + // Advance past the symbol to keep parsing simpler + $cursor->advance(); + + // Parse the mention match value + $identifier = $cursor->match($this->mentionRegex); + if ($identifier === null) { + // Regex failed to match; this isn't a valid mention + $cursor->restoreState($previousState); + + return false; + } + + $mention = $this->mentionGenerator->generateMention(new Mention($this->symbol, $identifier)); + + if ($mention === null) { + $cursor->restoreState($previousState); + + return false; + } + + $inlineContext->getContainer()->appendChild($mention); + + return true; + } + + public static function createWithStringTemplate(string $symbol, string $mentionRegex, string $urlTemplate): MentionParser + { + return new self($symbol, $mentionRegex, new StringTemplateLinkGenerator($urlTemplate)); + } + + public static function createWithCallback(string $symbol, string $mentionRegex, callable $callback): MentionParser + { + return new self($symbol, $mentionRegex, new CallbackGenerator($callback)); + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php new file mode 100644 index 0000000000..dbcaf3b638 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Node; + +use League\CommonMark\Block\Element\ListBlock; +use League\CommonMark\Extension\TableOfContents\TableOfContents as DeprecatedTableOfContents; + +final class TableOfContents extends ListBlock +{ +} + +\class_exists(DeprecatedTableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php new file mode 100644 index 0000000000..7edafe779b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Node; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Cursor; + +final class TableOfContentsPlaceholder extends AbstractBlock +{ + public function canContain(AbstractBlock $block): bool + { + return false; + } + + public function isCode(): bool + { + return false; + } + + public function matchesNextLine(Cursor $cursor): bool + { + return false; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php index 892d084584..082cfe050c 100644 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php @@ -13,7 +13,7 @@ namespace League\CommonMark\Extension\TableOfContents\Normalizer; use League\CommonMark\Block\Element\ListBlock; use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Extension\TableOfContents\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; final class AsIsNormalizerStrategy implements NormalizerStrategyInterface { @@ -63,3 +63,6 @@ final class AsIsNormalizerStrategy implements NormalizerStrategyInterface $this->lastListItem = $listItemToAdd; } } + +// Trigger autoload without causing a deprecated error +\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php index b0626b7f62..87ed7a7ebd 100644 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php @@ -12,7 +12,7 @@ namespace League\CommonMark\Extension\TableOfContents\Normalizer; use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Extension\TableOfContents\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; final class FlatNormalizerStrategy implements NormalizerStrategyInterface { @@ -29,3 +29,6 @@ final class FlatNormalizerStrategy implements NormalizerStrategyInterface $this->toc->appendChild($listItemToAdd); } } + +// Trigger autoload without causing a deprecated error +\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php index ebbfd4b697..0834e6dab7 100644 --- a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php @@ -13,7 +13,7 @@ namespace League\CommonMark\Extension\TableOfContents\Normalizer; use League\CommonMark\Block\Element\ListBlock; use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Extension\TableOfContents\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; final class RelativeNormalizerStrategy implements NormalizerStrategyInterface { @@ -60,3 +60,6 @@ final class RelativeNormalizerStrategy implements NormalizerStrategyInterface $this->listItemStack[$level] = $listItemToAdd; } } + +// Trigger autoload without causing a deprecated error +\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php index c5f0b2de69..ef01d2ed7d 100644 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContents.php @@ -12,7 +12,19 @@ namespace League\CommonMark\Extension\TableOfContents; use League\CommonMark\Block\Element\ListBlock; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents as NewTableOfContents; -final class TableOfContents extends ListBlock -{ +if (!class_exists(NewTableOfContents::class)) { + @trigger_error(sprintf('TableOfContents has moved to a new namespace; use %s instead', NewTableOfContents::class), \E_USER_DEPRECATED); +} + +\class_alias(NewTableOfContents::class, TableOfContents::class); + +if (false) { + /** + * @deprecated This class has moved to the Node sub-namespace; use that instead + */ + final class TableOfContents extends ListBlock + { + } } diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php index 05d8be9d57..8ff06afc7b 100644 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php @@ -13,32 +13,44 @@ namespace League\CommonMark\Extension\TableOfContents; use League\CommonMark\Block\Element\Document; use League\CommonMark\Block\Element\Heading; -use League\CommonMark\Block\Element\ListBlock; -use League\CommonMark\Block\Element\ListData; -use League\CommonMark\Block\Element\ListItem; -use League\CommonMark\Block\Element\Paragraph; use League\CommonMark\Event\DocumentParsedEvent; use League\CommonMark\Exception\InvalidOptionException; use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; -use League\CommonMark\Extension\TableOfContents\Normalizer\AsIsNormalizerStrategy; -use League\CommonMark\Extension\TableOfContents\Normalizer\FlatNormalizerStrategy; -use League\CommonMark\Extension\TableOfContents\Normalizer\NormalizerStrategyInterface; -use League\CommonMark\Extension\TableOfContents\Normalizer\RelativeNormalizerStrategy; -use League\CommonMark\Inline\Element\Link; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; use League\CommonMark\Util\ConfigurationAwareInterface; use League\CommonMark\Util\ConfigurationInterface; final class TableOfContentsBuilder implements ConfigurationAwareInterface { - public const STYLE_BULLET = ListBlock::TYPE_BULLET; - public const STYLE_ORDERED = ListBlock::TYPE_ORDERED; + /** + * @deprecated Use TableOfContentsGenerator::STYLE_BULLET instead + */ + public const STYLE_BULLET = TableOfContentsGenerator::STYLE_BULLET; + + /** + * @deprecated Use TableOfContentsGenerator::STYLE_ORDERED instead + */ + public const STYLE_ORDERED = TableOfContentsGenerator::STYLE_ORDERED; + + /** + * @deprecated Use TableOfContentsGenerator::NORMALIZE_DISABLED instead + */ + public const NORMALIZE_DISABLED = TableOfContentsGenerator::NORMALIZE_DISABLED; - public const NORMALIZE_DISABLED = 'as-is'; - public const NORMALIZE_RELATIVE = 'relative'; - public const NORMALIZE_FLAT = 'flat'; + /** + * @deprecated Use TableOfContentsGenerator::NORMALIZE_RELATIVE instead + */ + public const NORMALIZE_RELATIVE = TableOfContentsGenerator::NORMALIZE_RELATIVE; + + /** + * @deprecated Use TableOfContentsGenerator::NORMALIZE_FLAT instead + */ + public const NORMALIZE_FLAT = TableOfContentsGenerator::NORMALIZE_FLAT; public const POSITION_TOP = 'top'; public const POSITION_BEFORE_HEADINGS = 'before-headings'; + public const POSITION_PLACEHOLDER = 'placeholder'; /** @var ConfigurationInterface */ private $config; @@ -46,43 +58,24 @@ final class TableOfContentsBuilder implements ConfigurationAwareInterface public function onDocumentParsed(DocumentParsedEvent $event): void { $document = $event->getDocument(); - $toc = $this->createToc(); - - $normalizer = $this->getNormalizer($toc); - [$min, $max] = $this->getMinAndMaxHeadingLevels(); - $firstHeading = null; - - foreach ($this->getHeadingLinks($document) as $headingLink) { - $heading = $headingLink->parent(); - // Make sure this is actually tied to a heading - if (!$heading instanceof Heading) { - continue; - } - - // Skip any headings outside the configured min/max levels - if ($heading->getLevel() < $min || $heading->getLevel() > $max) { - continue; - } - - // Keep track of the first heading we see - we might need this later - $firstHeading = $firstHeading ?? $heading; - - // Create the new link - $link = new Link('#' . $headingLink->getSlug(), $heading->getStringContent()); - $paragraph = new Paragraph(); - $paragraph->appendChild($link); - - $listItem = new ListItem($toc->getListData()); - $listItem->appendChild($paragraph); + $generator = new TableOfContentsGenerator( + $this->config->get('table_of_contents/style', TableOfContentsGenerator::STYLE_BULLET), + $this->config->get('table_of_contents/normalize', TableOfContentsGenerator::NORMALIZE_RELATIVE), + (int) $this->config->get('table_of_contents/min_heading_level', 1), + (int) $this->config->get('table_of_contents/max_heading_level', 6) + ); - // Add it to the correct place - $normalizer->addItem($heading->getLevel(), $listItem); + $toc = $generator->generate($document); + if ($toc === null) { + // No linkable headers exist, so no TOC could be generated + return; } - // Don't add the TOC if no headings were present - if (!$toc->hasChildren() || $firstHeading === null) { - return; + // Add custom CSS class(es), if defined + $class = $this->config->get('table_of_contents/html_class', 'table-of-contents'); + if (!empty($class)) { + $toc->data['attributes']['class'] = $class; } // Add the TOC to the Document @@ -90,73 +83,41 @@ final class TableOfContentsBuilder implements ConfigurationAwareInterface if ($position === self::POSITION_TOP) { $document->prependChild($toc); } elseif ($position === self::POSITION_BEFORE_HEADINGS) { - $firstHeading->insertBefore($toc); + $this->insertBeforeFirstLinkedHeading($document, $toc); + } elseif ($position === self::POSITION_PLACEHOLDER) { + $this->replacePlaceholders($document, $toc); } else { throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/position"', $position)); } } - private function createToc(): TableOfContents + private function insertBeforeFirstLinkedHeading(Document $document, TableOfContents $toc): void { - $listData = new ListData(); - - $style = $this->config->get('table_of_contents/style', self::STYLE_BULLET); - if ($style === self::STYLE_BULLET) { - $listData->type = ListBlock::TYPE_BULLET; - } elseif ($style === self::STYLE_ORDERED) { - $listData->type = ListBlock::TYPE_ORDERED; - } else { - throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/style"', $style)); - } - - $toc = new TableOfContents($listData); + $walker = $document->walker(); + while ($event = $walker->next()) { + if ($event->isEntering() && ($node = $event->getNode()) instanceof HeadingPermalink && ($parent = $node->parent()) instanceof Heading) { + $parent->insertBefore($toc); - $class = $this->config->get('table_of_contents/html_class', 'table-of-contents'); - if (!empty($class)) { - $toc->data['attributes']['class'] = $class; + return; + } } - - return $toc; - } - - /** - * @return array - */ - private function getMinAndMaxHeadingLevels(): array - { - return [ - (int) $this->config->get('table_of_contents/min_heading_level', 1), - (int) $this->config->get('table_of_contents/max_heading_level', 6), - ]; } - /** - * @param Document $document - * - * @return iterable - */ - private function getHeadingLinks(Document $document) + private function replacePlaceholders(Document $document, TableOfContents $toc): void { $walker = $document->walker(); while ($event = $walker->next()) { - if ($event->isEntering() && ($node = $event->getNode()) instanceof HeadingPermalink) { - yield $node; + // Add the block once we find a placeholder (and we're about to leave it) + if (!$event->getNode() instanceof TableOfContentsPlaceholder) { + continue; } - } - } - private function getNormalizer(TableOfContents $toc): NormalizerStrategyInterface - { - $strategy = $this->config->get('table_of_contents/normalize', self::NORMALIZE_RELATIVE); - if ($strategy === self::NORMALIZE_DISABLED) { - return new AsIsNormalizerStrategy($toc); - } elseif ($strategy === self::NORMALIZE_RELATIVE) { - return new RelativeNormalizerStrategy($toc); - } elseif ($strategy === self::NORMALIZE_FLAT) { - return new FlatNormalizerStrategy($toc); - } + if ($event->isEntering()) { + continue; + } - throw new InvalidOptionException(\sprintf('Invalid config option "%s" for "table_of_contents/normalize"', $strategy)); + $event->getNode()->replaceWith(clone $toc); + } } public function setConfiguration(ConfigurationInterface $config) diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php index 50ed942d90..287ced77d8 100644 --- a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php @@ -14,11 +14,18 @@ namespace League\CommonMark\Extension\TableOfContents; use League\CommonMark\ConfigurableEnvironmentInterface; use League\CommonMark\Event\DocumentParsedEvent; use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; final class TableOfContentsExtension implements ExtensionInterface { public function register(ConfigurableEnvironmentInterface $environment): void { $environment->addEventListener(DocumentParsedEvent::class, [new TableOfContentsBuilder(), 'onDocumentParsed'], -150); + + if ($environment->getConfig('table_of_contents/position') === TableOfContentsBuilder::POSITION_PLACEHOLDER) { + $environment->addBlockParser(new TableOfContentsPlaceholderParser(), 200); + // If a placeholder cannot be replaced with a TOC element this renderer will ensure the parser won't error out + $environment->addBlockRenderer(TableOfContentsPlaceholder::class, new TableOfContentsPlaceholderRenderer()); + } } } diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php new file mode 100644 index 0000000000..ff767348b5 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php @@ -0,0 +1,149 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Block\Element\Document; +use League\CommonMark\Block\Element\Heading; +use League\CommonMark\Block\Element\ListBlock; +use League\CommonMark\Block\Element\ListData; +use League\CommonMark\Block\Element\ListItem; +use League\CommonMark\Block\Element\Paragraph; +use League\CommonMark\Exception\InvalidOptionException; +use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Normalizer\AsIsNormalizerStrategy; +use League\CommonMark\Extension\TableOfContents\Normalizer\FlatNormalizerStrategy; +use League\CommonMark\Extension\TableOfContents\Normalizer\NormalizerStrategyInterface; +use League\CommonMark\Extension\TableOfContents\Normalizer\RelativeNormalizerStrategy; +use League\CommonMark\Inline\Element\Link; + +final class TableOfContentsGenerator implements TableOfContentsGeneratorInterface +{ + public const STYLE_BULLET = ListBlock::TYPE_BULLET; + public const STYLE_ORDERED = ListBlock::TYPE_ORDERED; + + public const NORMALIZE_DISABLED = 'as-is'; + public const NORMALIZE_RELATIVE = 'relative'; + public const NORMALIZE_FLAT = 'flat'; + + /** @var string */ + private $style; + /** @var string */ + private $normalizationStrategy; + /** @var int */ + private $minHeadingLevel; + /** @var int */ + private $maxHeadingLevel; + + public function __construct(string $style, string $normalizationStrategy, int $minHeadingLevel, int $maxHeadingLevel) + { + $this->style = $style; + $this->normalizationStrategy = $normalizationStrategy; + $this->minHeadingLevel = $minHeadingLevel; + $this->maxHeadingLevel = $maxHeadingLevel; + } + + public function generate(Document $document): ?TableOfContents + { + $toc = $this->createToc(); + + $normalizer = $this->getNormalizer($toc); + + $firstHeading = null; + + foreach ($this->getHeadingLinks($document) as $headingLink) { + $heading = $headingLink->parent(); + // Make sure this is actually tied to a heading + if (!$heading instanceof Heading) { + continue; + } + + // Skip any headings outside the configured min/max levels + if ($heading->getLevel() < $this->minHeadingLevel || $heading->getLevel() > $this->maxHeadingLevel) { + continue; + } + + // Keep track of the first heading we see - we might need this later + $firstHeading = $firstHeading ?? $heading; + + // Keep track of the start and end lines + $toc->setStartLine($firstHeading->getStartLine()); + $toc->setEndLine($heading->getEndLine()); + + // Create the new link + $link = new Link('#' . $headingLink->getSlug(), $heading->getStringContent()); + $paragraph = new Paragraph(); + $paragraph->setStartLine($heading->getStartLine()); + $paragraph->setEndLine($heading->getEndLine()); + $paragraph->appendChild($link); + + $listItem = new ListItem($toc->getListData()); + $listItem->setStartLine($heading->getStartLine()); + $listItem->setEndLine($heading->getEndLine()); + $listItem->appendChild($paragraph); + + // Add it to the correct place + $normalizer->addItem($heading->getLevel(), $listItem); + } + + // Don't add the TOC if no headings were present + if (!$toc->hasChildren() || $firstHeading === null) { + return null; + } + + return $toc; + } + + private function createToc(): TableOfContents + { + $listData = new ListData(); + + if ($this->style === self::STYLE_BULLET) { + $listData->type = ListBlock::TYPE_BULLET; + } elseif ($this->style === self::STYLE_ORDERED) { + $listData->type = ListBlock::TYPE_ORDERED; + } else { + throw new InvalidOptionException(\sprintf('Invalid table of contents list style "%s"', $this->style)); + } + + return new TableOfContents($listData); + } + + /** + * @param Document $document + * + * @return iterable + */ + private function getHeadingLinks(Document $document) + { + $walker = $document->walker(); + while ($event = $walker->next()) { + if ($event->isEntering() && ($node = $event->getNode()) instanceof HeadingPermalink) { + yield $node; + } + } + } + + private function getNormalizer(TableOfContents $toc): NormalizerStrategyInterface + { + switch ($this->normalizationStrategy) { + case self::NORMALIZE_DISABLED: + return new AsIsNormalizerStrategy($toc); + case self::NORMALIZE_RELATIVE: + return new RelativeNormalizerStrategy($toc); + case self::NORMALIZE_FLAT: + return new FlatNormalizerStrategy($toc); + default: + throw new InvalidOptionException(\sprintf('Invalid table of contents normalization strategy "%s"', $this->normalizationStrategy)); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php new file mode 100644 index 0000000000..f0f491a3db --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Block\Element\Document; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; + +interface TableOfContentsGeneratorInterface +{ + public function generate(Document $document): ?TableOfContents; +} + +// Trigger autoload without causing a deprecated error +\class_exists(TableOfContents::class); diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php new file mode 100644 index 0000000000..bae6787207 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Block\Parser\BlockParserInterface; +use League\CommonMark\ContextInterface; +use League\CommonMark\Cursor; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; +use League\CommonMark\Util\ConfigurationAwareInterface; +use League\CommonMark\Util\ConfigurationInterface; + +final class TableOfContentsPlaceholderParser implements BlockParserInterface, ConfigurationAwareInterface +{ + /** @var ConfigurationInterface */ + private $config; + + public function parse(ContextInterface $context, Cursor $cursor): bool + { + $placeholder = $this->config->get('table_of_contents/placeholder'); + if ($placeholder === null) { + return false; + } + + // The placeholder must be the only thing on the line + if ($cursor->match('/^' . \preg_quote($placeholder, '/') . '$/') === null) { + return false; + } + + $context->addBlock(new TableOfContentsPlaceholder()); + + return true; + } + + public function setConfiguration(ConfigurationInterface $configuration) + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php new file mode 100644 index 0000000000..e63058d091 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Block\Element\AbstractBlock; +use League\CommonMark\Block\Renderer\BlockRendererInterface; +use League\CommonMark\ElementRendererInterface; + +final class TableOfContentsPlaceholderRenderer implements BlockRendererInterface +{ + public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, bool $inTightList = false) + { + return ''; + } +} diff --git a/vendor/league/commonmark/src/Node/Node.php b/vendor/league/commonmark/src/Node/Node.php index 07b0f75018..96644b7cdc 100644 --- a/vendor/league/commonmark/src/Node/Node.php +++ b/vendor/league/commonmark/src/Node/Node.php @@ -255,4 +255,25 @@ abstract class Node { return new NodeWalker($this); } + + /** + * Clone the current node and its children + * + * WARNING: This is a recursive function and should not be called on deeply-nested node trees! + */ + public function __clone() + { + // Cloned nodes are detached from their parents, siblings, and children + $this->parent = null; + $this->previous = null; + $this->next = null; + // But save a copy of the children since we'll need that in a moment + $children = $this->children(); + $this->detachChildren(); + + // The original children get cloned and re-added + foreach ($children as $child) { + $this->appendChild(clone $child); + } + } } diff --git a/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php b/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php new file mode 100644 index 0000000000..3b6a06a64c --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Normalizer; + +/** + * Creates URL-friendly strings based on the given string input + */ +final class SlugNormalizer implements TextNormalizerInterface +{ + /** + * {@inheritdoc} + */ + public function normalize(string $text, $context = null): string + { + // Trim whitespace + $slug = \trim($text); + // Convert to lowercase + $slug = \mb_strtolower($slug); + // Try replacing whitespace with a dash + $slug = \preg_replace('/\s+/u', '-', $slug) ?? $slug; + // Try removing characters other than letters, numbers, and marks. + $slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug) ?? $slug; + + return $slug; + } +} diff --git a/vendor/league/commonmark/src/Normalizer/TextNormalizer.php b/vendor/league/commonmark/src/Normalizer/TextNormalizer.php new file mode 100644 index 0000000000..e662600faa --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/TextNormalizer.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Normalizer; + +/*** + * Normalize text input using the steps given by the CommonMark spec to normalize labels + * + * @see https://spec.commonmark.org/0.29/#matches + */ +final class TextNormalizer implements TextNormalizerInterface +{ + /** + * @var array> + * + * Source: https://github.com/symfony/polyfill-mbstring/blob/master/Mbstring.php + */ + private const CASE_FOLD = [ + ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE", "\xC3\x9F", "\xE1\xBA\x9E"], + ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι', 'ss', 'ss'], + ]; + + /** + * {@inheritdoc} + */ + public function normalize(string $text, $context = null): string + { + // Collapse internal whitespace to single space and remove + // leading/trailing whitespace + $text = \preg_replace('/\s+/', ' ', \trim($text)); + + if (!\defined('MB_CASE_FOLD')) { + // We're not on a version of PHP (7.3+) which has this feature + $text = \str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $text); + + return \mb_strtolower($text, 'UTF-8'); + } + + return \mb_convert_case($text, \MB_CASE_FOLD, 'UTF-8'); + } +} diff --git a/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php b/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php new file mode 100644 index 0000000000..c1a9eb12c4 --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Normalizer; + +/** + * Creates a normalized version of the given input text + */ +interface TextNormalizerInterface +{ + /** + * @param string $text The text to normalize + * @param mixed $context Additional context about the text being normalized (optional) + */ + public function normalize(string $text, $context = null): string; +} diff --git a/vendor/league/commonmark/src/Reference/Reference.php b/vendor/league/commonmark/src/Reference/Reference.php index 143f8fb3d8..aeb3a6c956 100644 --- a/vendor/league/commonmark/src/Reference/Reference.php +++ b/vendor/league/commonmark/src/Reference/Reference.php @@ -14,6 +14,8 @@ namespace League\CommonMark\Reference; +use League\CommonMark\Normalizer\TextNormalizer; + final class Reference implements ReferenceInterface { /** @@ -31,19 +33,9 @@ final class Reference implements ReferenceInterface */ protected $title; - /** - * @var array> - * - * Source: https://github.com/symfony/polyfill-mbstring/blob/master/Mbstring.php - */ - private static $caseFold = [ - ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE", "\xC3\x9F", "\xE1\xBA\x9E"], - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι', 'ss', 'ss'], - ]; - public function __construct(string $label, string $destination, string $title) { - $this->label = self::normalizeReference($label); + $this->label = $label; $this->destination = $destination; $this->title = $title; } @@ -71,20 +63,13 @@ final class Reference implements ReferenceInterface * @param string $string * * @return string + * + * @deprecated Use TextNormalizer::normalize() instead */ public static function normalizeReference(string $string): string { - // Collapse internal whitespace to single space and remove - // leading/trailing whitespace - $string = \preg_replace('/\s+/', ' ', \trim($string)); - - if (!\defined('MB_CASE_FOLD')) { - // We're not on a version of PHP (7.3+) which has this feature - $string = \str_replace(self::$caseFold[0], self::$caseFold[1], $string); - - return \mb_strtoupper($string, 'UTF-8'); - } + @trigger_error(sprintf('%s::normlizeReference() is deprecated; use %s::normalize() instead', self::class, TextNormalizer::class), E_USER_DEPRECATED); - return \mb_convert_case($string, \MB_CASE_FOLD, 'UTF-8'); + return (new TextNormalizer())->normalize($string); } } diff --git a/vendor/league/commonmark/src/Reference/ReferenceMap.php b/vendor/league/commonmark/src/Reference/ReferenceMap.php index faad074376..e016c14a95 100644 --- a/vendor/league/commonmark/src/Reference/ReferenceMap.php +++ b/vendor/league/commonmark/src/Reference/ReferenceMap.php @@ -14,32 +14,43 @@ namespace League\CommonMark\Reference; +use League\CommonMark\Normalizer\TextNormalizer; + /** * A collection of references, indexed by label */ final class ReferenceMap implements ReferenceMapInterface { + /** @var TextNormalizer */ + private $normalizer; + /** * @var ReferenceInterface[] */ - protected $references = []; + private $references = []; + + public function __construct() + { + $this->normalizer = new TextNormalizer(); + } public function addReference(ReferenceInterface $reference): void { - $key = Reference::normalizeReference($reference->getLabel()); + $key = $this->normalizer->normalize($reference->getLabel()); + $this->references[$key] = $reference; } public function contains(string $label): bool { - $label = Reference::normalizeReference($label); + $label = $this->normalizer->normalize($label); return isset($this->references[$label]); } public function getReference(string $label): ?ReferenceInterface { - $label = Reference::normalizeReference($label); + $label = $this->normalizer->normalize($label); if (!isset($this->references[$label])) { return null; diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json index afb2a443e9..01d5aef939 100644 --- a/vendor/symfony/polyfill-ctype/composer.json +++ b/vendor/symfony/polyfill-ctype/composer.json @@ -29,6 +29,10 @@ "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } } } diff --git a/vendor/symfony/polyfill-iconv/Resources/charset/translit.php b/vendor/symfony/polyfill-iconv/Resources/charset/translit.php index ed59858dc4..779db649c7 100644 --- a/vendor/symfony/polyfill-iconv/Resources/charset/translit.php +++ b/vendor/symfony/polyfill-iconv/Resources/charset/translit.php @@ -1,6 +1,6 @@ 'μ', '¼' => ' 1⁄4 ', '½' => ' 1⁄2 ', @@ -1393,13 +1393,13 @@ static $data = array ( '廓' => '廓', '兀' => '兀', '嗀' => '嗀', - '﨎' => '', - '﨏' => '', + '﨎' => '' . "\0" . '', + '﨏' => '' . "\0" . '', '塚' => '塚', - '﨑' => '', + '﨑' => '' . "\0" . '', '晴' => '晴', - '﨓' => '', - '﨔' => '', + '﨓' => '' . "\0" . '', + '﨔' => '' . "\0" . '', '凞' => '凞', '猪' => '猪', '益' => '益', @@ -1410,17 +1410,17 @@ static $data = array ( '靖' => '靖', '精' => '精', '羽' => '羽', - '﨟' => '', + '﨟' => '' . "\0" . '', '蘒' => '蘒', - '﨡' => '', + '﨡' => '' . "\0" . '', '諸' => '諸', - '﨣' => '', - '﨤' => '', + '﨣' => '' . "\0" . '', + '﨤' => '' . "\0" . '', '逸' => '逸', '都' => '都', - '﨧' => '', - '﨨' => '', - '﨩' => '', + '﨧' => '' . "\0" . '', + '﨨' => '' . "\0" . '', + '﨩' => '' . "\0" . '', '飯' => '飯', '飼' => '飼', '館' => '館', @@ -3146,6 +3146,16 @@ static $data = array ( '🉈' => '〔敗〕', '🉐' => '(得)', '🉑' => '(可)', + '🯰' => '0', + '🯱' => '1', + '🯲' => '2', + '🯳' => '3', + '🯴' => '4', + '🯵' => '5', + '🯶' => '6', + '🯷' => '7', + '🯸' => '8', + '🯹' => '9', '丽' => '丽', '丸' => '丸', '乁' => '乁', @@ -4091,8 +4101,3 @@ static $data = array ( '⦅' => '((', '⦆' => '))', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-iconv/composer.json b/vendor/symfony/polyfill-iconv/composer.json index 3df179e351..3d31cb7dff 100644 --- a/vendor/symfony/polyfill-iconv/composer.json +++ b/vendor/symfony/polyfill-iconv/composer.json @@ -29,6 +29,10 @@ "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } } } diff --git a/vendor/symfony/polyfill-intl-idn/composer.json b/vendor/symfony/polyfill-intl-idn/composer.json index 550bdc2a86..1c64accf69 100644 --- a/vendor/symfony/polyfill-intl-idn/composer.json +++ b/vendor/symfony/polyfill-intl-idn/composer.json @@ -31,6 +31,10 @@ "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } } } diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php index e6fbfa64e6..a22eca57bd 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php @@ -1,6 +1,6 @@ 'a', 'B' => 'b', 'C' => 'c', @@ -510,6 +510,138 @@ return array( 'Ⴥ' => 'ⴥ', 'Ⴧ' => 'ⴧ', 'Ⴭ' => 'ⴭ', + 'Ꭰ' => 'ꭰ', + 'Ꭱ' => 'ꭱ', + 'Ꭲ' => 'ꭲ', + 'Ꭳ' => 'ꭳ', + 'Ꭴ' => 'ꭴ', + 'Ꭵ' => 'ꭵ', + 'Ꭶ' => 'ꭶ', + 'Ꭷ' => 'ꭷ', + 'Ꭸ' => 'ꭸ', + 'Ꭹ' => 'ꭹ', + 'Ꭺ' => 'ꭺ', + 'Ꭻ' => 'ꭻ', + 'Ꭼ' => 'ꭼ', + 'Ꭽ' => 'ꭽ', + 'Ꭾ' => 'ꭾ', + 'Ꭿ' => 'ꭿ', + 'Ꮀ' => 'ꮀ', + 'Ꮁ' => 'ꮁ', + 'Ꮂ' => 'ꮂ', + 'Ꮃ' => 'ꮃ', + 'Ꮄ' => 'ꮄ', + 'Ꮅ' => 'ꮅ', + 'Ꮆ' => 'ꮆ', + 'Ꮇ' => 'ꮇ', + 'Ꮈ' => 'ꮈ', + 'Ꮉ' => 'ꮉ', + 'Ꮊ' => 'ꮊ', + 'Ꮋ' => 'ꮋ', + 'Ꮌ' => 'ꮌ', + 'Ꮍ' => 'ꮍ', + 'Ꮎ' => 'ꮎ', + 'Ꮏ' => 'ꮏ', + 'Ꮐ' => 'ꮐ', + 'Ꮑ' => 'ꮑ', + 'Ꮒ' => 'ꮒ', + 'Ꮓ' => 'ꮓ', + 'Ꮔ' => 'ꮔ', + 'Ꮕ' => 'ꮕ', + 'Ꮖ' => 'ꮖ', + 'Ꮗ' => 'ꮗ', + 'Ꮘ' => 'ꮘ', + 'Ꮙ' => 'ꮙ', + 'Ꮚ' => 'ꮚ', + 'Ꮛ' => 'ꮛ', + 'Ꮜ' => 'ꮜ', + 'Ꮝ' => 'ꮝ', + 'Ꮞ' => 'ꮞ', + 'Ꮟ' => 'ꮟ', + 'Ꮠ' => 'ꮠ', + 'Ꮡ' => 'ꮡ', + 'Ꮢ' => 'ꮢ', + 'Ꮣ' => 'ꮣ', + 'Ꮤ' => 'ꮤ', + 'Ꮥ' => 'ꮥ', + 'Ꮦ' => 'ꮦ', + 'Ꮧ' => 'ꮧ', + 'Ꮨ' => 'ꮨ', + 'Ꮩ' => 'ꮩ', + 'Ꮪ' => 'ꮪ', + 'Ꮫ' => 'ꮫ', + 'Ꮬ' => 'ꮬ', + 'Ꮭ' => 'ꮭ', + 'Ꮮ' => 'ꮮ', + 'Ꮯ' => 'ꮯ', + 'Ꮰ' => 'ꮰ', + 'Ꮱ' => 'ꮱ', + 'Ꮲ' => 'ꮲ', + 'Ꮳ' => 'ꮳ', + 'Ꮴ' => 'ꮴ', + 'Ꮵ' => 'ꮵ', + 'Ꮶ' => 'ꮶ', + 'Ꮷ' => 'ꮷ', + 'Ꮸ' => 'ꮸ', + 'Ꮹ' => 'ꮹ', + 'Ꮺ' => 'ꮺ', + 'Ꮻ' => 'ꮻ', + 'Ꮼ' => 'ꮼ', + 'Ꮽ' => 'ꮽ', + 'Ꮾ' => 'ꮾ', + 'Ꮿ' => 'ꮿ', + 'Ᏸ' => 'ᏸ', + 'Ᏹ' => 'ᏹ', + 'Ᏺ' => 'ᏺ', + 'Ᏻ' => 'ᏻ', + 'Ᏼ' => 'ᏼ', + 'Ᏽ' => 'ᏽ', + 'Ა' => 'ა', + 'Ბ' => 'ბ', + 'Გ' => 'გ', + 'Დ' => 'დ', + 'Ე' => 'ე', + 'Ვ' => 'ვ', + 'Ზ' => 'ზ', + 'Თ' => 'თ', + 'Ი' => 'ი', + 'Კ' => 'კ', + 'Ლ' => 'ლ', + 'Მ' => 'მ', + 'Ნ' => 'ნ', + 'Ო' => 'ო', + 'Პ' => 'პ', + 'Ჟ' => 'ჟ', + 'Რ' => 'რ', + 'Ს' => 'ს', + 'Ტ' => 'ტ', + 'Უ' => 'უ', + 'Ფ' => 'ფ', + 'Ქ' => 'ქ', + 'Ღ' => 'ღ', + 'Ყ' => 'ყ', + 'Შ' => 'შ', + 'Ჩ' => 'ჩ', + 'Ც' => 'ც', + 'Ძ' => 'ძ', + 'Წ' => 'წ', + 'Ჭ' => 'ჭ', + 'Ხ' => 'ხ', + 'Ჯ' => 'ჯ', + 'Ჰ' => 'ჰ', + 'Ჱ' => 'ჱ', + 'Ჲ' => 'ჲ', + 'Ჳ' => 'ჳ', + 'Ჴ' => 'ჴ', + 'Ჵ' => 'ჵ', + 'Ჶ' => 'ჶ', + 'Ჷ' => 'ჷ', + 'Ჸ' => 'ჸ', + 'Ჹ' => 'ჹ', + 'Ჺ' => 'ჺ', + 'Ჽ' => 'ჽ', + 'Ჾ' => 'ჾ', + 'Ჿ' => 'ჿ', 'Ḁ' => 'ḁ', 'Ḃ' => 'ḃ', 'Ḅ' => 'ḅ', @@ -993,8 +1125,24 @@ return array( 'Ɜ' => 'ɜ', 'Ɡ' => 'ɡ', 'Ɬ' => 'ɬ', + 'Ɪ' => 'ɪ', 'Ʞ' => 'ʞ', 'Ʇ' => 'ʇ', + 'Ʝ' => 'ʝ', + 'Ꭓ' => 'ꭓ', + 'Ꞵ' => 'ꞵ', + 'Ꞷ' => 'ꞷ', + 'Ꞹ' => 'ꞹ', + 'Ꞻ' => 'ꞻ', + 'Ꞽ' => 'ꞽ', + 'Ꞿ' => 'ꞿ', + 'Ꟃ' => 'ꟃ', + 'Ꞔ' => 'ꞔ', + 'Ʂ' => 'ʂ', + 'Ᶎ' => 'ᶎ', + 'Ꟈ' => 'ꟈ', + 'Ꟊ' => 'ꟊ', + 'Ꟶ' => 'ꟶ', 'A' => 'a', 'B' => 'b', 'C' => 'c', @@ -1061,6 +1209,93 @@ return array( '𐐥' => '𐑍', '𐐦' => '𐑎', '𐐧' => '𐑏', + '𐒰' => '𐓘', + '𐒱' => '𐓙', + '𐒲' => '𐓚', + '𐒳' => '𐓛', + '𐒴' => '𐓜', + '𐒵' => '𐓝', + '𐒶' => '𐓞', + '𐒷' => '𐓟', + '𐒸' => '𐓠', + '𐒹' => '𐓡', + '𐒺' => '𐓢', + '𐒻' => '𐓣', + '𐒼' => '𐓤', + '𐒽' => '𐓥', + '𐒾' => '𐓦', + '𐒿' => '𐓧', + '𐓀' => '𐓨', + '𐓁' => '𐓩', + '𐓂' => '𐓪', + '𐓃' => '𐓫', + '𐓄' => '𐓬', + '𐓅' => '𐓭', + '𐓆' => '𐓮', + '𐓇' => '𐓯', + '𐓈' => '𐓰', + '𐓉' => '𐓱', + '𐓊' => '𐓲', + '𐓋' => '𐓳', + '𐓌' => '𐓴', + '𐓍' => '𐓵', + '𐓎' => '𐓶', + '𐓏' => '𐓷', + '𐓐' => '𐓸', + '𐓑' => '𐓹', + '𐓒' => '𐓺', + '𐓓' => '𐓻', + '𐲀' => '𐳀', + '𐲁' => '𐳁', + '𐲂' => '𐳂', + '𐲃' => '𐳃', + '𐲄' => '𐳄', + '𐲅' => '𐳅', + '𐲆' => '𐳆', + '𐲇' => '𐳇', + '𐲈' => '𐳈', + '𐲉' => '𐳉', + '𐲊' => '𐳊', + '𐲋' => '𐳋', + '𐲌' => '𐳌', + '𐲍' => '𐳍', + '𐲎' => '𐳎', + '𐲏' => '𐳏', + '𐲐' => '𐳐', + '𐲑' => '𐳑', + '𐲒' => '𐳒', + '𐲓' => '𐳓', + '𐲔' => '𐳔', + '𐲕' => '𐳕', + '𐲖' => '𐳖', + '𐲗' => '𐳗', + '𐲘' => '𐳘', + '𐲙' => '𐳙', + '𐲚' => '𐳚', + '𐲛' => '𐳛', + '𐲜' => '𐳜', + '𐲝' => '𐳝', + '𐲞' => '𐳞', + '𐲟' => '𐳟', + '𐲠' => '𐳠', + '𐲡' => '𐳡', + '𐲢' => '𐳢', + '𐲣' => '𐳣', + '𐲤' => '𐳤', + '𐲥' => '𐳥', + '𐲦' => '𐳦', + '𐲧' => '𐳧', + '𐲨' => '𐳨', + '𐲩' => '𐳩', + '𐲪' => '𐳪', + '𐲫' => '𐳫', + '𐲬' => '𐳬', + '𐲭' => '𐳭', + '𐲮' => '𐳮', + '𐲯' => '𐳯', + '𐲰' => '𐳰', + '𐲱' => '𐳱', + '𐲲' => '𐳲', '𑢠' => '𑣀', '𑢡' => '𑣁', '𑢢' => '𑣂', @@ -1093,4 +1328,70 @@ return array( '𑢽' => '𑣝', '𑢾' => '𑣞', '𑢿' => '𑣟', + '𖹀' => '𖹠', + '𖹁' => '𖹡', + '𖹂' => '𖹢', + '𖹃' => '𖹣', + '𖹄' => '𖹤', + '𖹅' => '𖹥', + '𖹆' => '𖹦', + '𖹇' => '𖹧', + '𖹈' => '𖹨', + '𖹉' => '𖹩', + '𖹊' => '𖹪', + '𖹋' => '𖹫', + '𖹌' => '𖹬', + '𖹍' => '𖹭', + '𖹎' => '𖹮', + '𖹏' => '𖹯', + '𖹐' => '𖹰', + '𖹑' => '𖹱', + '𖹒' => '𖹲', + '𖹓' => '𖹳', + '𖹔' => '𖹴', + '𖹕' => '𖹵', + '𖹖' => '𖹶', + '𖹗' => '𖹷', + '𖹘' => '𖹸', + '𖹙' => '𖹹', + '𖹚' => '𖹺', + '𖹛' => '𖹻', + '𖹜' => '𖹼', + '𖹝' => '𖹽', + '𖹞' => '𖹾', + '𖹟' => '𖹿', + '𞤀' => '𞤢', + '𞤁' => '𞤣', + '𞤂' => '𞤤', + '𞤃' => '𞤥', + '𞤄' => '𞤦', + '𞤅' => '𞤧', + '𞤆' => '𞤨', + '𞤇' => '𞤩', + '𞤈' => '𞤪', + '𞤉' => '𞤫', + '𞤊' => '𞤬', + '𞤋' => '𞤭', + '𞤌' => '𞤮', + '𞤍' => '𞤯', + '𞤎' => '𞤰', + '𞤏' => '𞤱', + '𞤐' => '𞤲', + '𞤑' => '𞤳', + '𞤒' => '𞤴', + '𞤓' => '𞤵', + '𞤔' => '𞤶', + '𞤕' => '𞤷', + '𞤖' => '𞤸', + '𞤗' => '𞤹', + '𞤘' => '𞤺', + '𞤙' => '𞤻', + '𞤚' => '𞤼', + '𞤛' => '𞤽', + '𞤜' => '𞤾', + '𞤝' => '𞤿', + '𞤞' => '𞥀', + '𞤟' => '𞥁', + '𞤠' => '𞥂', + '𞤡' => '𞥃', ); diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php index b8103b2e80..ecbc15895e 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php @@ -1,6 +1,6 @@ 'A', 'b' => 'B', 'c' => 'C', @@ -225,6 +225,7 @@ return array( 'ɦ' => 'Ɦ', 'ɨ' => 'Ɨ', 'ɩ' => 'Ɩ', + 'ɪ' => 'Ɪ', 'ɫ' => 'Ɫ', 'ɬ' => 'Ɬ', 'ɯ' => 'Ɯ', @@ -233,6 +234,7 @@ return array( 'ɵ' => 'Ɵ', 'ɽ' => 'Ɽ', 'ʀ' => 'Ʀ', + 'ʂ' => 'Ʂ', 'ʃ' => 'Ʃ', 'ʇ' => 'Ʇ', 'ʈ' => 'Ʈ', @@ -241,6 +243,7 @@ return array( 'ʋ' => 'Ʋ', 'ʌ' => 'Ʌ', 'ʒ' => 'Ʒ', + 'ʝ' => 'Ʝ', 'ʞ' => 'Ʞ', 'ͅ' => 'Ι', 'ͱ' => 'Ͱ', @@ -493,8 +496,70 @@ return array( 'ք' => 'Ք', 'օ' => 'Օ', 'ֆ' => 'Ֆ', + 'ა' => 'Ა', + 'ბ' => 'Ბ', + 'გ' => 'Გ', + 'დ' => 'Დ', + 'ე' => 'Ე', + 'ვ' => 'Ვ', + 'ზ' => 'Ზ', + 'თ' => 'Თ', + 'ი' => 'Ი', + 'კ' => 'Კ', + 'ლ' => 'Ლ', + 'მ' => 'Მ', + 'ნ' => 'Ნ', + 'ო' => 'Ო', + 'პ' => 'Პ', + 'ჟ' => 'Ჟ', + 'რ' => 'Რ', + 'ს' => 'Ს', + 'ტ' => 'Ტ', + 'უ' => 'Უ', + 'ფ' => 'Ფ', + 'ქ' => 'Ქ', + 'ღ' => 'Ღ', + 'ყ' => 'Ყ', + 'შ' => 'Შ', + 'ჩ' => 'Ჩ', + 'ც' => 'Ც', + 'ძ' => 'Ძ', + 'წ' => 'Წ', + 'ჭ' => 'Ჭ', + 'ხ' => 'Ხ', + 'ჯ' => 'Ჯ', + 'ჰ' => 'Ჰ', + 'ჱ' => 'Ჱ', + 'ჲ' => 'Ჲ', + 'ჳ' => 'Ჳ', + 'ჴ' => 'Ჴ', + 'ჵ' => 'Ჵ', + 'ჶ' => 'Ჶ', + 'ჷ' => 'Ჷ', + 'ჸ' => 'Ჸ', + 'ჹ' => 'Ჹ', + 'ჺ' => 'Ჺ', + 'ჽ' => 'Ჽ', + 'ჾ' => 'Ჾ', + 'ჿ' => 'Ჿ', + 'ᏸ' => 'Ᏸ', + 'ᏹ' => 'Ᏹ', + 'ᏺ' => 'Ᏺ', + 'ᏻ' => 'Ᏻ', + 'ᏼ' => 'Ᏼ', + 'ᏽ' => 'Ᏽ', + 'ᲀ' => 'В', + 'ᲁ' => 'Д', + 'ᲂ' => 'О', + 'ᲃ' => 'С', + 'ᲄ' => 'Т', + 'ᲅ' => 'Т', + 'ᲆ' => 'Ъ', + 'ᲇ' => 'Ѣ', + 'ᲈ' => 'Ꙋ', 'ᵹ' => 'Ᵹ', 'ᵽ' => 'Ᵽ', + 'ᶎ' => 'Ᶎ', 'ḁ' => 'Ḁ', 'ḃ' => 'Ḃ', 'ḅ' => 'Ḅ', @@ -993,6 +1058,7 @@ return array( 'ꞌ' => 'Ꞌ', 'ꞑ' => 'Ꞑ', 'ꞓ' => 'Ꞓ', + 'ꞔ' => 'Ꞔ', 'ꞗ' => 'Ꞗ', 'ꞙ' => 'Ꞙ', 'ꞛ' => 'Ꞛ', @@ -1003,6 +1069,97 @@ return array( 'ꞥ' => 'Ꞥ', 'ꞧ' => 'Ꞧ', 'ꞩ' => 'Ꞩ', + 'ꞵ' => 'Ꞵ', + 'ꞷ' => 'Ꞷ', + 'ꞹ' => 'Ꞹ', + 'ꞻ' => 'Ꞻ', + 'ꞽ' => 'Ꞽ', + 'ꞿ' => 'Ꞿ', + 'ꟃ' => 'Ꟃ', + 'ꟈ' => 'Ꟈ', + 'ꟊ' => 'Ꟊ', + 'ꟶ' => 'Ꟶ', + 'ꭓ' => 'Ꭓ', + 'ꭰ' => 'Ꭰ', + 'ꭱ' => 'Ꭱ', + 'ꭲ' => 'Ꭲ', + 'ꭳ' => 'Ꭳ', + 'ꭴ' => 'Ꭴ', + 'ꭵ' => 'Ꭵ', + 'ꭶ' => 'Ꭶ', + 'ꭷ' => 'Ꭷ', + 'ꭸ' => 'Ꭸ', + 'ꭹ' => 'Ꭹ', + 'ꭺ' => 'Ꭺ', + 'ꭻ' => 'Ꭻ', + 'ꭼ' => 'Ꭼ', + 'ꭽ' => 'Ꭽ', + 'ꭾ' => 'Ꭾ', + 'ꭿ' => 'Ꭿ', + 'ꮀ' => 'Ꮀ', + 'ꮁ' => 'Ꮁ', + 'ꮂ' => 'Ꮂ', + 'ꮃ' => 'Ꮃ', + 'ꮄ' => 'Ꮄ', + 'ꮅ' => 'Ꮅ', + 'ꮆ' => 'Ꮆ', + 'ꮇ' => 'Ꮇ', + 'ꮈ' => 'Ꮈ', + 'ꮉ' => 'Ꮉ', + 'ꮊ' => 'Ꮊ', + 'ꮋ' => 'Ꮋ', + 'ꮌ' => 'Ꮌ', + 'ꮍ' => 'Ꮍ', + 'ꮎ' => 'Ꮎ', + 'ꮏ' => 'Ꮏ', + 'ꮐ' => 'Ꮐ', + 'ꮑ' => 'Ꮑ', + 'ꮒ' => 'Ꮒ', + 'ꮓ' => 'Ꮓ', + 'ꮔ' => 'Ꮔ', + 'ꮕ' => 'Ꮕ', + 'ꮖ' => 'Ꮖ', + 'ꮗ' => 'Ꮗ', + 'ꮘ' => 'Ꮘ', + 'ꮙ' => 'Ꮙ', + 'ꮚ' => 'Ꮚ', + 'ꮛ' => 'Ꮛ', + 'ꮜ' => 'Ꮜ', + 'ꮝ' => 'Ꮝ', + 'ꮞ' => 'Ꮞ', + 'ꮟ' => 'Ꮟ', + 'ꮠ' => 'Ꮠ', + 'ꮡ' => 'Ꮡ', + 'ꮢ' => 'Ꮢ', + 'ꮣ' => 'Ꮣ', + 'ꮤ' => 'Ꮤ', + 'ꮥ' => 'Ꮥ', + 'ꮦ' => 'Ꮦ', + 'ꮧ' => 'Ꮧ', + 'ꮨ' => 'Ꮨ', + 'ꮩ' => 'Ꮩ', + 'ꮪ' => 'Ꮪ', + 'ꮫ' => 'Ꮫ', + 'ꮬ' => 'Ꮬ', + 'ꮭ' => 'Ꮭ', + 'ꮮ' => 'Ꮮ', + 'ꮯ' => 'Ꮯ', + 'ꮰ' => 'Ꮰ', + 'ꮱ' => 'Ꮱ', + 'ꮲ' => 'Ꮲ', + 'ꮳ' => 'Ꮳ', + 'ꮴ' => 'Ꮴ', + 'ꮵ' => 'Ꮵ', + 'ꮶ' => 'Ꮶ', + 'ꮷ' => 'Ꮷ', + 'ꮸ' => 'Ꮸ', + 'ꮹ' => 'Ꮹ', + 'ꮺ' => 'Ꮺ', + 'ꮻ' => 'Ꮻ', + 'ꮼ' => 'Ꮼ', + 'ꮽ' => 'Ꮽ', + 'ꮾ' => 'Ꮾ', + 'ꮿ' => 'Ꮿ', 'a' => 'A', 'b' => 'B', 'c' => 'C', @@ -1069,6 +1226,93 @@ return array( '𐑍' => '𐐥', '𐑎' => '𐐦', '𐑏' => '𐐧', + '𐓘' => '𐒰', + '𐓙' => '𐒱', + '𐓚' => '𐒲', + '𐓛' => '𐒳', + '𐓜' => '𐒴', + '𐓝' => '𐒵', + '𐓞' => '𐒶', + '𐓟' => '𐒷', + '𐓠' => '𐒸', + '𐓡' => '𐒹', + '𐓢' => '𐒺', + '𐓣' => '𐒻', + '𐓤' => '𐒼', + '𐓥' => '𐒽', + '𐓦' => '𐒾', + '𐓧' => '𐒿', + '𐓨' => '𐓀', + '𐓩' => '𐓁', + '𐓪' => '𐓂', + '𐓫' => '𐓃', + '𐓬' => '𐓄', + '𐓭' => '𐓅', + '𐓮' => '𐓆', + '𐓯' => '𐓇', + '𐓰' => '𐓈', + '𐓱' => '𐓉', + '𐓲' => '𐓊', + '𐓳' => '𐓋', + '𐓴' => '𐓌', + '𐓵' => '𐓍', + '𐓶' => '𐓎', + '𐓷' => '𐓏', + '𐓸' => '𐓐', + '𐓹' => '𐓑', + '𐓺' => '𐓒', + '𐓻' => '𐓓', + '𐳀' => '𐲀', + '𐳁' => '𐲁', + '𐳂' => '𐲂', + '𐳃' => '𐲃', + '𐳄' => '𐲄', + '𐳅' => '𐲅', + '𐳆' => '𐲆', + '𐳇' => '𐲇', + '𐳈' => '𐲈', + '𐳉' => '𐲉', + '𐳊' => '𐲊', + '𐳋' => '𐲋', + '𐳌' => '𐲌', + '𐳍' => '𐲍', + '𐳎' => '𐲎', + '𐳏' => '𐲏', + '𐳐' => '𐲐', + '𐳑' => '𐲑', + '𐳒' => '𐲒', + '𐳓' => '𐲓', + '𐳔' => '𐲔', + '𐳕' => '𐲕', + '𐳖' => '𐲖', + '𐳗' => '𐲗', + '𐳘' => '𐲘', + '𐳙' => '𐲙', + '𐳚' => '𐲚', + '𐳛' => '𐲛', + '𐳜' => '𐲜', + '𐳝' => '𐲝', + '𐳞' => '𐲞', + '𐳟' => '𐲟', + '𐳠' => '𐲠', + '𐳡' => '𐲡', + '𐳢' => '𐲢', + '𐳣' => '𐲣', + '𐳤' => '𐲤', + '𐳥' => '𐲥', + '𐳦' => '𐲦', + '𐳧' => '𐲧', + '𐳨' => '𐲨', + '𐳩' => '𐲩', + '𐳪' => '𐲪', + '𐳫' => '𐲫', + '𐳬' => '𐲬', + '𐳭' => '𐲭', + '𐳮' => '𐲮', + '𐳯' => '𐲯', + '𐳰' => '𐲰', + '𐳱' => '𐲱', + '𐳲' => '𐲲', '𑣀' => '𑢠', '𑣁' => '𑢡', '𑣂' => '𑢢', @@ -1101,4 +1345,70 @@ return array( '𑣝' => '𑢽', '𑣞' => '𑢾', '𑣟' => '𑢿', + '𖹠' => '𖹀', + '𖹡' => '𖹁', + '𖹢' => '𖹂', + '𖹣' => '𖹃', + '𖹤' => '𖹄', + '𖹥' => '𖹅', + '𖹦' => '𖹆', + '𖹧' => '𖹇', + '𖹨' => '𖹈', + '𖹩' => '𖹉', + '𖹪' => '𖹊', + '𖹫' => '𖹋', + '𖹬' => '𖹌', + '𖹭' => '𖹍', + '𖹮' => '𖹎', + '𖹯' => '𖹏', + '𖹰' => '𖹐', + '𖹱' => '𖹑', + '𖹲' => '𖹒', + '𖹳' => '𖹓', + '𖹴' => '𖹔', + '𖹵' => '𖹕', + '𖹶' => '𖹖', + '𖹷' => '𖹗', + '𖹸' => '𖹘', + '𖹹' => '𖹙', + '𖹺' => '𖹚', + '𖹻' => '𖹛', + '𖹼' => '𖹜', + '𖹽' => '𖹝', + '𖹾' => '𖹞', + '𖹿' => '𖹟', + '𞤢' => '𞤀', + '𞤣' => '𞤁', + '𞤤' => '𞤂', + '𞤥' => '𞤃', + '𞤦' => '𞤄', + '𞤧' => '𞤅', + '𞤨' => '𞤆', + '𞤩' => '𞤇', + '𞤪' => '𞤈', + '𞤫' => '𞤉', + '𞤬' => '𞤊', + '𞤭' => '𞤋', + '𞤮' => '𞤌', + '𞤯' => '𞤍', + '𞤰' => '𞤎', + '𞤱' => '𞤏', + '𞤲' => '𞤐', + '𞤳' => '𞤑', + '𞤴' => '𞤒', + '𞤵' => '𞤓', + '𞤶' => '𞤔', + '𞤷' => '𞤕', + '𞤸' => '𞤖', + '𞤹' => '𞤗', + '𞤺' => '𞤘', + '𞤻' => '𞤙', + '𞤼' => '𞤚', + '𞤽' => '𞤛', + '𞤾' => '𞤜', + '𞤿' => '𞤝', + '𞥀' => '𞤞', + '𞥁' => '𞤟', + '𞥂' => '𞤠', + '𞥃' => '𞤡', ); diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index d3dcc244c3..69b3cd2285 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -29,6 +29,10 @@ "extra": { "branch-alias": { "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } } } -- cgit v1.3