停止Sparkview转义html [英] Stop Sparkview escaping html

查看:99
本文介绍了停止Sparkview转义html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试输出一些HTML视频标签,其中包括

I am trying to output some HTML video tags park of which include

<source src="${Model.WebMFilename}" type='video/webm; codecs="vp8, vorbis"' />

但是在浏览器中,它呈现为

However in the browser this renders as

<source vorbis""="" vp8,="" type="video/webm; codecs=" src="VP8_645001.webm"></source>

有什么想法可以阻止Sparkview重新格式化输出格式吗?

Any idea how I stop Sparkview reformatting the output?

推荐答案

您确定您的输出吗?我通过源代码中的单元测试运行了这个确切的场景,得到了以下内容:

Are you sure about your output? I ran this exact scenario through a unit test in the source code and I got the following:

输入:

<source src="${Model.WebMFilename}" type='video/webm; codecs="vp8, vorbis"' />

结果:

<source src="VP8_645001.webm"  type="video/webm; codecs="vp8, vorbis"" />

这看起来像是Spark中的功能",在客户端框架,json流行度和HTML5属性使用中变得越来越普遍.

This looks like a "feature" in Spark is getting in the way here, and this is becoming more prevalent with client side frameworks, json popularity and HTML5 attributes usage.

我所说的功能"是Spark可以读取您的输入,并且您可以在属性周围使用单引号或双引号,并且它可以毫无问题地理解属性内的值,但是存在当前视图的副作用自动(且错误地)使用双引号而不是您实际使用的引号类型替换周围属性的编译.

The "feature" I speak of is that Spark can read your input and you can have single or double quotes surrounding your attributes and it will understand the value inside the attribute without an issue, but there is a current side effect of view compilation that automatically (and incorrectly) replaces the surrounding attributes with double quote instead of the quote type you actually used.

我目前正在源代码中对此进行修复.同时,您可以尝试将双引号放在属性的外部,并尝试在单引号的内部,尽管我知道这确实破坏了某些客户端框架,因为它们没有期待那个.您可以改用吗?(注意:里面的单引号):

I am currently working on a fix for this in the source code. In the mean time, you could try and place your double quotes on the outside of the attribute and try single quotes on the inside although I know this does break some of the client side frameworks since they don't expect that. Can you try this instead (Note: single quote on the inside):

<source src="${Model.WebMFilename}" type="video/webm; codecs='vp8, vorbis'" />

希望有帮助,
罗布

Hope that helps,
Rob

这篇关于停止Sparkview转义html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆