From 3f33e97f0c9279c6479a29b663ffed2dccbbfbb7 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 2 Feb 2015 17:25:14 -0700 Subject: [PATCH] fix for markdown adding HTML tags into inline JS/CSS --- system/src/Grav/Common/Assets.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index b14ba7233..b63de9c72 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -301,7 +301,9 @@ class Assets */ public function addInlineCss($asset, $priority = 10) { - $asset = (string) $asset; + if (is_a($asset, 'Twig_Markup')) { + $asset = strip_tags((string)$asset); + } $key = md5($asset); if (is_string($asset) && !array_key_exists($key, $this->inline_css)) { $this->inline_css[$key] = [ @@ -327,7 +329,9 @@ class Assets */ public function addInlineJs($asset, $priority = 10) { - $asset = (string) $asset; + if (is_a($asset, 'Twig_Markup')) { + $asset = strip_tags((string)$asset); + } $key = md5($asset); if (is_string($asset) && !array_key_exists($key, $this->inline_js)) { $this->inline_js[$key] = [