Author: Derick Rethans (derickr)
Date: 2024-11-11T11:53:33Z
Commit: Upgrade CommonMark in plugin · php/web-wiki@3bae2f9 · GitHub
Raw diff: https://github.com/php/web-wiki/commit/3bae2f9582e10e4e7750a254c2565cd0a3fc2d76.diff
Upgrade CommonMark in plugin
Changed paths:
M dokuwiki/lib/plugins/commonmark/composer.json
M dokuwiki/lib/plugins/commonmark/composer.lock
M dokuwiki/lib/plugins/commonmark/vendor/composer/ClassLoader.php
M dokuwiki/lib/plugins/commonmark/vendor/composer/InstalledVersions.php
M dokuwiki/lib/plugins/commonmark/vendor/composer/autoload_real.php
M dokuwiki/lib/plugins/commonmark/vendor/composer/installed.json
M dokuwiki/lib/plugins/commonmark/vendor/composer/installed.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/CHANGELOG.md
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/README.md
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/composer.json
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Node/Block/Paragraph.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/MarkdownParser.php
M dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Util/RegexHelper.php
Diff:
diff --git a/dokuwiki/lib/plugins/commonmark/composer.json b/dokuwiki/lib/plugins/commonmark/composer.json
index d605d5cf..f751b386 100644
--- a/dokuwiki/lib/plugins/commonmark/composer.json
+++ b/dokuwiki/lib/plugins/commonmark/composer.json
@@ -24,7 +24,7 @@
}
},
"require": {
- "league/commonmark": "2.4.*",
+ "league/commonmark": "2.5.*",
"symfony/yaml": "4.*"
},
"config": {
diff --git a/dokuwiki/lib/plugins/commonmark/composer.lock b/dokuwiki/lib/plugins/commonmark/composer.lock
index 98bb0248..2bbf2f25 100644
--- a/dokuwiki/lib/plugins/commonmark/composer.lock
+++ b/dokuwiki/lib/plugins/commonmark/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at Basic usage - Composer,
"This file is @generated automatically"
],
- "content-hash": "f16c3287995e16f245d1b28669e93bd5",
+ "content-hash": "6f9379c5256b7e4e408c31ccb0d94498",
"packages": [
{
"name": "dflydev/dot-access-data",
@@ -83,16 +83,16 @@
},
{
"name": "league/commonmark",
- "version": "2.4.1",
+ "version": "2.5.3",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
- "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5"
+ "reference": "b650144166dfa7703e62a22e493b853b58d874b0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3669d6d5f7a47a93c08ddff335e6d945481a1dd5",
- "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5",
+ "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b650144166dfa7703e62a22e493b853b58d874b0",
+ "reference": "b650144166dfa7703e62a22e493b853b58d874b0",
"shasum": ""
},
"require": {
@@ -105,8 +105,8 @@
},
"require-dev": {
"cebe/markdown": "^1.0",
- "commonmark/cmark": "0.30.0",
- "commonmark/commonmark.js": "0.30.0",
+ "commonmark/cmark": "0.31.1",
+ "commonmark/commonmark.js": "0.31.1",
"composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4",
"erusev/parsedown": "^1.0",
@@ -115,10 +115,10 @@
"michelf/php-markdown": "^1.4 || ^2.0",
"nyholm/psr7": "^1.5",
"phpstan/phpstan": "^1.8.2",
- "phpunit/phpunit": "^9.5.21",
+ "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
"scrutinizer/ocular": "^1.8.1",
- "symfony/finder": "^5.3 | ^6.0",
- "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0",
+ "symfony/finder": "^5.3 | ^6.0 || ^7.0",
+ "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 || ^7.0",
"unleashedtech/php-coding-standard": "^3.1.1",
"vimeo/psalm": "^4.24.0 || ^5.0.0"
},
@@ -128,7 +128,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "2.5-dev"
+ "dev-main": "2.6-dev"
}
},
"autoload": {
@@ -185,7 +185,7 @@
"type": "tidelift"
}
],
- "time": "2023-08-30T16:55:00+00:00"
+ "time": "2024-08-16T11:46:16+00:00"
},
{
"name": "league/config",
@@ -775,10 +775,10 @@
"packages-dev": ,
"aliases": ,
"minimum-stability": "stable",
- "stability-flags": ,
+ "stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
- "platform": ,
- "platform-dev": ,
- "plugin-api-version": "2.3.0"
+ "platform": {},
+ "platform-dev": {},
+ "plugin-api-version": "2.6.0"
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/composer/ClassLoader.php b/dokuwiki/lib/plugins/commonmark/vendor/composer/ClassLoader.php
index afef3fa2..7824d8f7 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/composer/ClassLoader.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/composer/ClassLoader.php
@@ -42,35 +42,37 @@
*/
class ClassLoader
{
- /** @var ?string */
+ /** @var \Closure(string):void */
+ private static $includeFile;
+
+ /** @var string|null */
private $vendorDir;
// PSR-4
/**
- * @var array
- * @psalm-var array<string, array<string, int>>
+ * @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
- * @var array
- * @psalm-var array<string, array<int, string>>
+ * @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
- * @var array
- * @psalm-var array<string, string>
+ * @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
- * @var array
- * @psalm-var array<string, array<string, string>>
+ * List of PSR-0 prefixes
+ *
+ * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
+ *
+ * @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
- * @var array
- * @psalm-var array<string, string>
+ * @var list<string>
*/
private $fallbackDirsPsr0 = array();
@@ -78,8 +80,7 @@ class ClassLoader
private $useIncludePath = false;
/**
- * @var string
- * @psalm-var array<string, string>
+ * @var array<string, string>
*/
private $classMap = array();
@@ -87,29 +88,29 @@ class ClassLoader
private $classMapAuthoritative = false;
/**
- * @var bool
- * @psalm-var array<string, bool>
+ * @var array<string, bool>
*/
private $missingClasses = array();
- /** @var ?string */
+ /** @var string|null */
private $apcuPrefix;
/**
- * @var self
+ * @var array<string, self>
*/
private static $registeredLoaders = array();
/**
- * @param ?string $vendorDir
+ * @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
+ self::initializeIncludeClosure();
}
/**
- * @return string
+ * @return array<string, list<string>>
*/
public function getPrefixes()
{
@@ -121,8 +122,7 @@ public function getPrefixes()
}
/**
- * @return array
- * @psalm-return array<string, array<int, string>>
+ * @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
@@ -130,8 +130,7 @@ public function getPrefixesPsr4()
}
/**
- * @return array
- * @psalm-return array<string, string>
+ * @return list<string>
*/
public function getFallbackDirs()
{
@@ -139,8 +138,7 @@ public function getFallbackDirs()
}
/**
- * @return array
- * @psalm-return array<string, string>
+ * @return list<string>
*/
public function getFallbackDirsPsr4()
{
@@ -148,8 +146,7 @@ public function getFallbackDirsPsr4()
}
/**
- * @return string Array of classname => path
- * @psalm-return array<string, string>
+ * @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
@@ -157,8 +154,7 @@ public function getClassMap()
}
/**
- * @param string $classMap Class to filename map
- * @psalm-param array<string, string> $classMap
+ * @param array<string, string> $classMap Class to filename map
*
* @return void
*/
@@ -175,24 +171,25 @@ public function addClassMap(array $classMap)
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
- * @param string $prefix The prefix
- * @param string|string $paths The PSR-0 root directories
- * @param bool $prepend Whether to prepend the directories
+ * @param string $prefix The prefix
+ * @param list<string>|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
+ $paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
- (array) $paths,
+ $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
- (array) $paths
+ $paths
);
}
@@ -201,19 +198,19 @@ public function add($prefix, $paths, $prepend = false)
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
+ $this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
- (array) $paths,
+ $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
- (array) $paths
+ $paths
);
}
}
@@ -222,9 +219,9 @@ public function add($prefix, $paths, $prepend = false)
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param string|string $paths The PSR-4 base directories
- * @param bool $prepend Whether to prepend the directories
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param list<string>|string $paths The PSR-4 base directories
+ * @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
@@ -232,17 +229,18 @@ public function add($prefix, $paths, $prepend = false)
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
+ $paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
- (array) $paths,
+ $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
- (array) $paths
+ $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@@ -252,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false)
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ $this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
- (array) $paths,
+ $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
- (array) $paths
+ $paths
);
}
}
@@ -272,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false)
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
- * @param string $prefix The prefix
- * @param string|string $paths The PSR-0 base directories
+ * @param string $prefix The prefix
+ * @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
@@ -290,8 +288,8 @@ public function set($prefix, $paths)
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param string|string $paths The PSR-4 base directories
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
@@ -425,7 +423,8 @@ public function unregister()
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
- includeFile($file);
+ $includeFile = self::$includeFile;
+ $includeFile($file);
return true;
}
@@ -476,9 +475,9 @@ public function findFile($class)
}
/**
- * Returns the currently registered loaders indexed by their corresponding vendor directories.
+ * Returns the currently registered loaders keyed by their corresponding vendor directories.
*
- * @return self
+ * @return array<string, self>
*/
public static function getRegisteredLoaders()
{
@@ -555,18 +554,26 @@ private function findFileWithExtension($class, $ext)
return false;
}
-}
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- *
- * @param string $file
- * @return void
- * @private
- */
-function includeFile($file)
-{
- include $file;
+ /**
+ * @return void
+ */
+ private static function initializeIncludeClosure()
+ {
+ if (self::$includeFile !== null) {
+ return;
+ }
+
+ /**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ *
+ * @param string $file
+ * @return void
+ */
+ self::$includeFile = \Closure::bind(static function($file) {
+ include $file;
+ }, null, null);
+ }
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/composer/InstalledVersions.php b/dokuwiki/lib/plugins/commonmark/vendor/composer/InstalledVersions.php
index c6b54af7..51e734a7 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/composer/InstalledVersions.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/composer/InstalledVersions.php
@@ -98,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
- return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
+ return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
@@ -119,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true)
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
- $constraint = $parser->parseConstraints($constraint);
+ $constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
@@ -328,7 +328,9 @@ private static function getInstalled()
if (isset(self::$installedByVendor[$vendorDir])) {
$installed = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
- $installed = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
+ /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string, dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string, dev_requirement: bool, replaced?: string, provided?: string}>} $required */
+ $required = require $vendorDir.'/composer/installed.php';
+ $installed = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
@@ -340,12 +342,17 @@ private static function getInstalled()
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see vendor/composer/composer/src/Composer/installed.php: failed to open stream 2.1.0 · Issue #9937 · composer/composer · GitHub
if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = require __DIR__ . '/installed.php';
+ /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string, dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string, dev_requirement: bool, replaced?: string, provided?: string}>} $required */
+ $required = require __DIR__ . '/installed.php';
+ self::$installed = $required;
} else {
self::$installed = array();
}
}
- $installed = self::$installed;
+
+ if (self::$installed !== array()) {
+ $installed = self::$installed;
+ }
return $installed;
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/composer/autoload_real.php b/dokuwiki/lib/plugins/commonmark/vendor/composer/autoload_real.php
index 801f3cc6..b76227ac 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/composer/autoload_real.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/composer/autoload_real.php
@@ -33,25 +33,18 @@ public static function getLoader()
$loader->register(true);
- $includeFiles = \Composer\Autoload\ComposerStaticInitef565756f0c190b452f9f5a713079493::$files;
- foreach ($includeFiles as $fileIdentifier => $file) {
- composerRequireef565756f0c190b452f9f5a713079493($fileIdentifier, $file);
+ $filesToLoad = \Composer\Autoload\ComposerStaticInitef565756f0c190b452f9f5a713079493::$files;
+ $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+
+ require $file;
+ }
+ }, null, null);
+ foreach ($filesToLoad as $fileIdentifier => $file) {
+ $requireFile($fileIdentifier, $file);
}
return $loader;
}
}
-
-/**
- * @param string $fileIdentifier
- * @param string $file
- * @return void
- */
-function composerRequireef565756f0c190b452f9f5a713079493($fileIdentifier, $file)
-{
- if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
- $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
-
- require $file;
- }
-}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.json b/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.json
index 0e9baf3c..be43d939 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.json
+++ b/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.json
@@ -80,17 +80,17 @@
},
{
"name": "league/commonmark",
- "version": "2.4.1",
- "version_normalized": "2.4.1.0",
+ "version": "2.5.3",
+ "version_normalized": "2.5.3.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
- "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5"
+ "reference": "b650144166dfa7703e62a22e493b853b58d874b0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3669d6d5f7a47a93c08ddff335e6d945481a1dd5",
- "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5",
+ "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b650144166dfa7703e62a22e493b853b58d874b0",
+ "reference": "b650144166dfa7703e62a22e493b853b58d874b0",
"shasum": ""
},
"require": {
@@ -103,8 +103,8 @@
},
"require-dev": {
"cebe/markdown": "^1.0",
- "commonmark/cmark": "0.30.0",
- "commonmark/commonmark.js": "0.30.0",
+ "commonmark/cmark": "0.31.1",
+ "commonmark/commonmark.js": "0.31.1",
"composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4",
"erusev/parsedown": "^1.0",
@@ -113,21 +113,21 @@
"michelf/php-markdown": "^1.4 || ^2.0",
"nyholm/psr7": "^1.5",
"phpstan/phpstan": "^1.8.2",
- "phpunit/phpunit": "^9.5.21",
+ "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
"scrutinizer/ocular": "^1.8.1",
- "symfony/finder": "^5.3 | ^6.0",
- "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0",
+ "symfony/finder": "^5.3 | ^6.0 || ^7.0",
+ "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 || ^7.0",
"unleashedtech/php-coding-standard": "^3.1.1",
"vimeo/psalm": "^4.24.0 || ^5.0.0"
},
"suggest": {
"symfony/yaml": "v2.3+ required if using the Front Matter extension"
},
- "time": "2023-08-30T16:55:00+00:00",
+ "time": "2024-08-16T11:46:16+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "2.5-dev"
+ "dev-main": "2.6-dev"
}
},
"installation-source": "dist",
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.php b/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.php
index b3afad7e..44f8489e 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => 'clockoon/dokuwiki-commonmark-plugin',
'pretty_version' => '1.2.1',
'version' => '1.2.1.0',
- 'reference' => NULL,
+ 'reference' => null,
'type' => 'dokuwiki-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -13,7 +13,7 @@
'clockoon/dokuwiki-commonmark-plugin' => array(
'pretty_version' => '1.2.1',
'version' => '1.2.1.0',
- 'reference' => NULL,
+ 'reference' => null,
'type' => 'dokuwiki-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -29,9 +29,9 @@
'dev_requirement' => false,
),
'league/commonmark' => array(
- 'pretty_version' => '2.4.1',
- 'version' => '2.4.1.0',
- 'reference' => '3669d6d5f7a47a93c08ddff335e6d945481a1dd5',
+ 'pretty_version' => '2.5.3',
+ 'version' => '2.5.3.0',
+ 'reference' => 'b650144166dfa7703e62a22e493b853b58d874b0',
'type' => 'library',
'install_path' => __DIR__ . '/../league/commonmark',
'aliases' => array(),
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/CHANGELOG.md b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/CHANGELOG.md
index c2cd312a..917e5e80 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/CHANGELOG.md
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/CHANGELOG.md
@@ -6,6 +6,77 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
## [Unreleased][unreleased]
+## [2.5.3] - 2024-08-16
+
+### Changed
+
+- Made compatible with CommonMark spec 0.31.1, including:
+ - Remove `source`, add `search` to list of recognized block tags
+
+## [2.5.2] - 2024-08-14
+
+### Changed
+
+- Boolean attributes now require an explicit `true` value (#1040)
+
+### Fixed
+
+- Fixed regression where text could be misinterpreted as an attribute (#1040)
+
+## [2.5.1] - 2024-07-24
+
+### Fixed
+
+- Fixed attribute parsing incorrectly parsing mustache-like syntax (#1035)
+- Fixed incorrect `Table` start line numbers (#1037)
+
+## [2.5.0] - 2024-07-22
+
+### Added
+
+- The `AttributesExtension` now supports attributes without values (#985, #986)
+- The `AutolinkExtension` exposes two new configuration options to override the default behavior (#969, #987):
+ - `autolink/allowed_protocols` - an array of protocols to allow autolinking for
+ - `autolink/default_protocol` - the default protocol to use when none is specified
+
+### Changed
+
+- Made compatible with CommonMark spec 0.31.0, including:
+ - Allow closing fence to be followed by tabs
+ - Remove restrictive limitation on inline comments
+ - Unicode symbols now treated like punctuation (for purposes of flankingness)
+ - Trailing tabs on the last line of indented code blocks will be excluded
+ - Improved HTML comment matching
+- `Paragraph`s only containing link reference definitions will be kept in the AST until the `Document` is finalized
+ - (These were previously removed immediately after parsing the `Paragraph`)
+
+### Fixed
+
+- Fixed list tightness not being determined properly in some edge cases
+- Fixed incorrect ending line numbers for several block types in various scenarios
+- Fixed lowercase inline HTML declarations not being accepted
+
+## [2.4.4] - 2024-07-22
+
+### Fixed
+
+- Fixed SmartPunct extension changing already-formatted quotation marks (#1030)
+
+## [2.4.3] - 2024-07-22
+
+### Fixed
+
+- Fixed the Attributes extension not supporting CSS level 3 selectors (#1013)
+- Fixed `UrlAutolinkParser` incorrectly parsing text containing `www` anywhere before an autolink (#1025)
+
+
+## [2.4.2] - 2024-02-02
+
+### Fixed
+
+- Fixed declaration parser being too strict
+- `FencedCodeRenderer`: don't add `language-` to class if already prefixed
+
## [2.4.1] - 2023-08-30
### Fixed
@@ -560,7 +631,14 @@ No changes were introduced since the previous release.
- Alternative 1: Use `CommonMarkConverter` or `GithubFlavoredMarkdownConverter` if you don't need to customize the environment
- Alternative 2: Instantiate a new `Environment` and add the necessary extensions yourself
-[unreleased]: Comparing 2.4.1...main · thephpleague/commonmark · GitHub
+[unreleased]: Comparing 2.5.3...main · thephpleague/commonmark · GitHub
+[2.5.3]: Comparing 2.5.2...2.5.3 · thephpleague/commonmark · GitHub
+[2.5.2]: Comparing 2.5.1...2.5.2 · thephpleague/commonmark · GitHub
+[2.5.1]: Comparing 2.5.0...2.5.1 · thephpleague/commonmark · GitHub
+[2.5.0]: Comparing 2.4.4...2.5.0 · thephpleague/commonmark · GitHub
+[2.4.4]: Comparing 2.4.3...2.4.4 · thephpleague/commonmark · GitHub
+[2.4.3]: Comparing 2.4.2...2.4.3 · thephpleague/commonmark · GitHub
+[2.4.2]: Comparing 2.4.1...2.4.2 · thephpleague/commonmark · GitHub
[2.4.1]: Comparing 2.4.0...2.4.1 · thephpleague/commonmark · GitHub
[2.4.0]: Comparing 2.3.9...2.4.0 · thephpleague/commonmark · GitHub
[2.3.9]: Comparing 2.3.8...2.3.9 · thephpleague/commonmark · GitHub
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/README.md b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/README.md
index 2106902a..36a337b0 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/README.md
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/README.md
@@ -98,7 +98,7 @@ See [our extension documentation](CommonMark for PHP - Markdown done right
Custom parsers/renderers can be bundled into extensions which extend CommonMark. Here are some that you may find interesting:
- - [Alt Three Emoji](GitHub - AltThree/Emoji: An emoji parser for Laravel 5.) An emoji parser for CommonMark.
+ - [Emoji extension](GitHub - ElGigi/CommonMarkEmoji: CommonMark extension adds UTF-8 emoji with Github tag for the `league/commonmark` PHP Markdown parsing engine, based on the CommonMark spec.) - UTF-8 emoji extension with Github tag.
- [Sup Sub extensions](GitHub - OWS/commonmark-sup-sub-extensions: A sup/sub extension for CommonMark PHP implementation) - Adds support of superscript and subscript (`<sup>` and `<sub>` HTML tags)
- [YouTube iframe extension](GitHub - zoonru/commonmark-ext-youtube-iframe: Extension for league/commonmark to replace youtube link with iframe.) - Replaces youtube link with iframe.
- [Lazy Image extension](GitHub - simonvomeyser/commonmark-ext-lazy-image: Adds support for lazy images to the phpleague/commonmark package) - Adds various options for lazy loading of images.
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/composer.json b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/composer.json
index 3dfb755f..9b906620 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/composer.json
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/composer.json
@@ -31,8 +31,8 @@
"require-dev": {
"ext-json": "*",
"cebe/markdown": "^1.0",
- "commonmark/cmark": "0.30.0",
- "commonmark/commonmark.js": "0.30.0",
+ "commonmark/cmark": "0.31.1",
+ "commonmark/commonmark.js": "0.31.1",
"composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4",
"erusev/parsedown": "^1.0",
@@ -40,10 +40,10 @@
"michelf/php-markdown": "^1.4 || ^2.0",
"nyholm/psr7": "^1.5",
"phpstan/phpstan": "^1.8.2",
- "phpunit/phpunit": "^9.5.21",
+ "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
"scrutinizer/ocular": "^1.8.1",
- "symfony/finder": "^5.3 | ^6.0",
- "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0",
+ "symfony/finder": "^5.3 | ^6.0 || ^7.0",
+ "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 || ^7.0",
"unleashedtech/php-coding-standard": "^3.1.1",
"vimeo/psalm": "^4.24.0 || ^5.0.0"
},
@@ -56,9 +56,9 @@
"type": "package",
"package": {
"name": "commonmark/commonmark.js",
- "version": "0.30.0",
+ "version": "0.31.1",
"dist": {
- "url": "https://github.com/commonmark/commonmark.js/archive/0.30.0.zip",
+ "url": "https://github.com/commonmark/commonmark.js/archive/0.31.1.zip",
"type": "zip"
}
}
@@ -67,9 +67,9 @@
"type": "package",
"package": {
"name": "commonmark/cmark",
- "version": "0.30.0",
+ "version": "0.31.1",
"dist": {
- "url": "https://github.com/commonmark/cmark/archive/0.30.0.zip",
+ "url": "https://github.com/commonmark/cmark/archive/0.31.1.zip",
"type": "zip"
}
}
@@ -80,7 +80,7 @@
"name": "github/gfm",
"version": "0.29.0",
"dist": {
- "url": "https://github.com/github/cmark-gfm/archive/0.29.0.gfm.9.zip",
+ "url": "https://github.com/github/cmark-gfm/archive/0.29.0.gfm.13.zip",
"type": "zip"
}
}
@@ -112,7 +112,7 @@
},
"extra": {
"branch-alias": {
- "dev-main": "2.5-dev"
+ "dev-main": "2.6-dev"
}
},
"config": {
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php
index de5c111e..d13a565e 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php
@@ -23,7 +23,7 @@
*/
final class AttributesHelper
{
- private const SINGLE_ATTRIBUTE = '\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
+ private const SINGLE_ATTRIBUTE = '\s*([.]-?[_a-z][^\s}]*|[#][^\s}]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
private const ATTRIBUTE_LIST = '/^{:?(' . self::SINGLE_ATTRIBUTE . ')+}/i';
/**
@@ -75,6 +75,11 @@ public static function parseAttributes(Cursor $cursor): array
/** @psalm-suppress PossiblyUndefinedArrayOffset */
[$name, $value] = \explode('=', $attribute, 2);
+ if ($value === 'true') {
+ $attributes[$name] = true;
+ continue;
+ }
+
$first = $value[0];
$last = \substr($value, -1);
if (($first === '"' && $last === '"') || ($first === "'" && $last === "'") && \strlen($value) > 1) {
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php
index 3516ebba..54aafd4d 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php
@@ -14,13 +14,26 @@
namespace League\CommonMark\Extension\Autolink;
use League\CommonMark\Environment\EnvironmentBuilderInterface;
-use League\CommonMark\Extension\ExtensionInterface;
+use League\CommonMark\Extension\ConfigurableExtensionInterface;
+use League\Config\ConfigurationBuilderInterface;
+use Nette\Schema\Expect;
-final class AutolinkExtension implements ExtensionInterface
+final class AutolinkExtension implements ConfigurableExtensionInterface
{
+ public function configureSchema(ConfigurationBuilderInterface $builder): void
+ {
+ $builder->addSchema('autolink', Expect::structure([
+ 'allowed_protocols' => Expect::listOf('string')->default(['http', 'https', 'ftp'])->mergeDefaults(false),
+ 'default_protocol' => Expect::string()->default('http'),
+ ]));
+ }
+
public function register(EnvironmentBuilderInterface $environment): void
{
$environment->addInlineParser(new EmailAutolinkParser());
- $environment->addInlineParser(new UrlAutolinkParser());
+ $environment->addInlineParser(new UrlAutolinkParser(
+ $environment->getConfiguration()->get('autolink.allowed_protocols'),
+ $environment->getConfiguration()->get('autolink.default_protocol'),
+ ));
}
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php
index f44da335..1ef270fe 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php
@@ -56,7 +56,7 @@ final class UrlAutolinkParser implements InlineParserInterface
*
* @psalm-readonly
*/
- private array $prefixes = ['www'];
+ private array $prefixes = ['www.'];
/**
* @psalm-var non-empty-string
@@ -65,10 +65,12 @@ final class UrlAutolinkParser implements InlineParserInterface
*/
private string $finalRegex;
+ private string $defaultProtocol;
+
/**
* @param array<int, string> $allowedProtocols
*/
- public function __construct(array $allowedProtocols = ['http', 'https', 'ftp'])
+ public function __construct(array $allowedProtocols = ['http', 'https', 'ftp'], string $defaultProtocol = 'http')
{
/**
* @psalm-suppress PropertyTypeCoercion
@@ -78,6 +80,8 @@ public function __construct(array $allowedProtocols = ['http', 'https', 'ftp'])
foreach ($allowedProtocols as $protocol) {
$this->prefixes = $protocol . '://';
}
+
+ $this->defaultProtocol = $defaultProtocol;
}
public function getMatchDefinition(): InlineParserMatch
@@ -120,9 +124,9 @@ public function parse(InlineParserContext $inlineContext): bool
$cursor->advanceBy(\mb_strlen($url, 'UTF-8'));
- // Auto-prefix 'http://' onto 'www' URLs
+ // Auto-prefix 'http(s)://' onto 'www' URLs
if (\substr($url, 0, 4) === 'www.') {
- $inlineContext->getContainer()->appendChild(new Link('http://' . $url, $url));
+ $inlineContext->getContainer()->appendChild(new Link($this->defaultProtocol . '://' . $url, $url));
return true;
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php
index 74f9ca84..504a38a2 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php
@@ -27,7 +27,7 @@ class ListBlock extends AbstractBlock implements TightBlockInterface
public const DELIM_PERIOD = 'period';
public const DELIM_PAREN = 'paren';
- protected bool $tight = false;
+ protected bool $tight = false; // TODO Make lists tight by default in v3
/** @psalm-readonly */
protected ListData $listData;
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php
index 88572c7f..96a5baa4 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php
@@ -44,7 +44,7 @@ public function tryContinue(Cursor $cursor, BlockContinueParserInterface $active
{
// Check for closing code fence
if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === $this->block->getChar()) {
- $match = RegexHelper::matchFirst('/^(?:`{3,}|~{3,})(?= *$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition());
+ $match = RegexHelper::matchFirst('/^(?:`{3,}|~{3,})(?=[ \t]*$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition());
if ($match !== null && \strlen($match[0]) >= $this->block->getLength()) {
// closing fence - we're at end of line, so we can finalize now
return BlockContinue::finished();
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php
index b7c425aa..ac6406fb 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php
@@ -63,21 +63,14 @@ public function addLine(string $line): void
public function closeBlock(): void
{
- $reversed = \array_reverse($this->strings->toArray(), true);
- foreach ($reversed as $index => $line) {
- if ($line !== '' && $line !== "\n" && ! \preg_match('/^(\n *)$/', $line)) {
- break;
- }
+ $lines = $this->strings->toArray();
- unset($reversed[$index]);
+ // Note that indented code block cannot be empty, so $lines will always have at least one non-empty element
+ while (\preg_match('/^[ \t]*$/', \end($lines))) { // @phpstan-ignore-line
+ \array_pop($lines);
}
- $fixed = \array_reverse($reversed);
- $tmp = \implode("\n", $fixed);
- if (\substr($tmp, -1) !== "\n") {
- $tmp .= "\n";
- }
-
- $this->block->setLiteral($tmp);
+ $this->block->setLiteral(\implode("\n", $lines) . "\n");
+ $this->block->setEndLine($this->block->getStartLine() + \count($lines) - 1);
}
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php
index 4dffb7ac..5a7ee45a 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php
@@ -27,10 +27,6 @@ final class ListBlockParser extends AbstractBlockContinueParser
/** @psalm-readonly */
private ListBlock $block;
- private bool $hadBlankLine = false;
-
- private int $linesAfterBlank = 0;
-
public function __construct(ListData $listData)
{
$this->block = new ListBlock($listData);
@@ -48,32 +44,50 @@ public function isContainer(): bool
public function canContain(AbstractBlock $childBlock): bool
{
- if (! $childBlock instanceof ListItem) {
- return false;
- }
-
- // Another list item is being added to this list block.
- // If the previous line was blank, that means this list
- // block is "loose" (not tight).
- if ($this->hadBlankLine && $this->linesAfterBlank === 1) {
- $this->block->setTight(false);
- $this->hadBlankLine = false;
- }
-
- return true;
+ return $childBlock instanceof ListItem;
}
public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
{
- if ($cursor->isBlank()) {
- $this->hadBlankLine = true;
- $this->linesAfterBlank = 0;
- } elseif ($this->hadBlankLine) {
- $this->linesAfterBlank++;
- }
-
// List blocks themselves don't have any markers, only list items. So try to stay in the list.
// If there is a block start other than list item, canContain makes sure that this list is closed.
return BlockContinue::at($cursor);
}
+
+ public function closeBlock(): void
+ {
+ $item = $this->block->firstChild();
+ while ($item instanceof AbstractBlock) {
+ // check for non-final list item ending with blank line:
+ if ($item->next() !== null && self::endsWithBlankLine($item)) {
+ $this->block->setTight(false);
+ break;
+ }
+
+ // recurse into children of list item, to see if there are spaces between any of them
+ $subitem = $item->firstChild();
+ while ($subitem instanceof AbstractBlock) {
+ if ($subitem->next() && self::endsWithBlankLine($subitem)) {
+ $this->block->setTight(false);
+ break 2;
+ }
+
+ $subitem = $subitem->next();
+ }
+
+ $item = $item->next();
+ }
+
+ $lastChild = $this->block->lastChild();
+ if ($lastChild instanceof AbstractBlock) {
+ $this->block->setEndLine($lastChild->getEndLine());
+ }
+ }
+
+ private static function endsWithBlankLine(AbstractBlock $block): bool
+ {
+ $next = $block->next();
+
+ return $next instanceof AbstractBlock && $block->getEndLine() !== $next->getStartLine() - 1;
+ }
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php
index 65b4535b..a55f6f9d 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php
@@ -58,6 +58,7 @@ public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserSta
if (! ($matched instanceof ListBlockParser) || ! $listData->equals($matched->getBlock()->getListData())) {
$listBlockParser = new ListBlockParser($listData);
// We start out with assuming a list is tight. If we find a blank line, we set it to loose later.
+ // TODO for 3.0: Just make them tight by default in the block so we can remove this call
$listBlockParser->getBlock()->setTight(true);
return BlockStart::of($listBlockParser, $listItemParser)->at($cursor);
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php
index 73b98be7..739eefcb 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php
@@ -13,11 +13,9 @@
namespace League\CommonMark\Extension\CommonMark\Parser\Block;
-use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock;
use League\CommonMark\Extension\CommonMark\Node\Block\ListData;
use League\CommonMark\Extension\CommonMark\Node\Block\ListItem;
use League\CommonMark\Node\Block\AbstractBlock;
-use League\CommonMark\Node\Block\Paragraph;
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
use League\CommonMark\Parser\Block\BlockContinue;
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
@@ -28,8 +26,6 @@ final class ListItemParser extends AbstractBlockContinueParser
/** @psalm-readonly */
private ListItem $block;
- private bool $hadBlankLine = false;
-
public function __construct(ListData $listData)
{
$this->block = new ListItem($listData);
@@ -47,18 +43,7 @@ public function isContainer(): bool
public function canContain(AbstractBlock $childBlock): bool
{
- if ($this->hadBlankLine) {
- // We saw a blank line in this list item, that means the list block is loose.
- //
- // spec: if any of its constituent list items directly contain two block-level elements with a blank line
- // between them
- $parent = $this->block->parent();
- if ($parent instanceof ListBlock) {
- $parent->setTight(false);
- }
- }
-
- return true;
+ return ! $childBlock instanceof ListItem;
}
public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
@@ -69,9 +54,6 @@ public function tryContinue(Cursor $cursor, BlockContinueParserInterface $active
return BlockContinue::none();
}
- $activeBlock = $activeBlockParser->getBlock();
- // If the active block is a code block, blank lines in it should not affect if the list is tight.
- $this->hadBlankLine = $activeBlock instanceof Paragraph || $activeBlock instanceof ListItem;
$cursor->advanceToNextNonSpaceOrTab();
return BlockContinue::at($cursor);
@@ -87,4 +69,14 @@ public function tryContinue(Cursor $cursor, BlockContinueParserInterface $active
// Note: We'll hit this case for lazy continuation lines, they will get added later.
return BlockContinue::none();
}
+
+ public function closeBlock(): void
+ {
+ if (($lastChild = $this->block->lastChild()) instanceof AbstractBlock) {
+ $this->block->setEndLine($lastChild->getEndLine());
+ } else {
+ // Empty list item
+ $this->block->setEndLine($this->block->getStartLine());
+ }
+ }
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php
index e7204ea6..8df9a40e 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php
@@ -41,7 +41,12 @@ public function render(Node $node, ChildNodeRendererInterface $childRenderer): \
$infoWords = $node->getInfoWords();
if (\count($infoWords) !== 0 && $infoWords[0] !== '') {
- $attrs->append('class', 'language-' . $infoWords[0]);
+ $class = $infoWords[0];
+ if (! \str_starts_with($class, 'language-')) {
+ $class = 'language-' . $class;
+ }
+
+ $attrs->append('class', $class);
}
return new HtmlElement(
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
index 97c9d1a4..959930b3 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php
@@ -24,12 +24,19 @@
final class QuoteParser implements InlineParserInterface
{
+ /**
+ * @deprecated This constant is no longer used and will be removed in a future major release
+ */
public const DOUBLE_QUOTES = [Quote::DOUBLE_QUOTE, Quote::DOUBLE_QUOTE_OPENER, Quote::DOUBLE_QUOTE_CLOSER];
+
+ /**
+ * @deprecated This constant is no longer used and will be removed in a future major release
+ */
public const SINGLE_QUOTES = [Quote::SINGLE_QUOTE, Quote::SINGLE_QUOTE_OPENER, Quote::SINGLE_QUOTE_CLOSER];
public function getMatchDefinition(): InlineParserMatch
{
- return InlineParserMatch::oneOf(...\array_merge(self::DOUBLE_QUOTES, self::SINGLE_QUOTES));
+ return InlineParserMatch::oneOf(Quote::SINGLE_QUOTE, Quote::DOUBLE_QUOTE);
}
/**
@@ -40,8 +47,6 @@ public function parse(InlineParserContext $inlineContext): bool
$char = $inlineContext->getFullMatch();
$cursor = $inlineContext->getCursor();
- $normalizedCharacter = $this->getNormalizedQuoteCharacter($char);
-
$charBefore = $cursor->peek(-1);
if ($charBefore === null) {
$charBefore = "\n";
@@ -58,28 +63,15 @@ public function parse(InlineParserContext $inlineContext): bool
$canOpen = $leftFlanking && ! $rightFlanking;
$canClose = $rightFlanking;
- $node = new Quote($normalizedCharacter, ['delim' => true]);
+ $node = new Quote($char, ['delim' => true]);
$inlineContext->getContainer()->appendChild($node);
// Add entry to stack to this opener
- $inlineContext->getDelimiterStack()->push(new Delimiter($normalizedCharacter, 1, $node, $canOpen, $canClose));
+ $inlineContext->getDelimiterStack()->push(new Delimiter($char, 1, $node, $canOpen, $canClose));
return true;
}
- private function getNormalizedQuoteCharacter(string $character): string
- {
- if (\in_array($character, self::DOUBLE_QUOTES, true)) {
- return Quote::DOUBLE_QUOTE;
- }
-
- if (\in_array($character, self::SINGLE_QUOTES, true)) {
- return Quote::SINGLE_QUOTE;
- }
-
- return $character;
- }
-
/**
* @return bool
*/
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Node/Block/Paragraph.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Node/Block/Paragraph.php
index 5b7d17c2..d06d84ea 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Node/Block/Paragraph.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Node/Block/Paragraph.php
@@ -18,4 +18,6 @@
class Paragraph extends AbstractBlock
{
+ /** @internal */
+ public bool $onlyContainsLinkReferenceDefinitions = false;
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php
index bacb5122..c03c24ef 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php
@@ -15,6 +15,7 @@
use League\CommonMark\Node\Block\AbstractBlock;
use League\CommonMark\Node\Block\Document;
+use League\CommonMark\Node\Block\Paragraph;
use League\CommonMark\Parser\Cursor;
use League\CommonMark\Reference\ReferenceMapInterface;
@@ -50,4 +51,30 @@ public function tryContinue(Cursor $cursor, BlockContinueParserInterface $active
{
return BlockContinue::at($cursor);
}
+
+ public function closeBlock(): void
+ {
+ $this->removeLinkReferenceDefinitions();
+ }
+
+ private function removeLinkReferenceDefinitions(): void
+ {
+ $emptyNodes = ;
+
+ $walker = $this->document->walker();
+ while ($event = $walker->next()) {
+ $node = $event->getNode();
+ // TODO for v3: It would be great if we could find an alternate way to identify such paragraphs.
+ // Unfortunately, we can't simply check for empty paragraphs here because inlines haven't been processed yet,
+ // meaning all paragraphs will appear blank here, and we don't have a way to check the status of the reference parser
+ // which is attached to the (already-closed) paragraph parser.
+ if ($event->isEntering() && $node instanceof Paragraph && $node->onlyContainsLinkReferenceDefinitions) {
+ $emptyNodes = $node;
+ }
+ }
+
+ foreach ($emptyNodes as $node) {
+ $node->detach();
+ }
+ }
}
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php
index 1573429f..f9312be9 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php
@@ -59,9 +59,7 @@ public function addLine(string $line): void
public function closeBlock(): void
{
- if ($this->referenceParser->hasReferences() && $this->referenceParser->getParagraphContent() === '') {
- $this->block->detach();
- }
+ $this->block->onlyContainsLinkReferenceDefinitions = $this->referenceParser->hasReferences() && $this->referenceParser->getParagraphContent() === '';
}
public function parseInlines(InlineParserEngineInterface $inlineParser): void
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/MarkdownParser.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/MarkdownParser.php
index dcf9a420..2fecb9ba 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/MarkdownParser.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Parser/MarkdownParser.php
@@ -158,12 +158,13 @@ private function parseLine(string $line): void
$unmatchedBlocks = 0;
}
+ $oldBlockLineStart = null;
if ($blockStart->isReplaceActiveBlockParser()) {
- $this->prepareActiveBlockParserForReplacement();
+ $oldBlockLineStart = $this->prepareActiveBlockParserForReplacement();
}
foreach ($blockStart->getBlockParsers() as $newBlockParser) {
- $blockParser = $this->addChild($newBlockParser);
+ $blockParser = $this->addChild($newBlockParser, $oldBlockLineStart);
$tryBlockStarts = $newBlockParser->isContainer();
}
}
@@ -176,7 +177,7 @@ private function parseLine(string $line): void
} else {
// finalize any blocks not matched
if ($unmatchedBlocks > 0) {
- $this->closeBlockParsers($unmatchedBlocks, $this->lineNumber);
+ $this->closeBlockParsers($unmatchedBlocks, $this->lineNumber - 1);
}
if (! $blockParser->isContainer()) {
@@ -275,12 +276,12 @@ private function processInlines(): void
* Add block of type tag as a child of the tip. If the tip can't accept children, close and finalize it and try
* its parent, and so on til we find a block that can accept children.
*/
- private function addChild(BlockContinueParserInterface $blockParser): BlockContinueParserInterface
+ private function addChild(BlockContinueParserInterface $blockParser, ?int $startLineNumber = null): BlockContinueParserInterface
{
- $blockParser->getBlock()->setStartLine($this->lineNumber);
+ $blockParser->getBlock()->setStartLine($startLineNumber ?? $this->lineNumber);
while (! $this->getActiveBlockParser()->canContain($blockParser->getBlock())) {
- $this->closeBlockParsers(1, $this->lineNumber - 1);
+ $this->closeBlockParsers(1, ($startLineNumber ?? $this->lineNumber) - 1);
}
$this->getActiveBlockParser()->getBlock()->appendChild($blockParser->getBlock());
@@ -307,7 +308,10 @@ private function deactivateBlockParser(): BlockContinueParserInterface
return $popped;
}
- private function prepareActiveBlockParserForReplacement(): void
+ /**
+ * @return int|null The line number where the old block started
+ */
+ private function prepareActiveBlockParserForReplacement(): ?int
{
// Note that we don't want to parse inlines or finalize this block, as it's getting replaced.
$old = $this->deactivateBlockParser();
@@ -317,6 +321,8 @@ private function prepareActiveBlockParserForReplacement(): void
}
$old->getBlock()->detach();
+
+ return $old->getBlock()->getStartLine();
}
/**
diff --git a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Util/RegexHelper.php b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Util/RegexHelper.php
index 44e7e3ad..a89e7bda 100644
--- a/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Util/RegexHelper.php
+++ b/dokuwiki/lib/plugins/commonmark/vendor/league/commonmark/src/Util/RegexHelper.php
@@ -41,7 +41,7 @@ final class RegexHelper
public const PARTIAL_REG_CHAR = '[^\\\\()\x00-\x20]';
public const PARTIAL_IN_PARENS_NOSP = '\((' . self::PARTIAL_REG_CHAR . '|' . self::PARTIAL_ESCAPED_CHAR . '|\\\\)*\)';
public const PARTIAL_TAGNAME = '[a-z][a-z0-9-]*';
- public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)';
+ public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)';
public const PARTIAL_ATTRIBUTENAME = '[a-z_:][a-z0-9:._-]*';
public const PARTIAL_UNQUOTEDVALUE = '[^"\'=<>`\x00-\x20]+';
public const PARTIAL_SINGLEQUOTEDVALUE = '\'[^\']*\'';
@@ -53,9 +53,9 @@ final class RegexHelper
public const PARTIAL_CLOSETAG = '<\/' . self::PARTIAL_TAGNAME . '\s*[>]';
public const PARTIAL_OPENBLOCKTAG = '<' . self::PARTIAL_BLOCKTAGNAME . self::PARTIAL_ATTRIBUTE . '*' . '\s*\/?>';
public const PARTIAL_CLOSEBLOCKTAG = '<\/' . self::PARTIAL_BLOCKTAGNAME . '\s*[>]';
- public const PARTIAL_HTMLCOMMENT = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
+ public const PARTIAL_HTMLCOMMENT = '<!-->|<!--->|<!--[\s\S]*?-->';
public const PARTIAL_PROCESSINGINSTRUCTION = '[<][?][\s\S]*?[?][>]';
- public const PARTIAL_DECLARATION = '<![A-Z]+' . '\s+[^>]*>';
+ public const PARTIAL_DECLARATION = '<![A-Za-z]+' . '[^>]*>';
public const PARTIAL_CDATA = '<!\[CDATA\[[\s\S]*?]\]>';
public const PARTIAL_HTMLTAG = '(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . '|' . self::PARTIAL_HTMLCOMMENT . '|' .
self::PARTIAL_PROCESSINGINSTRUCTION . '|' . self::PARTIAL_DECLARATION . '|' . self::PARTIAL_CDATA . ')';
@@ -65,7 +65,7 @@ final class RegexHelper
'|' . '\'(' . self::PARTIAL_ESCAPED_CHAR . '|[^\'\x00])*\'' .
'|' . '\((' . self::PARTIAL_ESCAPED_CHAR . '|[^()\x00])*\))';
- public const REGEX_PUNCTUATION = '/^[\x{2000}-\x{206F}\x{2E00}-\x{2E7F}\p{Pc}\p{Pd}\p{Pe}\p{Pf}\p{Pi}\p{Po}\p{Ps}\\\\\'!"#\$%&\(\)\*\+,\-\.\\/:;<=>\?@\[\]\^_`\{\|\}~]/u';
+ public const REGEX_PUNCTUATION = '/^[!"#$%&\'()*+,\-.\\/:;<=>?@\\[\\]\\\\^_`{|}~\p{P}\p{S}]/u';
public const REGEX_UNSAFE_PROTOCOL = '/^javascript:|vbscript:|file:|data:/i';
public const REGEX_SAFE_DATA_PROTOCOL = '/^data:image\/(?:png|gif|jpeg|webp)/i';
public const REGEX_NON_SPACE = '/[^ \t\f\v\r\n]/';