# HG changeset patch # User Maxim Dounin <mdou...@mdounin.ru> # Date 1713125471 -10800 # Sun Apr 14 23:11:11 2024 +0300 # Node ID cc0402def1f9c4c8a8089cb2d8ad7795dd17668b # Parent 01dc9ba12e1ba472f22d6f1be3eaa3c2b4f2879e XSLScript: added CDATA support.
Notably, this simplifies adding javascript code to templates, which otherwise require complex escaping. Requested by Igor Sysoev. diff --git a/xslscript.pl b/xslscript.pl --- a/xslscript.pl +++ b/xslscript.pl @@ -45,6 +45,7 @@ startrule : <skip:""> item(s) eofile { $return = $item{'item(s)'}; 1 } item : "<!--" <commit> comment + | "<![CDATA[" <commit> cdata | "!!" <commit> exclam_double | "!{" <commit> exclam_xpath | "!" name <commit> params @@ -108,6 +109,11 @@ instruction : "X:stylesheet" comment : /((?!-->).)*/ms "-->" { $return = "<!--" . $item[1] . "-->"; 1 } +# cdata, <![CDATA[ ... ]]> + +cdata : /((?!]]>).)*/ms "]]>" + { $return = "<![CDATA[" . $item[1] . "]]>"; 1 } + # special chars: ', ", {, }, \ # if used in text, they needs to be escaped with backslash -- nginx-devel mailing list nginx-devel@freenginx.org https://freenginx.org/mailman/listinfo/nginx-devel