From 899557ea8e85064f2ca591a9f7f01f4c8cdce6be Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Mon, 20 Nov 2023 11:36:02 +0100 Subject: [PATCH] added support for application/ld+json (#353) --- src/Latte/Compiler/Escaper.php | 2 +- tests/common/contentType.html.javascript.phpt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Latte/Compiler/Escaper.php b/src/Latte/Compiler/Escaper.php index 0b47cef8d..89553c915 100644 --- a/src/Latte/Compiler/Escaper.php +++ b/src/Latte/Compiler/Escaper.php @@ -120,7 +120,7 @@ public function enterHtmlText(ElementNode $el): void if ($el->is('script')) { $type = $el->getAttribute('type'); if ($type === true || $type === null - || is_string($type) && preg_match('#((application|text)/(((x-)?java|ecma|j|live)script|json)|text/plain|module|importmap|)$#Ai', $type) + || is_string($type) && preg_match('#((application|text)/(((x-)?java|ecma|j|live)script|(.+\+)?json)|text/plain|module|importmap|)$#Ai', $type) ) { $this->subType = self::JavaScript; diff --git a/tests/common/contentType.html.javascript.phpt b/tests/common/contentType.html.javascript.phpt index 167168ff0..dec73ad21 100644 --- a/tests/common/contentType.html.javascript.phpt +++ b/tests/common/contentType.html.javascript.phpt @@ -88,6 +88,11 @@ Assert::match( $latte->renderToString(''), ); +Assert::match( + '', + $latte->renderToString(''), +); + Assert::match( '', $latte->renderToString(''),