Browse Source

Minor serializer fix when reformatting whitespace with templates

master
Dustin Wilson 2 years ago
parent
commit
8a405cb5d0
  1. 12
      composer.lock
  2. 3
      lib/Serializer.php
  3. 38
      vendor-bin/phpunit/composer.lock
  4. 34
      vendor-bin/robo/composer.lock

12
composer.lock

@ -80,6 +80,9 @@
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"files": [
"lib/Parser/ctype.php"
],
"psr-4": { "psr-4": {
"MensBeam\\HTML\\": [ "MensBeam\\HTML\\": [
"lib/" "lib/"
@ -87,9 +90,6 @@
}, },
"classmap": [ "classmap": [
"lib/Parser/Token.php" "lib/Parser/Token.php"
],
"files": [
"lib/Parser/ctype.php"
] ]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -376,12 +376,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]

3
lib/Serializer.php

@ -43,10 +43,9 @@ class Serializer extends ParserSerializer {
} }
protected static function treatAsBlockWithTemplates(\DOMNode $node): bool { protected static function treatAsBlockWithTemplates(\DOMNode $node): bool {
$parent = $node->parentNode ?? $node;
$document = $node->ownerDocument; $document = $node->ownerDocument;
$xpath = $document->xpath; $xpath = $document->xpath;
$templates = $xpath->query('.//template[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"][not(ancestor::iframe[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::listing[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::noembed[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::noframes[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::noscript[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::plaintext[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::pre[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::style[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::script[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::textarea[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::title[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::xmp[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"])]', $parent); $templates = $xpath->query('.//template[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"][not(ancestor::iframe[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::listing[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::noembed[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::noframes[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::noscript[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::plaintext[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::pre[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::style[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::script[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::textarea[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::title[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"] or ancestor::xmp[namespace-uri()="" or namespace-uri()="http://www.w3.org/1999/xhtml"])]', $node);
foreach ($templates as $t) { foreach ($templates as $t) {
$content = static::getTemplateContent($t); $content = static::getTemplateContent($t);

38
vendor-bin/phpunit/composer.lock

@ -99,12 +99,12 @@
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [ "files": [
"src/DeepCopy/deep_copy.php" "src/DeepCopy/deep_copy.php"
] ],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -248,16 +248,16 @@
}, },
{ {
"name": "phar-io/version", "name": "phar-io/version",
"version": "3.1.0", "version": "3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phar-io/version.git", "url": "https://github.com/phar-io/version.git",
"reference": "bae7c545bef187884426f042434e561ab1ddb182" "reference": "15a90844ad40f127afd244c0cad228de2a80052a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", "url": "https://api.github.com/repos/phar-io/version/zipball/15a90844ad40f127afd244c0cad228de2a80052a",
"reference": "bae7c545bef187884426f042434e561ab1ddb182", "reference": "15a90844ad40f127afd244c0cad228de2a80052a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -293,9 +293,9 @@
"description": "Library for handling version information and constraints", "description": "Library for handling version information and constraints",
"support": { "support": {
"issues": "https://github.com/phar-io/version/issues", "issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.1.0" "source": "https://github.com/phar-io/version/tree/3.1.1"
}, },
"time": "2021-02-23T14:00:09+00:00" "time": "2022-02-07T21:56:48+00:00"
}, },
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
@ -904,11 +904,11 @@
} }
}, },
"autoload": { "autoload": {
"classmap": [
"src/"
],
"files": [ "files": [
"src/Framework/Assert/Functions.php" "src/Framework/Assert/Functions.php"
],
"classmap": [
"src/"
] ]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -1451,16 +1451,16 @@
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
"version": "5.0.3", "version": "5.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git", "url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" "reference": "19c519631c5a511b7ed0ad64a6713fdb3fd25fe4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/19c519631c5a511b7ed0ad64a6713fdb3fd25fe4",
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "reference": "19c519631c5a511b7ed0ad64a6713fdb3fd25fe4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1503,7 +1503,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues", "issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.4"
}, },
"funding": [ "funding": [
{ {
@ -1511,7 +1511,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-06-11T13:31:12+00:00" "time": "2022-02-10T07:01:19+00:00"
}, },
{ {
"name": "sebastian/lines-of-code", "name": "sebastian/lines-of-code",

34
vendor-bin/robo/composer.lock

@ -1333,12 +1333,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -1414,12 +1414,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -1501,12 +1501,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -1578,12 +1578,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]
@ -1657,12 +1657,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
] ]

Loading…
Cancel
Save